Due in class at 10:00 on 24 June. To be completed by pairs of students. Pair assignments can be found on D2L.
Proceed through the preliminaries and then the questions section. Compile a brief report (2-3 pages) that provides answers and brief commentary on the questions given. Attach a hard copy of your final script to the report (copy it into an external text editor and bold the parts that you created or modified). You must also submit your final script on D2L. There is a folder called “PA1″ created for each group.
Preliminaries
V-Rep
Download and install V-Rep PRO EDU version. Launch the program and open one of the built-in scenes. For example go File -> “Open Scene” -> “e-puckDemo.ttt”. Hit the Play button to see the robot move. In the “Scene hierarchy” you will see an entry called “ePuck”. Double-click on the page icon to bring up the robot’s control script. Understanding the details of this particular script is not important. However, you should see that modifications to the script affect the robot’s behaviour, but only at the start of the next simulation run. Find the following line:
maxVel=120*math.pi/180
Now change 120 to 500 or some other high value. Re-start the simulation to see how the robot’s behaviour is affected. You can move any object in the scene by first clicking on the object, then hitting the “Object/item shift” button in the toolbar which looks like this:
Notice that a dialog box comes up. You can shift this box to the side and click and drag the selected object in order to move it. Try moving the robot and the plant. Once you are done, close the scene: File -> “Close Scene”.
Lua
V-Rep scripts are usually written in the Lua language (it is possible to utilize other languages with V-Rep). Here is a quick Lua crash course. A google search will reveal many other tutorials. However, you really don’t need to know many details of the language for this lab.
PA1.ttt
Download PA1.ttt. Save to a convenient location and then open it in V-Rep. Examine the contents of the robot’s control script. The overall goal of the script is to drive the robot to reach the green cylinder. You can utilize the “Object / item shift” button to move either the robot or the goal. You are not required to understand every line of the script. However, you should be able to understand the control strategy applied. The actuation part of the script (lines 27-87) computes a quantity called alpha which is the angle of the goal with respect to the forward axis of the robot. Lines 63 and 64 set the forward speed as a constant and apply a proportional controller for angular speed based on alpha.
The simulation is configured to run for 10 simulated seconds, then pause. Questions 1-3 below are focussed on the behaviour of the robot during this initial period. You can hit the “Play” button again to let the robot reach the goal. Notice that the robot will never come to a rest. This is expected.
Questions
- Open the robot’s control script. Execute the simulation and observe the robot’s behaviour as it approaches the goal. A graph of the angle “alpha” is shown which includes some oscillatory component. Experiment with the constant “k_prop” and try to identify the largest value which does not yield any oscillation. The smallest step size you should attempt is 0.25.
- Identify the following line in the script:
simulateDisturbance = false
Change the value from false to true and observe the behaviour of the robot. Note that it no longer approaches the goal directly. However, after the simulation pauses and you allow it to run again you may notice that the goal is eventually reached. Experiment by moving the goal and the robot. We do not have an explicit model of the robot, yet you should still be able to make some comments on the system’s stability.[17 June: Since we haven’t covered stability yet there is no need to provide an answer here.]
- We will now correct the disturbance introduced in the previous question. First of all, think of the alpha value as the error signal we wish to minimize (when alpha = 0 it means the robot is heading straight for the goal). Review your existing knowledge of PI controllers and incorporate an integral term based on alpha (i.e. the error) to compensate for the disturbance. The simulated disturbance could be corrected trivially just by adding 0.5 to the angular speed. However, you should incorporate code that will remove the system’s steady-state error even if 0.5 was replaced with a different value.
- With the PI controller in place, let the robot approach the goal from various positions, then move the goal and see how it reacts. You may notice a strange behaviour where the robot spins erratically. You can make this behaviour appear by moving the goal in circles around the robot, then letting the robot try and approach it. This phenomenon is known as integral windup. Do some research on this term and try and come up with a simple solution to the problem.
- Complete the controller by setting the forward speed to zero once the robot’s distance to the goal falls below a threshold.