... | ... | @@ -32,10 +32,12 @@ NXTway must be perfectly balanced at button press: This is quite tricky, but mak |
|
|
These considerations resulted in us making the Sejway.java program, which is built around the Sejway.java file from [2]. We also implemented a data logger in DataLogger.java where we implemented a function for saving an array of values in a csv-file in order to watch how the three different errors in the PID controller changed over time and as a result of the measurements. We quickly realized, however, that logging 4 different variables in every iteration of the control loop was much too taxing on the robot and it slowed down the PID loop a lot. As the PID loop was slowed down it became unreliable and the robot fell over practically immediately. If we removed the data logger write calls, the robot did slightly better and actually attempted to balance.
|
|
|
We solved this problem by saving the first 1000 data points locally in an array and then we wrote them to a file in the shutdown method instead. This enabled us to log the data we needed to make the error plots shown in figure 2 while still not slowing the control loop down to a halt. A plot of the light sensor values is shown in figure 3 and a video of the attempt can be seen in [6].
|
|
|
|
|
|
![Sejway_error_plot](/uploads/61cbaad4b072e2198676975200610024/Sejway_error_plot.png)
|
|
|
![Sejway_error_plot](/uploads/61cbaad4b072e2198676975200610024/Sejway_error_plot.png)
|
|
|
|
|
|
*Fig. 2* Plot of the Sejway errors
|
|
|
|
|
|
![Sejway_light_value](/uploads/e1ced277cb96da59baa62612fd7b41ce/Sejway_light_value.png)
|
|
|
|
|
|
*Fig. 3* Plot of Sejway light sensor values
|
|
|
|
|
|
|
... | ... | @@ -43,25 +45,26 @@ During our testing with the light sensor, we experienced trouble with balancing |
|
|
|
|
|
We suspected the reason for the poor balancing skills to be the structure of the robot with a low center of gravity, so to counter the problems we created the “Segway with rider” model [4]. To make sure we have consistent data without other variables than the sensors, we remade the light-sensor experiment with the new robot.
|
|
|
|
|
|
Results from the “Segway with rider” with the light sensor are shown in the graphs below (figure 3 and 4):
|
|
|
Results from the “Segway with rider” with the light sensor are shown in the graphs below (figure 4 and 5):
|
|
|
|
|
|
![Sejway_new_robot_light_value](/uploads/14496c008d68c0230824e96ac1e1fdcb/Sejway_new_robot_light_value.png)
|
|
|
*Fig. 3* The light values measured on the “Segway with rider” robot
|
|
|
|
|
|
*Fig. 4* The light values measured on the “Segway with rider” robot
|
|
|
|
|
|
![Sejway_new_robot_error_plot](/uploads/353a4a880cbf71cf0d9b8789ae74709d/Sejway_new_robot_error_plot.png)
|
|
|
*Fig. 4*
|
|
|
|
|
|
*Fig. 5*
|
|
|
|
|
|
Even without changing the PID values, the new robot is already better at balancing from the beginning [5].
|
|
|
|
|
|
[SKRIV KONKLUSION HER]
|
|
|
Even without changing the PID values, the new robot is already better at balancing from the beginning [5].
|
|
|
|
|
|
### Self-balancing robots with color sensor
|
|
|
Switching to the color sensor, still using the “Segway with rider” model, we implemented changes to the program in order to use the color sensor.
|
|
|
The new robot design can be seen in figure 5.
|
|
|
The new robot design can be seen in figure 6.
|
|
|
|
|
|
![gyro-side-2](/uploads/161ae6f28d19847ef1235b0ac9048141/gyro-side-2.jpg)
|
|
|
*Fig. 5* A robot guy on a NXT segway
|
|
|
|
|
|
*Fig. 6* A robot guy on a NXT segway
|
|
|
|
|
|
We implemented the new SejwayColor.java program based on the Sejway.java program from earlier.
|
|
|
|
... | ... | @@ -80,11 +83,12 @@ Using the calculated values, we found the robot to be very stable when first bal |
|
|
|
|
|
### Self-balancing robots with gyro sensor
|
|
|
Using the GyroTest.java program [7], we found that the gyro value when stationary, also known as the offset, was around 600 ±5. We have mounted the sensor in such a way that tilting the robot backwards makes the gyro twist in a clockwise direction, and thereby raising the value of the sensor, while moving. Turning it the other way results in a lower reading.
|
|
|
The placement of the gyro can be seen in figure 6.
|
|
|
The placement of the gyro can be seen in figure 7.
|
|
|
|
|
|
|
|
|
![gyro-side](/uploads/a11572cc925f88b46a2ef4b5548c74b4/gyro-side.jpg)
|
|
|
*Fig. 6* The placement of the gyro
|
|
|
|
|
|
*Fig. 7* The placement of the gyro
|
|
|
|
|
|
|
|
|
In order to get a good measure to balance our robot against we used the angle calculated in the way outlined in [9]. Using the angle as the error value in the Proportional controller, we tried to balance the robot. However, we found that it was difficult to compensate for the gyro drift. By lowering the offset on each iteration, we tried to compensate for the drift. That didn’t help much since it resulted in that if the robot was tilted, the compensation quickly made the robot think it was in an upright position, stopping the motors and making it fall over.
|
... | ... | |