RP6 ROBOT SYSTEM - 4. Programming the RP6
In order to perform such sequential processes, we always have to set the block-
ing-parameter to true! You may even perform rudimentary reaction on obstacles with
the blocking-parameters set to true – by using event handlers. These event handlers
will be called anyway, no matter if the blocking parameter is set true! However this
method may fail in more complex situations.
In general, for avoiding obstacles, interpreting master controller commands and for
similar processes we recommend to use the non-blocking mode and set the blocking
parameter to false. As we mentioned earlier in this chapter, this mode allows the
move/rotate-functions to control the robot's movement independently of other pro-
gram flow.
You will find a few detailed examples to this topic on the CD / Website.
4.6.10. task_RP6System()
In the last few chapters we have learned, that it is essential to frequently call four
functions within the main loop for correct operation of ACS/IRCOMM, motion control,
bumpers and ADC evaluation in the background. Just to simplify this and to help
keeping a better overview of your program, the RP6Library provides the following
function:
void task_RP6System(void)
which will sequentially call the functions:
task_ADC();
task_ACS();
task_bumpers();
task_motionControl();
Most of the sample programs on the CD / Website will only use this function – we will
hardly need one of the other functions directly.
Once again a very important note (was decribed above already):
You will have to call the
task_motionControl
function frequently from
the main program's loop – otherwise the automatic control will not
work! Frequently calling from the main program simply implies to
call this function at each and every main loop cycle. Calling the func-
tion at intervals of 10 up to 50 milliseconds will be sufficient, but its
better to call the function at considerably shorter intervals. Calling
the function more frequently will not cause any problems, as a hard-
ware timer is controlling the timing. For the same reason, we may
call the function at changing interval periods, e.g. ranging from 1ms
up to 10ms. Calling the function very frequently will not cost to much
processing time, as the function will only be executed completely in
predefined minimum intervals.
This means you can NOT use blocking functions like mSleep
together with task_RP6System.
Except for delays shorter than
25ms.
Instead, use the Stopwatch functions!
- 103 -