Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
300599. Advanced Robotics Project 2 Neural networks for robot control (30% of the overall mark) Final individual report of the project must be submitted turnitin link on vUWS by 10AM, Monday 7 June 2021 NOTE: This is an individual project, any copying/plagiarism will be reported for official investigation and be penalised accordingly! Figure 1 shows a two-link robot. The dynamic equations of this robot are shown in the Appendix. Numerical values for relevant parameters used in the equations are given in table 1. A SIMULINK model (“robotmodel.slx”) of the robot is also provided that accepts driving torques in robot joints and generates positions and velocities of the robot joints. The aims of this project are: 1. To implement a computed-torque controller (CTC) in SIMULINK for this robot (equations are given in Equation (2) on p.3). 2. To train a neural network controller (NNC) to perform the CTC and implement this NN controller in SIMULINK. The controllers developed are to be implemented in SIMULINK to demonstrate their effectiveness. You are required to work individually. The assessment will be based on the final individual written report. Support and help will be provided during tutorials in Week 13 – 14. Assessment Schedule: Submit a type written report (no hand written report will be accepted/marked), in either word or PDF format, (no more than 15 pages) providing the methodology used, listing of SIMULINK programs (of the robot, the CTC and NNC), example outputs and performance comparison and analysis of the controllers (both CTC and NNC). In particular, the report should address at least the following asepects: 1. Introduction 2. Methods: a. CTC methods/equations, controller calculation, and CTC implementation in the simulation b. NNC methods – that including NN structure, training process 3. Results: a. CTC results – controller gains used, simulation results with error comparisons b. NNC results – NN training results (accuracy), NNC controller outcomes with error comparison. 4. Discussions and conclusions 5. Simulation models and programs – you should include these in the report and submit the codes/models in the code submission link. APPENDIX: l1 m2 m1 Figure 1. l2 A two link robot. Robot dynamic equations: τ 1 = H11θ!!1 + H12θ!!2 + h1 + c1 τ 2 = H12θ!!1 + H 22θ!!2 + h2 + c2 where 1 1 H11 = m1l12 + m2l12 + m2l22 + m2l1l2 cosθ 2 3 3 1 1 H12 = m2l22 + m2l1l2 cosθ 2 3 2 1 H 22 = m2l22 3 h = − 2hθ! θ! + hθ! 2 1 ( 1 2 2 ) h2 = hθ!12 1 h = m2l1l2 sin θ 2 2 ⎛1 ⎞ 1 c1 = ⎜ m1 + m2 ⎟ gl1 cosθ1 + m2 gl2 cos (θ1 + θ 2 ) ⎝2 ⎠ 2 1 c2 = m2 gl2 cos (θ1 + θ 2 ) 2 For the purpose of training the NN, the operating range of the robot is assumed to be: q Î [-p, p] (rad), q! Î [-5, 5] (rad/sec) and q!! Î [-10,10] (rad/sec2). Table 1. Parameters of the two link IBM robot. Parameters Length of the first link (l1) Length of the second link (l2) Mass of the first link (m1) Mass of the second link (m2) Torque limit for joint 1 (T1max) Torque limit for joint 2 (T2max) Structural resonant frequency of the robot (fr) Value 0.50 (m) 0.25 (m) 10.0 (kg) 5.6 (kg) ±100.0 (N-m) ±50.0 (N-m) 10 (Hz) The Computed-Torque-Controller (CTC) Design: The robot dynamic equations are written, in matrix form, as: 𝜏=# 𝐻!! 𝐻!" 𝑐! 𝐻!" 𝜃̈! ℎ % & ) + # ! % + ,𝑐 . 𝐻"" 𝜃̈" ℎ" " (1) where H11, H12, H22, h1, and h2 are given in the previous page. q!!1 and q!!2 are joint accelerations for joints 1 and 2. The CTC equation will be of the form: 𝐻 𝜏# = # !! 𝐻!" $ $ $ 𝑐! 𝐻!" 𝜃!̈ + 𝐾%! 0𝜃!̇ − 𝜃!̇ 3 + 𝐾&! (𝜃! − 𝜃! ) ℎ! %& $ ) + # % + , 𝑐" . 𝐻"" 𝜃̈" + 𝐾%" 0𝜃̇"$ − 𝜃̇" 3 + 𝐾&" (𝜃"$ − 𝜃" ) ℎ" (2) where the superscript d represents the desired joint accelerations, velocities and positions; while Kp1, Kp2, Kv1, and Kv2 are control gains that can be calculated using the following characteristic equation of a second order system: e!! + KV e! + K P e = 0 Therefore, to achieve the certain damping ratio z (≥1) and natural frequency wn (≤0.5wr), K v = 2zwn and K p = wn2 If z = 1 and wn = 0.5wr are chosen, then the controller gains can be determined. Hints regarding the project: Technical hints: 1. To build and to implement the CTC in SIMULINK: Students will need to put the CTC (or NNC) functions into a MATLAB function in Simulink. In the above screen shot of the Simulink Library, you can find the required SIMULINK block under “User-Defined Functions” and then drag the “Interpreted MATLAB Function” icon to your model. You can then double click the icon and provide the name of the function (for example: CTC or NNC). After this is done, you will need to create a function called ‘CTC.m’ or ‘NNC.m” in the directory that you will run the simulation. In the function, you will need to put the equations that you use for the CTC or the code you use to calculate NN outputs for the NNC. (See the simulation model provided for this project – there is a sample controller using the file called “mycontroller.m”). 2. To implement an NN controller. To train the neural network to implement the controller, you will need to generate random inputs that covers the operating range of the robot: q Î [-p, p] (rad), q! Î [-5, 5] (rad/sec) and q!! Î [-10,10] (rad/sec2). Then appropriate equations should be used to calculate the controller outputs for these randomly generated inputs. You should refer to the example program that was posted with Week 11 Lecture Notes on vUWS for how to train an NN. The neural network can be trained to realise the CTC equation (2). However, as there are more variables in equation (2) than in equation (1), it is more efficient to train the NN to learn equation (1). Once an NN is trained to realise equation (1), then the CTC controller can be implemented by replacing the input to neural network for q!! by q!!d + KV (q!d - q!) + K P (q d - q ) . This short linear equation can be pre-calculated using mathematical equations before input to the NN. By using this method, the training time for the NN can be reduced significantly!! However, it is OK if you wish to train the NN using equation (2). Once the NN is trained, you will need to put this NN into another MATLAB function similar to what you have done for CTC. 3. Desired trajectory for the CTC and the NN controller. To test the effectiveness of the controllers you have designed, you will need some desired trajectories for the robot to follow. You can design your own trajectory planner for this robot and use the controller to follow the trajectories generated. However, to save time, you can also use the sine wave generator in Simulink as your desired trajectories. (Caution: if you do use the sine wave generator, please make sure that the velocity and acceleration of the trajectory agrees with the position signals). Time schedule hint: The creation of SIMULINK model of the robot and the implementation of the CTC should be very straightforward. You should aim to finish this in the first week of your project. The NN training, on the other hand, could take some time especially when you are not familiar with the software and if the computer you use is not powerful. Please start early – if you start early you can submit early and get on to your other assignments!