ROBOTC
Reference
Robot Decision Making
Using Boolean Algrebra, we can take a situtation where the robot would need to take more than
one condition into account, combine them with logical operators, and make a decision based on
the results of the conditions (See also Boolean Logic). The resulting values from the conditions are
called truth values. This essentially means that the conditions break down to whether or not the
condition is true or false.
Branching
Going along with the idea that robots are able to break down conditions into truth values, we can
have robots perform a certain task depending on if the conditions are true, or false. This idea of
performing a task depending on the outcome of the condition is called branching.
Example:
Take, for instance, a robot that has an Ultrasonic sensor attached to it. If we want the robot to
move around in a room and avoid obstacles, we would tell it this:
While the Ultrasonic sensor doesn’t detect something close
Move forward
task main()
{
while(condition)
{
if(condition)
{
// commands
}
else
{
// commands
}
}
}
Robot Decision Making