RP6 ROBOT SYSTEM - 4. Programming the RP6
voltage at intervals of 300ms. The program will issue a warning as soon as the battery
voltage drops below a level of
approximately
6V.
4.6.6. ACS – Anti Collision System
In contrast to the CCRP5, which used a small co-processor, the Anti Collision System
of the RP6 has been directly implemented on the MEGA32. This architecture needs
some more programming effort, but also allows custom modifications and adapta-
tions. The RP5 design did not allow any modifications of the co-processor's software at
all...
The ACS detection range, respectively transmitting power of both IR-LEDs may be
controlled by the following functions:
void setACSPwrOff(void)
--> Deactivate the ACS IR-LEDs
void setACSPwrLow(void)
--> Short range
void setACSPwrMed(void)
--> Medium range
void setACSPwrHigh(void)
--> Long range
As the ACS is nearly completely implemented in software, it is required to frequently
call the following function within the main loop:
void task_ACS(void)
This function completely controls the ACS. Further processing can be done in a similar
procedure as it has been demonstrated for the bumpers.
The RP6Lib provides two variables:
obstacle_left and obstacle_right
each of which will be set to true as soon as the ACS detects an obstacle. If both vari-
ables have been set to true, the obstacle will be found located directly in front of the
robot.
You may optionally use an Event Handler for the ACS.
void ACS_setStateChangedHandler(void (*acsHandler)(void))
This function registers the Event Handler, which must have the following signature:
void acsStateChanged(void)
However, you may name the function whatever you like.
The next sample program will demonstrate how to use this. We start by registering
the Event Handler (line 44), then activate all sensors including the IR Receiver (line 46
– of course it does not work without this!) and setup the transmitting power for the
ACS IR LEDs (line 47). The main loop frequently calls the function task_ACS().
Further evaluation will be performed automatically. The acsStateChanged function
gets called as soon as the ACS changes its state, which happens if an obstacle is de-
tected or if it disappears again. The program will display the current ACS state with
text messages in the terminal and with the LEDs.
- 93 -