The behaviours window lets you program the behaviour of the BristleBot when it drives autonomously.
The BristleBot is capable of doing four things: stopping, moving forward in a straight line, turning left, and 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.
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:
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 Activity 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.
WARNING: 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.
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