-
Notifications
You must be signed in to change notification settings - Fork 0
Autonomous Driving
The behaviours window lets you program the behaviour of the BristleBot when it drives autonomously. The program is implemented by defining what the BristleBot should do next, known as an Activity given what it is currently doing, known as the State, and the current input, known as the Event. To fully define the operation it is necessary to do this for all possible States and Events. This type of program is known as a Finite State Machine, as there is a finite set of things that it can be doing. Fortunate really as defining the next Activity if there were an infinite number of states would be impossible.
Another way of thinking about this kind of behaviour is as follows:
When in this State, if this Event happens, then do this Activity next.
For example when you are asleep, if your alarm goes off, then push snooze and go back to sleep
Note in this implementation the Activity and the next state are identical.
##BristleBot States The BristleBot is capable of doing four things:
- stopping
- moving forward in a straight line
- turning left
- turning right
These are known as behaviours. The BristleBot can only carry out one of these behaviours at any given time and this is known as the Current activity or state. The current activity describes what the BristleBot is currently doing and must be one of the four behaviours labelled: STOPPED, FORWARD, TURN LEFT, and TURN RIGHT.
##BristleBot Events To drive autonomously the BristleBot needs to sense the environment and respond to its sensors or other external events. The events could come from either the user e.g. a command to start driving, or from its proximity sensors e.g. the left sensor limit is set. The BristleBot is able to respond to the following events:
- Command: A command sent by the user or sent internally e.g. sending the Run command from the App.
- TimeOut: Each behaviour is assigned a duration. When this time period expires the Timeout event will trigger
- Left Limit: The left proximity sensor has sensed an obstacle
- Right Limit: The right proximity sensor has sensed an obstacle
- Both Limits: Both the left and the right proximity sensors have sensed an obstacle
- No Limits: The proximity sensor does not sense any obstacles in front of it
##BristleBot Activities When one of these events occurs the BristleBot needs to know which of its four behaviours to do next. The dropdown boxes associated with each of the current activities lets you choose what to do when a particular event occurs. For example if the BristleBot is in the FORWARD State and the Left Limit Event occurs then to avoid the object that has caused the Left Limit event the best course of action would be to turn right. So you would choose the TURN RIGHT Activity from the dropdown box.
##Behaviours App The behaviours page on the BristleBot App allows you to define the next Activity and State for each current state and event. Note: the next activity and the next state are the same for the BristleBot. The App is divided into sections one for each of the four possible states. The image below shows the STOPPED and FORWARD state sections.
In the configuration shown in this image the only event that causes the BristleBot to leave the STOPPED state is the command Event which will cause the BristleBot to move FORWARD.
Each activity has a TimeOut variable associated with it. This is used to set the maximum duration for each activity. For example, you may only want the TURN LEFT activity to last for 1s before continuing straight. To achieve this operation you would set the TURN LEFT TimeOut to 1s and the Next Activity associated with the TimeOut Event to FORWARD
WARNINGS: Ensure that you specify a new activity for each event for all four current activities, otherwise you might get some unexpected activity. Autonomous drive works best when the BristleBot is first optimised for straight line travel. If this is not already done go to the Actuators window to optimise this.
You can find more help on this operation here
© Benn Thomsen 2016
###Home
###Getting Started
###BristleBot Hardware
###Programming Exercises
Blink
Vibromotors
Motor Speed
###Using the BristleBot App
Web Control
Proximity Sensing
Autonomous Driving
###Advanced Installation
###Glossary