Assignment - Introduction to Robotics
In the following problems, you will need the NAO simulator and Matlab for CLMCPLOT for other visualizations.
IMPORTANT: In your solutions of the homework, also provide intermediate steps how you de- rived the solution to a problem.
1. In this homework, you are supposed to create a complete point-to-point reaching behavior for the NAO robot. First, you will need to create a planning system for point-to- point movements for the endeffector (left hand) of the robot. Second, you will need to im- plement the plan on the robot simulator and visualize the outcome to confirm that it works.
a) For planning, you are to create a 3th order spline system (a "cubic spline"). The general 3th order spline equation is:
x (t) = c0 + c1t + c2t2 + c3t3
Assume the movement duration is τ , and the movement starts at t = 0. Assume that at start the movement is at x0, and it is supposed to reach xf at time t = τ. Determine all the constants c0 to c3 as a function of x0, xf, and their derivatives, and τ . At start and end velocities are x·(0) = x·0, x·(τ) = x·f.
b) Using matlab, implement a planning system that creates a trajectory of 2 seconds duration, starting at position x=0 and going to a target at x=2, with zero velocity boundary conditions. Use a time step of 0.01s to compute the movement plan. Provide a print-out of your matlab code, and plots of position, velocity, and acceleration for the entire trajectory.
c) A useful way to implement the cubic spline planning system is by creating a function that takes as input variables the current state x(t), x·(t), the remaining time to go τtogo, and the target state xf, x·f. The output of the function would be x(t + Δt), x·(t + Δt), i.e., the planned
state one time increment ahead. This function can be used to plan the next desired state given the current desired state, which is useful in a control loop of a robot. Note that the time-to-go τtogo needs to be decreased at every iteration of the control loop by Δt . Implement this function in matlab, and create the results of b) using this incremental planning system. Compare the results of b) and c) and comment on the differences and similarities.
d) The webpage has a file cubic_spline_task.cpp. Modify this file to implement your cubic spline function from matlab. Run the task using the "setTask" command in the blue task_servo window. You will automatically collect a data file, and you should save it to disk with "saveData". Visualize the trajectories of all 5 left arm DOFs in CLMCPLOT in matlab, i.e., print the data traces L_SFE_th and L_SFE_des_th in the top most chart of clmcplot, and then the data traces for L_SAA, L_HR, L_EB, and L_WR in the next 4 charts. Create a print- out of your visualization and include it in your homework. Comment on the quality of tracking for the 5 DOFs. Repeat the same for the plot, this time using joint velocities, and then an- other plot using joint accelerations.
e) Add three additional targets to you C-program such that the left arm creates approximately a square in Cartesian space. Note that due to the joint-space movements, the hand movement in Cartesian space is curved. Your square should end at the same point where it started. Collect data of your movement and save it such that it can be visualized with CLMCPLOT. In clm- cplot, click the "PhasePlot" button, and then click LEFT_HAND_x and then LEFT_HAND_y. This creates a window that plot LEFT_HAND_x in the horizontal axis, and LEFT _HAND_y in the vertical axis. Provide this plot in your homework and comment on what is good or bad about your realization of the square. Repeat this plot for LEFT_HAND_x and LEFT_HAND_z and provide this print-out as well. Comment on the quality of your square from this view.
2) Consider the dynamical system:
x·1 = bx1 + kx2 + x3
x·2 = x1
x·3 = α (u - x2) - βx3 (2)
a) Show a physical system that corresponds to the equations in (2) and explain what the parameters mean.
b) Transform the system into the frequency domain and give the individual transfer functions and the transfer function of the complete system. Provide a block diagram that shows how the individual transfer functions are connected.
c) Assume b=-1, k=-1, α=1, ß=10. Use Simulink to build a PD controller for the system, assuming that the system should track a sinusoidal desired trajectory with 1Hz fre- quency. Use the "Transfer Function" building block in Simulink for this implementation. At- tach a "Scope" to the simulation that simultaneously shows the true output of the system, and the desired output (note that "Scopes" accept vector inputs to display multiple trajectories superimposed). Also create a scope that shows the tracking error. Tune the gains of the PD controller to get as good as possible tracking performance. Give plots of i) your Simulink system, and ii) position and desired position as well as the tracking error of the best tracking performance (over 10 seconds simulation time). (Note, all Simulink windows allow copy/paste or direct printing of their contents). Make sure that all your plots are scaled such that they have maximal resolution in the vertical axis!
d) In real physical systems, the state of the controlled systems needs to be measured, usually by means of sensors that add some noise to the measurement. Additionally, the sen- sory feedback can only be measured at a certain frequency. In order to simulate such a senso- ry processing, add a "zero order hold" block (from the "Discrete" library) in the feedback path way of your system (i.e., the pathway leading back from the output of the system's transfer function to the negative feedback controller). Set the "sample time" parameter of this block to 0.005 (i.e., 200Hz). To simulate the noise in the sensory, take the "Random Num- ber" block from the "Sources" library and sum it into the feedback pathway after the "zero order hold". Set the "sample time" parameter of this block also to 0.005, and the variance parameter to 0.01. Now tune your PD gains to get the best performance for this more realistic control system and provide plots of the best tracking performance and tracking error as in point b-ii above. Briefly describe the difference in performance between the system in b) and the current one, and why this difference exists.
e) In order to deal with sensory noise, signal filtering is usually employed. A very simple filter is of the form:
x· = λ (u - x) where λ is the time constant of this filter and regulates the amount of filtering: the smaller λ , the more filtering is achieved. The danger of too much filtering, however, is that the filtered signal becomes delayed. Convert the filtering equation into a transfer function, and add it in the feedback pathway after the point where the noise was added. Adjust λ to improve the performance of you control system, and provide the same plots as in c). Briefly comment on the success of your filtering. Note that you may have to re-tune the PD controller for the filtering.