... | ... | @@ -236,27 +236,22 @@ A final observation relating to this application is that the robot stopped immed |
|
|
It is possible to make a line follower with just one light sensor that follows the line more smoothly and drive faster if a PID regulator is used \[5\]. Try this.
|
|
|
|
|
|
#### Execution ####
|
|
|
In this exercise, we follow the description of a PID implementation given in the exercise sources<<<<<ref>>>>>. We refer to this article for the theoretical reasoning for building a PID algorithm.
|
|
|
In this exercise, we follow the description of a PID implementation given in the exercise sources \[5\]. We refer to this article for the theoretical reasoning for building a PID algorithm.
|
|
|
|
|
|
##### Big bang interpretation #####
|
|
|
First, we tried to integrate the entire PID pseudo code solution into our application in one step. As one would expect, this caused the robot to only react slightly to the black line, but mostly spin around in circles. See (the video)<<<ref>>>> for a video of the behaviour.
|
|
|

|
|
|
First, we tried to integrate the entire PID pseudo code solution into our application in one step. As one would expect, this caused the robot to only react slightly to the black line, but mostly spin around in circles. See \[6\] for a video of the behaviour.
|
|
|
|
|
|
Given the nature of big bang integration, the cause of this behaviour can be numerous factors. Most likely would be the amount of power given to the robots motors and variables directly translated from the source application.
|
|
|
|
|
|
##### Proportional algorithm #####
|
|
|
Instead of trying to fix issues with the entire PID algorithm we wrote, we instead reverted the algorithm to a form factoring in only the 'P' of PID, namely the proportional factor. In short terms, the idea behind a proportional algorithm is to have the robot change direction based on linear calculations instead of prompting a big change at a specific value. This reduces jaggedness in the robots behaviour such that it takes smaller turns depending on values read.
|
|
|
|
|
|
After implementing this, our robot seemed more responsive to the black line but still didn't work. The issue was soon found to be a software bug however, and after correcting for integers (by multiplying all factors by 100 and then dividing the resulting effect by 100), the robot behaved well. As can be seen in the video <<<ref>>>, movements are still abrupt, but much better than in previous exercises.
|
|
|
After implementing this, our robot seemed more responsive to the black line but still didn't work. The issue was soon found to be a software bug however, and after correcting for integers (by multiplying all factors by 100 and then dividing the resulting effect by 100), the robot behaved well. As can be seen in the video \[7\], movements are still abrupt, but much better than in previous exercises.
|
|
|
|
|
|
##### Integrating to correct behaviour given history and using derivative to predict future state #####
|
|
|
By integrating from an amount of previous samples, the application can classify its situation better, which allows the program to follow the line more closely. By taking the derivative of the last two error measures, we can also predict future states better.
|
|
|
|
|
|
As we didn't have any solution of how to set the values in our application for proportional (Kp), integral (Ki), differential (Kd) and base motor power (Tp), we experimented with the values until we had a solution where the robot both drove with a somewhat fast speed and where the movement was fluid on straight lines as well as during turns.
|
|
|
|
|
|

|
|
|
*Figure X: The video shows the robot fluidly driving around a circular track following a black line on white surface.*
|
|
|
|
|
|
As we didn't have any solution of how to set the values in our application for proportional (Kp), integral (Ki), differential (Kd) and base motor power (Tp), we experimented with the values until we had a solution where the robot both drove with a somewhat fast speed and where the movement was fluid on straight lines as well as during turns. See \[8\] for a video of the behaviour.
|
|
|
|
|
|
### Color Sensor ###
|
|
|
|
... | ... | @@ -329,6 +324,12 @@ While a simple program fitted with an advanced sensor can fulfil some goals, mor |
|
|
|
|
|
\[5\] : [A PID Controller For Lego Mindstorms Robots](http://www.inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html)
|
|
|
|
|
|
\[6\] : [Video 1](https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/videos/pid_init.mp4)
|
|
|
|
|
|
\[7\] : [Video 2](https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/videos/pid_p_only.mp4)
|
|
|
|
|
|
\[8\] : [Video 3](https://gitlab.au.dk/martinwp/LegoGroup2/raw/develop/lesson-04/videos/pid_smooth.mp4)
|
|
|
|
|
|
<!--
|
|
|
STYLE FOR REF:
|
|
|
\[number\] : [name](link)
|
... | ... | |