RP6 ROBOT SYSTEM - 4. Programming the RP6
Example 6: The Robot is driving in a circle
Directory: <RP6Examples>\RP6BaseExamples\Example_05_Move_01\
File: RP6Base_Move_01.c
ATTENTION: The robot will move in this example program! Please remove the cable
between the PC and the robot after program upload and put the robot in a big
free area! You must provide a free area of at least 1m x 1m or even 2m x 2m.
Finally the robot is ready to start its engines! The example program lets the robot
dirve in circles by running both motors at different speeds. Please provide enough of
free space for the movements and allow the robot to move freely in this and all of the
following programs! Some of the programs require a free area of about 1 or 2 square
meters.
If the robot hits an obstacle during the circle movements, it will stop and two LEDs will
start blinking! The program now waits to be restarted.
Example 7: The Robot drives forwards and backwards – with a 180° rotation
Directory: <RP6Examples>\RP6BaseExamples\Example_05_Move_02\
File: RP6Base_Move_02.c
ATTENTION: The robot will move in this example program!
We already demonstrated time controlled movement with a small example in the pre-
vious RP6Library chapter. In contrast, this example will let the robot drive forwards for
a specific distance, perform a 180° turn, drive backwards for the same distance, do a
second 180° turn and start from the beginning again.
The example uses the blocking mode of the move and rotate functions, which will
automatically call the task_RP6System function. Therefore we do not have to call this
function frequently.
Example 8: The Robot moves in a square path
Directory: <RP6Examples>\RP6BaseExamples\Example_05_Move_03\
File: RP6Base_Move_03.c
ATTENTION: The robot will move in this example program!
Now the robot will try to move in a square path with 30cm edge length. It rotates
after each complete tour and moves on in the opposite direction.
This works fine with exactly calibrated encoders only, otherwise the 90° angles may
be inaccurate (e.g. 80° or 98°). Because of this, the example also demonstrates the
difficulties in accurately controlling a caterpillar vehicle with encoder feedback signals
only. In chapter 2 we have discussed these problems already. Depending on surface
conditions of the floor, the caterpillars will be slipping and sliding, which will reduce
the real distance compared to the measured values. Clever programming could enable
us to compensate these errors, but most likely it is not possible to achieve 100% ac-
curacy with the encoders only. Other external sensor systems have to be used for ex-
act positioning control (see appendix).
- 114 -