Behavior API
The home folder for behaviors is /home/pi/flockbot/behaviors and contains a folder for lua and C behaviors. C behaviors are dynamic libraries and must be made before use.
Setup
For C behaviors, the entry point is the following function:
void *start_behavior(void *args) { }
For Lua behaviors, the entry point is the following function:
function startBehavior()
end
These commands are native to both C and Lua behaviors and perform the same function.
claw_open() | Opens the Claw |
claw_close() | Closes the Claw |
claw_grip_can() | Closes the Claw on a Can |
claw_set(setting) | Takes values from 0-30 (0 is fully closed) |
robot_stop() | Stops the Robot |
move_robot(speed) | Positive speed is forward, negative for reverse |
move_distance(speed, distance) | Distance is in cm |
move_wheels(speed_left, speed_right) | Positive values are forward. |
rotate_robot(speed) | Rotates on center. |
turn_robot(speed, degrees) | Degrees are measured in degrees. |
turn_left() | 90 degree left turn |
turn_right() | 90 degree right turn |
get_motion_complete() | 1 if the last prolonged motion completed, 0 otherwise |
get_low_bump() | 1 for depressed, 0 for relaxed |
get_high_bump() | 1 for depressed, 0 for relaxed |
sleep(seconds) | Seconds are measured in 1000 millisecond blocks |