... | @@ -14,8 +14,8 @@ The goal of this exercise is to test three different sensors and physical robot |
... | @@ -14,8 +14,8 @@ The goal of this exercise is to test three different sensors and physical robot |
|
## Plan
|
|
## Plan
|
|
The plan is to follow the instructions for Lesson 5 [1]. This plan is divided into three parts:
|
|
The plan is to follow the instructions for Lesson 5 [1]. This plan is divided into three parts:
|
|
|
|
|
|
* Build the NXTWay robot and test its self-balancing capabilities using a light sensor and PID control.
|
|
* Build the NXTWay robot [2] and test its self-balancing capabilities using a light sensor and PID control.
|
|
* Build the NXT Segway with Rider and test its self-balancing capabilities using a color sensor and PID control.
|
|
* Build the NXT Segway with Rider [3] and test its self-balancing capabilities using a color sensor and PID control.
|
|
* Use the NXT Segway with Rider and test self-balancing capabilities using a gyro sensor and alternative control algorithm.
|
|
* Use the NXT Segway with Rider and test self-balancing capabilities using a gyro sensor and alternative control algorithm.
|
|
|
|
|
|
|
|
|
... | @@ -24,9 +24,9 @@ Self-balancing robot with light sensor |
... | @@ -24,9 +24,9 @@ Self-balancing robot with light sensor |
|
|
|
|
|
### Setup
|
|
### Setup
|
|
|
|
|
|
#### Physical setup
|
|
##### Physical setup
|
|
|
|
|
|
For this exercise we used a LEGO model build according to the description in [2]. Our final model is shown in the following image.
|
|
For this exercise we used a LEGO model build according to the description in [2]. The robot includes two motors which is connected to port A and C due to port B/C being connected to the same H-bridge. A lightsensor 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 might affect 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)
|
|
|
|
|
... | @@ -36,9 +36,9 @@ We know that the surface which the robot is placed on affects the control mechan |
... | @@ -36,9 +36,9 @@ We know that the surface which the robot is placed on affects the control mechan |
|
|
|
|
|
By inspecting the robots control mechanism we concluded that the best of the three surfaces was the blank white surface and therefore the following tuning and analysis of the PID parameters are performed on this surface.
|
|
By inspecting the robots control mechanism we concluded that the best of the three surfaces was the blank white surface and therefore the following tuning and analysis of the PID parameters are performed on this surface.
|
|
|
|
|
|
We also know that the surrounding light can be a key factor when using a light sensor in a PID control context. Two cases of surrounding light was analyzed; natural light and artificial light. Despite our expectations the surrounding light did not seem to affect the control mechanism significantly.
|
|
We also know that the surrounding light can be a key factor when using a light sensor in a PID control context. Two cases of surrounding light was analyzed; natural light and artificial light. Despite our expectations the surrounding light did not seem to affect the light sensor control mechanism significantly.
|
|
|
|
|
|
#### Software setup
|
|
##### Software setup
|
|
|
|
|
|
We have created a standard PID software architecture which makes the replacement of a sensor easy. The architecture is shown in the following image.
|
|
We have created a standard PID software architecture which makes the replacement of a sensor easy. The architecture is shown in the following image.
|
|
|
|
|
... | @@ -65,8 +65,6 @@ controlledValue = (kp * error) + (ki * integral) + (kd * derivative); |
... | @@ -65,8 +65,6 @@ controlledValue = (kp * error) + (ki * integral) + (kd * derivative); |
|
controlSignal(controlledValue);
|
|
controlSignal(controlledValue);
|
|
|
|
|
|
lastError = error;
|
|
lastError = error;
|
|
|
|
|
|
Delay.msDelay(dt);
|
|
|
|
```
|
|
```
|
|
|
|
|
|
were the functions `calculateError()` and `controlSignal()` is overriden by the specific PID controller, in this case the `LightPIDController`. The functions are shown in the following.
|
|
were the functions `calculateError()` and `controlSignal()` is overriden by the specific PID controller, in this case the `LightPIDController`. The functions are shown in the following.
|
... | @@ -103,7 +101,7 @@ protected void controlSignal(float controlledValue) { |
... | @@ -103,7 +101,7 @@ protected void controlSignal(float controlledValue) { |
|
```
|
|
```
|
|
|
|
|
|
|
|
|
|
The entire code can be seen in [2].
|
|
The entire code can be seen in [4].
|
|
|
|
|
|
### Results
|
|
### Results
|
|
|
|
|
... | @@ -131,7 +129,7 @@ When the LEGO robot is tilting forward the light sensor will get closer to the s |
... | @@ -131,7 +129,7 @@ When the LEGO robot is tilting forward the light sensor will get closer to the s |
|
Self-balancing robots with color sensor
|
|
Self-balancing robots with color sensor
|
|
|
|
|
|
### Setup
|
|
### Setup
|
|
The robot was assembled according to [3] with some minor modifications. Since the upright motor is not used in the case of a segway. An image of the robot is seen in the following image.
|
|
For this exercise we used a LEGO model build according to the description in [3] with some minor modifications. Since the upright motor is not used in the case of a segway. An image of the robot is seen in the following image.
|
|
|
|
|
|
This robot is tested
|
|
This robot is tested
|
|
|
|
|
... | @@ -154,7 +152,32 @@ Self-balancing robots with gyro sensor |
... | @@ -154,7 +152,32 @@ Self-balancing robots with gyro sensor |
|
|
|
|
|
### Setup
|
|
### Setup
|
|
|
|
|
|
The code for this exercise is inspired by the code described and linked in [4]. The full implementation can be found at [5], with the corresponding PC program located at [6].
|
|
The code for this exercise is inspired by the code described and linked in [5]. The full implementation can be found at [6], with the corresponding PC program located at [7].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// STIKORD:::
|
|
|
|
|
|
|
|
/// Indsæt billede
|
|
|
|
|
|
|
|
Sensoren har siddet to steder, først i toppen og dernæst længere nede -> Mindre rystelser, men også mindre udsving i vinklen.
|
|
|
|
|
|
|
|
|
|
|
|
Forklar hvordan vi har isoleret de forskellige gains og hvad de gjorde.
|
|
|
|
|
|
|
|
KGyroAngle = Positiv vinkel selvom den ikke burde/forkert vinkel -> Skru op for denne så vælter lortet. Robottens nulpunkt drifter
|
|
|
|
KGyroSpeed = Fungerer fint. Jo højere værdi jo hurtigere reagere robotten
|
|
|
|
KSpeed = Jo hurtigere hjulet drejes jo mere modstand gives i motoren.
|
|
|
|
KPos = VIrker som forventet. Bestemmer en gain faktor i forhold til hvor hurtigt motorene finder tilbage til set point
|
|
|
|
|
|
|
|
|
|
|
|
Hvad vi har prøvet:
|
|
|
|
|
|
|
|
- Gyroangle -> Robotten reagere for langsomt
|
|
|
|
- Afhjælpes med GyroSPeed Gain -> Robotten reagere hurtigt, men den ved ikke hvad vinklen er
|
|
|
|
-
|
|
|
|
|
|
|
|
////
|
|
|
|
|
|
### Results
|
|
### Results
|
|
|
|
|
... | @@ -168,23 +191,30 @@ The data shows, that the offset for this sensor is around 600. Furthermore, it c |
... | @@ -168,23 +191,30 @@ The data shows, that the offset for this sensor is around 600. Furthermore, it c |
|
|
|
|
|
## Conclusion
|
|
## Conclusion
|
|
|
|
|
|
|
|
Bedre gyro -> Sensor fusion
|
|
|
|
|
|
|
|
|
|
## References
|
|
## References
|
|
|
|
|
|
[1] http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson5.dir/Lesson.html
|
|
[1] http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson5.dir/Lesson.html
|
|
|
|
|
|
[2] https://gitlab.au.dk/rene2014/lego/tree/master/Lesson5/Programs/SegwayOnTheFlyNXT
|
|
[2] http://www.philohome.com/nxtway/nxtway.htm
|
|
|
|
|
|
[3] http://www.nxtprograms.com/NXT2/segway/index.html
|
|
[3] http://www.nxtprograms.com/NXT2/segway/index.html
|
|
|
|
|
|
[4] http://www.hitechnic.com/blog/gyro-sensor/htway/
|
|
[4] https://gitlab.au.dk/rene2014/lego/tree/master/Lesson5/Programs/SegwayOnTheFlyNXT
|
|
|
|
|
|
|
|
|
|
[5] https://gitlab.au.dk/rene2014/lego/tree/master/Lesson5/Programs/SegwayGyroSensor
|
|
[5] http://www.hitechnic.com/blog/gyro-sensor/htway/
|
|
|
|
|
|
[6] https://gitlab.au.dk/rene2014/lego/tree/master/Lesson5/Programs/SegwayGyroOnTheFlyPC
|
|
[6] https://gitlab.au.dk/rene2014/lego/tree/master/Lesson5/Programs/SegwayGyroSensor
|
|
|
|
|
|
|
|
[7] https://gitlab.au.dk/rene2014/lego/tree/master/Lesson5/Programs/SegwayGyroOnTheFlyPC
|
|
|
|
|
|
### Videos
|
|
### Videos
|
|
|
|
|
|
[Exercise 1] - https://www.youtube.com/watch?v=kqeq5SVmsWQ&feature=youtu.be
|
|
[Exercise 1] - https://www.youtube.com/watch?v=kqeq5SVmsWQ&feature=youtu.be
|
|
|
|
|
|
|
|
[Exercise 2] - https://www.youtube.com/watch?v=tngSdW6aB80
|
|
|
|
|
|
[Exercise 3.1] - http://youtu.be/fDe9IyF4uy8 |
|
[Exercise 3.1] - http://youtu.be/fDe9IyF4uy8 |
|
|
|
\ No newline at end of file |