... | ... | @@ -90,4 +90,17 @@ Fig. 2 - Robot at desired distance |
|
|
|
|
|
From looking at the code the Tracker class appears to have implemented a PID controller. Power is equal to the proportional term, where Pgain is set to 2.0 and error is the measured distance from the wall subtracted by the desiredDistance.
|
|
|
|
|
|
As described above the error is equal to the measured distance from the wall subtracted by the desiredDistance. According to referance 4 in the Lab Lesson plan (http://en.wikipedia.org/wiki/PID_controller#Set_Point_step_change) the error is equal to SP-PV. We can thus conclude that the setpoint (SP) is the distance from the wall (distance) and the process variable (PV) is the desiredDistance which is set to 35. The manipulated variable (MV) is the value calculated by the PID controller. In this case this is equal to the power variable. The power is then sent to the motor determining how fast the robot should move away or towards the wall. |
|
|
\ No newline at end of file |
|
|
As described above the error is equal to the measured distance from the wall subtracted by the desiredDistance. According to referance 4 in the Lab Lesson plan (http://en.wikipedia.org/wiki/PID_controller#Set_Point_step_change) the error is equal to SP-PV. We can thus conclude that the setpoint (SP) is the distance from the wall (distance) and the process variable (PV) is the desiredDistance which is set to 35. The manipulated variable (MV) is the value calculated by the PID controller. In this case this is equal to the power variable. The power is then sent to the motor determining how fast the robot should move away or towards the wall.
|
|
|
|
|
|
## Exercise 5
|
|
|
|
|
|
**Task**
|
|
|
Experiment and find parameters, so the robot will oscillate wildly around a distance from an object given by the constant value of the variable desiredDistance.
|
|
|
|
|
|
**Plan:**
|
|
|
Run the Control Tracker program on the PC and change parameters to make the NXT oscillate wildly. We tested different settings and found that a minPower of 100 and Gain of 1 made the desired result. This can be seen in the video link.
|
|
|
|
|
|
[![image alt text]Video: https://drive.google.com/open?id=0B4Vn_sxU595gV19PZXQ3VGdGLVU&authuser=0
|
|
|
|
|
|
minPower: 100 Gain: 1
|
|
|
In this setting we achieved the goal of making the robot oscillate in an effort to reach the desired distance to the wall. With minPower set to 100 the robot continuously managed to drive past the desired point. Once the destination point was exceeded the robot drove in reverse to get back to its desired destination. Another reason why the robot drives past its intended destination is the sample rate which is set to 100ms. This means that the robot is constantly influenced by a small delay as the sensor interprets the environment. In order to compensate this behaviour the gain value can be manipulated causing the robot to slow down gradually as it approaches the desiredDistance. |