... | ... | @@ -28,7 +28,7 @@ Self-balancing robot with light sensor |
|
|
|
|
|
For this exercise we used a LEGO model build according to the description in [2]. The robot includes two motors which are connected to port A and C due to port B/C being connected to the same H-bridge. A light sensor is mounted on the lower part of the robot in a height of approximately 1.5 cm above the surface. In general it is a simple construction with a relatively high center of gravity which will likely pose a challenge for the control mechanism. Our final model is shown in the following image.
|
|
|
|
|
|
![NXTWay robot with light sensor mounted](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson5/Images/LightSensorRobot.JPG)
|
|
|
![NXTWay robot with light sensor mounted.](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson5/Images/LightSensorRobot.JPG)
|
|
|
|
|
|
We know that the surface which the robot is placed on affects the control mechanism and therefore three different materials are tested. These are a clean white table, a wooden table and a carpet floor which are shown in the following image.
|
|
|
|
... | ... | @@ -107,9 +107,9 @@ The entire code can be seen in [4]. |
|
|
|
|
|
By inspecting the performance we concluded that the best of the three surfaces was the clean white surface and therefore the following tuning and analysis of the PID parameters are performed on this surface. Despite our expectations the surrounding light did not seem to affect the light sensor control mechanism significantly.
|
|
|
|
|
|
In order to find the most suitable control parameters we started out setting `Kp`, `Ki` and `Kd` to 0 and then adjusting one paramter at a time through the PC GUI. The procedure was the following
|
|
|
In order to find the most suitable control parameters we started out setting `Kp`, `Ki` and `Kd` to 0 and then adjusting one parameter at a time through the PC GUI. The procedure was the following
|
|
|
|
|
|
1. Setting the paramter to a large value to inspect the effect of the paramter
|
|
|
1. Setting the parameter to a large value to inspect the effect of the parameter
|
|
|
2. Lowering the value until the performance began to worsen.
|
|
|
|
|
|
By doing this procedure for each parameter we ended up with the following estimate of the best possible setting of the control parameters:
|
... | ... | @@ -147,7 +147,7 @@ In general this robot construction is taller than the NXTway [2] but still it ha |
|
|
|
|
|
An image of the robot is seen in the following image.
|
|
|
|
|
|
![NXT Segway with Rider with light sensor mounted](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson5/Images/ColorSensorRobot.JPG)
|
|
|
![NXT Segway with Rider with light sensor mounted.](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson5/Images/ColorSensorRobot.JPG)
|
|
|
|
|
|
The procedure for testing this robot is similar to the procedure in exercise 1. The same surfaces and light conditions are analyzed according to control mechanism.
|
|
|
|
... | ... | @@ -179,11 +179,11 @@ A video of the robot balancing with these control parameters applied on the whit |
|
|
|
|
|
In order to compare these results with the results of exercise 1 the data logger is used to collect the color sensor readings during the execution of the program. The end result of this is seen in the following image.
|
|
|
|
|
|
![Output of the color sensor when performing self-balancing](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson5/Measurement/ColorMeasurements.png)
|
|
|
![Output of the color sensor when performing self-balancing.](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson5/Measurement/ColorMeasurements.png)
|
|
|
|
|
|
This plot shows the light intensity given by the color sensor as the blue graph and the offset is the red line.
|
|
|
|
|
|
It is clear that this the configuration in this exercise is far better than the configuration from exercise 1. The light intensity continues to fluctuate around the offset for much longer time. Three times during the run of this program the robot need human assitances in order to stay balanced. This is at `time = 16s`, `time = 26s` and `time = 37s` where the light intensity drops indicating that the robot is tilting backwards.
|
|
|
It is clear that this the configuration in this exercise is far better than the configuration from exercise 1. The light intensity continues to fluctuate around the offset for much longer time. Three times during the run of this program the robot need human assistances in order to stay balanced. This is at `time = 16s`, `time = 26s` and `time = 37s` where the light intensity drops indicating that the robot is tilting backwards.
|
|
|
|
|
|
With the defined parameters the robot is again tested on the aforementioned surfaces. This resulted in the following.
|
|
|
|
... | ... | @@ -191,10 +191,10 @@ With the defined parameters the robot is again tested on the aforementioned surf |
|
|
* **Wooden table**: The robot could balance for 1-3 seconds
|
|
|
* **White surface**: The robot could balance for ~25 seconds. Ended by falling of the table.
|
|
|
|
|
|
Although it seems, from these results, that the color sensor is superior compared to the light sensor analyzed in exercise 1. However the robot configurations in these two exercises are incomparable due to the general robot contruction and the difference in center of gravity.
|
|
|
Although it seems, from these results, that the color sensor is superior compared to the light sensor analyzed in exercise 1. However the robot configurations in these two exercises are incomparable due to the general robot construction and the difference in center of gravity.
|
|
|
|
|
|
To perform a proper comparison between the two sensors, in a self-balancing context, the color sensor on the NXT Segway with Rider [3] is replaced by the light sensor and the same procedure from this exercise is carried out.
|
|
|
Despite our expections the light sensor performed worse than the color sensor under the same conditions. The reason for this could be a difference in power level between the tests otherwise the reason is unknown.
|
|
|
Despite our expectations the light sensor performed worse than the color sensor under the same conditions. The reason for this could be a difference in power level between the tests otherwise the reason is unknown.
|
|
|
|
|
|
## Exercise 3
|
|
|
|
... | ... | @@ -312,15 +312,9 @@ Other similar tests could be performed to test how the environment(temperature, |
|
|
|
|
|
To test the robot and the different gains effect on the robot, as described in the setup, we tried to control the robot with one gain at a time:
|
|
|
|
|
|
<<<<<<< HEAD
|
|
|
* **KGyroAngle**: Controlling the robot only with the gyro angle, was not possible. The problem encountered was that the angle drifted with time. In the beginning of the test, the angle was correctly 0 degrees when the robot was in an upright position, but during the test this changed to +5-10 degrees. This meant that the robot tried to maintain a position which was not upright, and therefore fell over.
|
|
|
* **KGyroSpeed**: The gyro speed did not drift in the same way as the angle and as a consequent the control using only the gyro speed was much better than the angle, although it was not sufficient for the robot to maintain balance. Since this term becomes non-zero fast when the robot is falling, it causes the control to act faster than relying on the angle alone does.
|
|
|
* **KSpeed**: The motor speed gain determines the resistance in the motor. The faster the wheel was spanned, the higher the resistance from the motor.
|
|
|
=======
|
|
|
* **KGyroAngle**: Controlling the robot only with the gyro angle, was not possible. The problem encountered was that the angle drifted with time. In the beginning of the test, the angle was correctly 0 degrees when the robot was in an upright position, but during the test this changed to +5-10 degrees. This meant that the robot tried to maintain a position which was not upright, and therefore fell over.
|
|
|
* **KGyroSpeed**: The gyro speed did not drift in the same way as the angle and as a consequent the control using only the gyro speed was much better than the angle, although it was not sufficient for the robot to maintain balance.
|
|
|
* **KSpeed**: The motor speed gain determines the resistance in the motor. The faster the wheel was spun, the higher the resistance from the motor.
|
|
|
>>>>>>> Minor changes
|
|
|
* **KPos**: The motor position gain makes the wheel turn back to its original position. Increasing the gain increases the speed with which the motor turns back to the set-point. If increased to much, the motors starts oscillating.
|
|
|
|
|
|
A possible cause for the erroneous angle could be, that the gyro sensor is more sensitive in the forward direction than backwards, causing a small error on each gyro speed calculation, which the integration over time then accumulates.
|
... | ... | @@ -329,18 +323,21 @@ In the second part, the gyro sensor was attached to the lower part of the robot. |
|
|
|
|
|
## Conclusion
|
|
|
|
|
|
In this lesson we have performed expriements with various robot contructions and software implementations in order to create a self-balancing robot. We found out that this is not a straight forward task and many external factors plays an important role.
|
|
|
In this lesson we have performed experiments with various robot constructions and software implementation in order to create a self-balancing robot. We found out that this is not a straight forward task and many external factors plays an important role.
|
|
|
|
|
|
Two sensors, a light and color sensor, was analyzed in a PID control context. With the right surface and the right lighting we were able to make the robot balance for ~25 seconds. However just by introducing natural light the robot was only able to balance for ~2 seconds which is a significantly deterioration. The same applies to the surface where a non-uniform also yields a deterioration. From this we can conclude that when using these types of sensors in a control context the surroundings should be kept in mind.
|
|
|
|
|
|
According to our results the color sensor performed better than the light sensor.
|
|
|
|
|
|
|
|
|
Two sensors, light and color sensor, was analyzed in a PID control context.
|
|
|
|
|
|
|
|
|
The self-balancing performance when using the gyro based robot was low. This was mostly due to small errors in angle calculation accumulating over time, causing the robot to loose track of the current angle and then falling over. Since the error in the calculated value was positive in all experiments, we think the sensor may have been more sensitive in the positive direction than the negative. Other sources of error includes the looseness of the construction causing the robot and in turn the gyro measurements to oscillate. We also believe that the motor was introducing tremors, however we did not test this.
|
|
|
The setup of this robot could possibly be enhanced by introducing sensor fusion using a light or color sensor. This would introduce an absolute value corresponding to the angle of the robot, as opposed to the dead-reckoning style approach used in this exercise.
|
|
|
|
|
|
Although no specific test of the motor and sensors performance vs battery level was performed, it is our clear perception that all the tested segway application perform better when the battery level is high. This might be because the performance of the sensors and motors are lower, or because the motor affects the sensors more, when the battery is low.
|
|
|
|
|
|
## References
|
|
|
|
|
|
[1] http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson5.dir/Lesson.html
|
... | ... | |