The
CSR-Rescue uses sequential programming technique. The compiler executes the
program statements sequentially in a “top-down” manner. Therefore, the order of
the statements in the program plays a very important role in deciding the
priority of statements with the same type.
In order to
synchronize the virtual robots and maintain real-time data updating, the
CSR-Rescue Simulator automatically scans all sensors’ readings in an interval
of 60 ms. In other words, all the variables associated with sensors will be
updated every 60 ms. Fig. 8-16 shows the program execution flow.
Fig. 8-16: Program execution flow
The
priority of each statement is set in statement
type.
The type of the statement has to be specified
when each new statement is added. There are three types of statements for
different requirements, namely default action, non-interrupt action and super
action as shown in Fig. 8-17.
Fig. 8-17: Statement types
Default action
v The default action statement has the lower
priority comparing to the Super action. A project can contain many default
action statements.
Non-interrupt action
v The non-interrupt statement has the same
priority as the default statement. When the non-interrupt statement is
executed, it will not be interrupted or terminated unless:
1.
The exit action condition is met.
2.
The super action statement is executed.
v When the non-interrupt action is specified,
it is necessary to define an exit condition for this action. That means the
non-interrupt statement will only be terminated when the specified exit
condition is true.
v A project can contain many non-interrupt
action statements.
Super action
v The super-action statement has the highest
priority. Once the condition for the statement is true, it will be executed
immediately. All other actions will be interrupted.
v A project can contain many super action
statements.
Related Topics