Defines | |
#define | FWD 0 |
Move forwards. | |
#define | BCK 1 |
Move backwards. | |
#define | SLOW_SPD 96 |
A slow speed. | |
#define | HALF_SPD 128 |
Half of the full speed. | |
#define | NRML_SPD 160 |
A normal speed. | |
#define | FAST_SPD 192 |
A fast speed. | |
#define | FULL_SPD 255 |
The maximum speed. | |
#define | SLOW_TURN 64 |
A slow turning speed. | |
#define | NRML_TURN 96 |
A medium turning speed. | |
#define | FAST_TURN 128 |
A high turning speed. | |
Functions | |
void | move (int velocity, int omega) |
Move the robot at the specified velocity. | |
void | move_avoid (int velocity, int omega, int strength) |
Move the robot while avoiding obstacles. |
void move | ( | int | velocity, | |
int | omega | |||
) |
Move the robot at the specified velocity.
Causes the robot to move with the given translation and rotational velocities. motors_init must be called before this function can be used.
velocity | the translational velocity of the robot, in the range -255 to 255. A positive value indicates forward motion, while a negative value indicates backwards motion. | |
omega | the rotational velocity of the robot, in the range -255 to 255. A positive value indicates a counterclockwise velocity, while a negative value indicates a clockwise velocity. |
void move_avoid | ( | int | velocity, | |
int | omega, | |||
int | strength | |||
) |
Move the robot while avoiding obstacles.
Moves the robot with the given translational and angular velocities while avoiding obstacles. To be effective, this function must be called repeatedly throughout the motion. It relies on the IR rangefinders to detect obstacles. Before calling this function, motors_init and range_init must be called.
velocity | the translational velocity of the robot, in the range -255 to 255. A positive value indicates forward motion. | |
omega | the rotational velocity of the robot, in the range -255 to 255. A positive value indicates a counterclockwise velocity. | |
strength | the strength of the avoid behavior, in the range 0 to 100. |