... | ... | @@ -165,8 +165,8 @@ With the current setup the car is able to follow the black line on the first inc |
|
|
![Problem with correct plateau detection](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson8/Images/LowGyroProblem.jpg)
|
|
|
|
|
|
A gyroscope threshold determines whether the PlateauPilot behavior is activated. With the threshold too high the plateau is detected to late (Problem 1) and the LEGO car continues out of the track. With the threshold too low the plateau is detected too early and the LEGO car makes a right turn too soon (Problem 2). It seems to be an impossible task to determine this threshold in the current setting.
|
|
|
This indicates that the problem is related to the gyroscope which might not receive enough impact of the incline change when mounted close to the LEGO car in order determine a sufficient threshold.
|
|
|
In this setup the gyroscope is placed relatively low and close to the body of the LEGO car. Even though the gyroscope measures angular velocity and not translational velocity it should cause any influence by raising the gyroscope. However, a test is carried out in order to confirm this.
|
|
|
This indicates that the problem is related to the gyroscope which might not receive enough impact of the incline change when mounted close to the LEGO car in order to determine a sufficient threshold.
|
|
|
In this setup the gyroscope is placed relatively low and close to the body of the LEGO car. Due to the gyroscope is measuring angular velocity and not translational velocity it should not make any difference by raising the gyroscope. However, a test is carried out to confirm this.
|
|
|
|
|
|
## Raising the gyroscope
|
|
|
|
... | ... | @@ -206,7 +206,7 @@ else if (gyroVal < gyroOffset - 40 && !isAscending) |
|
|
}
|
|
|
```
|
|
|
|
|
|
The `gyroOffset` is set to `600` according to the noise floor of the gyroscope test. The plateau threshold is determined to `40` which seemed sufficient together with a timeout of 2000 milliseconds. The timeout ensures that there must be at least two seconds between each plateau. We thereby avoid having inexpedient state changes caused by two peaks in row.
|
|
|
The `gyroOffset` is set to `600` according to the noise floor of the gyroscope test. The plateau threshold is determined to `40` which seemed sufficient together with a timeout of `2000` milliseconds. The timeout ensures that there must be at least two seconds between each plateau. We thereby avoid having inexpedient state changes caused by two peaks in row.
|
|
|
|
|
|
By implementing these modification to the software and tuning the PID parameters and the hard coded turns, the LEGO car is able to drive all the way to the top of the track. On the top plateau the LEGO car performs a 180 degree turn and initiates its way back. Here a new problem arises. Whenever the LEGO car gets off the top plateau it almost immediately makes a left turn as illustrated in the following figure.
|
|
|
|
... | ... | @@ -218,7 +218,7 @@ The differential pilot seemed to be too high an abstraction level and the direct |
|
|
|
|
|
## Final setup
|
|
|
|
|
|
It turned out that substituting the direct control of the motors with regulated control had a significantly impact on the performance. After additional tuning of the PID parameters and turn values to the new motor control class the LEGO car was able to travel all the way from the bottom to the top and back again. This is shown in Video 1 in the references section where the car completes the track in 30.3 seconds. By increasing the default speed we were able to push the completion time down to 27.9 seconds. This is shown in Video 2.
|
|
|
It turned out that substituting the direct control of the motors with regulated control had a significantly impact on the performance. After additional tuning of the PID parameters and turn values to the new motor control class the LEGO car was able to travel all the way from the bottom, to the top and back again. This is shown in Video 1 in the references section where the car completes the track in 30.3 seconds. By increasing the default speed we were able to push the completion time down to 27.9 seconds. This is shown in Video 2.
|
|
|
|
|
|
The final construction is shown in the following figure.
|
|
|
|
... | ... | |