[chbot] Behaviour based robotics vs state machines
manningc2 at actrix.gen.nz
Tue Dec 15 21:15:22 GMT 2009
I'm hope Richard won't mind me using his "crash" as a learning exercise...
Richard's state machine can picker operated very well until just at the end
where (I'm assuming here) the edge of the table was reached when the state
machine was not handling the condition so it drove off the edge of the table
while trying to pick up a can that was off the edge of the table.
While state machines are great, this does underline one of the problems with
trying to do many behaviours in one state machine: the state machine gets
quite complex and it is easy to forget a transition.
One great way to address this is to use what is termed behaviour-based
robotics (see: http://en.wikipedia.org/wiki/Behavior-based_robotics for a
launch off point). The approach taken here is to build modular blocks of
behaviour, then tier the behaviours in priorities.
Behaviors are tiered in a prioritised way so that a more important behaviour
would suppress a less important behaviour. ie. the "Don't fall off the table"
behaviour would be the most important and would override others. That way, if
you're halfway through picking up a can and you detect that you might fall
off, then picking up the can is aborted and the robot takes immediate action
to prevent falling off the edge.
Each behaviour has three logical functions:
* Trigger: The detecting function to say whether this behaviour should be
* Action: The action for this behavior.
* Exit: The action to cancel this behavior if suppressed by another behaviour.
Some real benefits of this are:
* The behaviors are modular meaning that they focus just on one thing, making
them each a lot simpler. The can-lifting behaviour does not have to worry
about falling off the edge.
* The behaviours can be tested independently.
* The behaviours are easier to reuse in different robots.
I have not thought about how you would try to do behaviour based programs in
NXT graphical programming, but it is probably no more complex than state
machine programming. Lejos has a set of libraries that provides behavior
For a very interesting read, I strongly recommend the book: "Robot
programming: A practical guide to behaviour-based robotics" by Joe Jones and
Daniel Roth. These guys consulted on the design of the Roomba and some of the
I suppose I should put my money where my mouth is and build a behavior based
can-picker for the next meeting...
More information about the Chchrobotics