Control based on Autonomy Cycle


The programming of robot with the autonomy cycle uses two basic principles:
  1. Autonomy of the behavior (sensing-communication-planning-executing loop)
  2. State automaton for planning/executing the activities

Autonomy of the behavior means that robot is not controlled from outside, it is driven by its own rules. To provide this autonomy,
the robot has internal infinite loop that continuously performs:

  1. Sensing and update of local model;
  2. Asking all sensors to receive messages; when there are messages to send, it sends them;
  3. Making (collective) decision based on the local sensor data and received communication/remote control;
  4. Execute the plan. It includes starting multiple activities that are represented by a finite-state automaton.

Combination of autonomy cycle and state automaton allows multi-tasking work with high performance, where for each task (sensing, sensor data processing, message receiving, sending, decision making, etc.) the defined executing time can be specified. The main autonomy loop is implemented in the following way:

/**********beginning the autonomy cycle *******************/

/************ sensing part *******************************/
if ((statusMain & 0b00000100) == 0b00000100) ReadProximity();

/************ communication part *************************/
ReceiveMessages(); // in each cycle loor for communication

// it will send when more than 1 time in register
if ((statusComm1 & 0b00011111) != 0) SendMessages();

/************* planning part ****************************/

/************ executing part ***************************/
// run only if I'm moving and there is a collision
if ((statusMain & 0b00000110) == 0b00000110) CollisionAvoiding();

ExecutePlan(); // this execute the plan

/************end of the autonomy cycle *****************/
goto begin;

Please do not write anything into this cycle. Write the user defined source into the DecisionProcess() and ExecutePlan(). In the autonomy cycle we distinguish between decision process and executing a plan. Both processes mean a planning, however on completely different levels. Decision process takes input information from sensors, communication, remote control, internal state and takes a decision in favor of one of behavior patterns

Decision process is a high-complexity process, for instance a collective decision making, where negotiation among robots can last many cycles without executing any behavior pattern.

Executing a plan means executing a behavioral pattern. This pattern can be represented as a finite-state automaton, where the behavior is defined as a set of states with conditions allowing transitions between the states (more exactly the Petri-Network). Below we give a simple example of behavioral pattern "wall following".

This plan is defined in the source in the following way:

In this way to program the robot, it needs only to specify the functions DecisionProcess() and ExecutePlan() first in the form of state diagrams. The function DecisionProcess() analyzes the commands from the remote control contained in the variable remoteCommand, communication messages contained in the variables receivMessage1 and receivMessage2 and the current state of the plan contained in the variable statusPlan. The transition to a new state of the plan is done by setting the variable statusPlan to the corresponding number.

Each state of the plan in ExecutePlan():
  1. is enumerated by integer number and starts with if (statusPlan==N) {};
  2. contains condition allowing transition to other states by setting the variable statusPlan=N;
  3. is finished by the command return.

In this way during one autonomy cycle only one motion command is executed, it allowscollision avoiding and simultaneously executing of user-defined activities.