170 likes | 354 Views
Introduction to the first laboratory exercise Continuous neural network sliding mode controller DSP2 realization. Andreja Rojko andreja.rojko@uni-mb.si TARET PROJECT. OUTLINE. Overview Dynamic model of the experimental mechanism Simulation model of the experimental mechanism
E N D
Introduction to the first laboratory exerciseContinuous neural network sliding mode controller DSP2 realization Andreja Rojko andreja.rojko@uni-mb.si TARET PROJECT
OUTLINE • Overview • Dynamic model of the experimental mechanism • Simulation model of the experimental mechanism • Sin2 velocity profile – reference trajectory • PI position control • Controller algorithm – NN • Controller algorithm - C code • Controller algorithm - test • Complete simulation scheme • Experiment – C code, test on DSP2 • Experiment Andreja Rojko
Dynamic model of the experimental mechanism • General dynamic model of mechanism: • Inertia: • Spring torque: Andreja Rojko
Dynamic model of the experimental mechanism • Dynamic model of the experimental mechanism: • Gear ratio: Andreja Rojko
Simulation model of the experimental mechanism Andreja Rojko
Sin2 velocity profile – reference trajectory • For position and velocity control of mechanisms we need reference trajectory: desired position, desired velocity and desired acceleration. The reference trajectory is defined with the following data: • initial position( theta_initial), end position (theta_final) • maximum velocity (vmax) • maximum acceleration,(amax) Andreja Rojko
Sin2 velocity profile – reference trajectory Andreja Rojko
PI position control • PI position controller, PI current controller. • Set the parameters of PI position controller. • 'trial and error' procedure. Andreja Rojko
Controller algorithm - NN • Neural netwok with two layers will be constructed for the use inCSMNN control algorithm. • Nonlinear threshold function will be used for the hidden layer, so that its outputwill have values between -1 and 1. • Linear threshold function will be used for the output layer. • Sketch the NN structure! Mark the lines with the names of variables. • For learning algorithm, the equations form E-book will be used. • Case study from e-book ‘direct drive robot’ -> rewrite into equations for our one axis experimental mechanism. • We will use different names because we cannot use Greek letters in C code...table of the preferable variables names and their sizes is in the instructions. Andreja Rojko
Controller algorithm - C code • For programming the controller algorithm in C, we will use S-Function Builder block. • NN’s weights should be declared as global variables and initialized to small numbers between -1 and 1 (Example1). • Writing the C code: • Don’t try to write the whole algorithm at once! • First write and test the code for calculation of the output from NN. • Then add the learning algorithm for the output layer and then, when this is working, also for the hidden layer. • It is advisable to check some parts of the program (specially loops) in Matlab m-file! Andreja Rojko
Controller algorithm - test Andreja Rojko
Controller algorithm - test Andreja Rojko
Complete simulation scheme Andreja Rojko
Experiment – C code • Declaration and initialization of the global variables should be altered for C compiler on DSP2 board! • Reason: Matlab uses different C code compiler then it is used on DSP2 board. • First test, if algorithm’s C code is working on DSP2 (without mechanism). Andreja Rojko
Experiment – test Andreja Rojko
Experiment Andreja Rojko
Conclusion • Read the instructions for each step carefully before you begin to work. • Between work write the report: explain each step, give the results, explain the results! • Required part: Experiment with PI position control, Simulation of the CSMNN control algorithm with the neural network, teleoperation by using PI position control. • Desired: Experiment with CSMNN (even if it is not working perfectly). • NOTE! In the experimental part don’t let the motor oscillating for too long, because it can be damaged! Andreja Rojko