... | ... | @@ -53,12 +53,17 @@ The solution is to change from the differential pilot to direct motor control us |
|
|
|
|
|
### Setup
|
|
|
|
|
|
With the plateau detection and line following behavior in place it is time combine these elements into a single program. For this we will use the behavior control paradigm from lesson 7 [4].
|
|
|
With the plateau detection and line following functionality in place it is time combine these elements into a single program. For this we will use the behavior control paradigm from lesson 7 [4].
|
|
|
The two behaviors are implemented as shown in the following diagram.
|
|
|
|
|
|
![Behavioral control](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson8/Images/BehavioralControl.jpg)
|
|
|
|
|
|
The Arbiter contains a list of the behaviors and constantly check, in a prioritized manor, if the behavior has available commands. This will ensure that the behavior with the highest priority will control the LEGO car, if it has any commands for it.
|
|
|
The Arbiter contains a list of the behaviors and constantly check, in a prioritized manor, if the behavior has available commands. This will ensure that the behavior with the highest priority will control the LEGO car, if it has any commands for it.
|
|
|
|
|
|
An overview of the track and where each behavior is activated is shown in the following figure.
|
|
|
|
|
|
![Overview of where on the track each behavior in the program is activated](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson8/Images/Plan.jpg)
|
|
|
|
|
|
The PlateauPilot has the highest priority and is implemented as a Finite State Machine (FSM) which is shown in the following diagram.
|
|
|
|
|
|
![Lego car with the gyro sensor placed higher](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson8/Images/StateDiagram.jpg)
|
... | ... | @@ -102,17 +107,18 @@ switch (nextAction) { |
|
|
```
|
|
|
The FSM is responsible for performing all turns on the track. By letting the FSM control the stopping mechanism we avoid having a third behavior that uses the light sensor or an additional color sensor to detect when the LEGO car is in the green end zone.
|
|
|
|
|
|
Each turn is hard coded by imposing a certain power to each motor in a fixed amount of time. The amount of power and the time interval is then adjust according to manual inspection.
|
|
|
Each turn is hard coded by imposing a certain power to each motor in a fixed amount of time. The amount of power and the time interval is then adjusted according to manual inspection.
|
|
|
|
|
|
The hardware setup is identical to previously.
|
|
|
|
|
|
### Results
|
|
|
|
|
|
With the current setup the car is able to follow the first line on the first inclined path. However problem arise when in the plateau detection which is illustrated in the following figure.
|
|
|
With the current setup the car is able to follow the black line on the first inclined path. However a problem arises in the plateau detection which is illustrated in the following figure.
|
|
|
|
|
|
![Problem with correct plateau detection](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson8/Images/LowGyroProblem.jpg)
|
|
|
|
|
|
Sometimes the plateau is detected to late (Problem 1) and the LEGO car continues out of the track. At other times the plateau is detected to early and the LEGO car makes a right turn too soon (Problem 2).
|
|
|
The behavioral control 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. A solution to this is place the gyroscope higher.
|
|
|
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. A solution to this is to place the gyroscope higher.
|
|
|
|
|
|
## Raising the gyroscope
|
|
|
|
... | ... | @@ -129,7 +135,7 @@ By raising the gyroscope and manually tuning the PID parameters and turns the LE |
|
|
![Problems on the way back](https://gitlab.au.dk/rene2014/lego/raw/master/Lesson8/Images/DirectMotorControlProblem.jpg)
|
|
|
|
|
|
|
|
|
## Switching between PID parameters
|
|
|
## Converting to regulated motor control
|
|
|
|
|
|
### Setup
|
|
|
|
... | ... | @@ -137,7 +143,6 @@ By raising the gyroscope and manually tuning the PID parameters and turns the LE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Conclusion
|
|
|
|
|
|
|
... | ... | |