Skip to content
Ahmed Samara edited this page Feb 12, 2014 · 2 revisions

I think this conversation comes up almost every meeting, so I think it's a good idea to have a post describing how mec_driver will be used, and what other interface functions I should be adding.

For now, we have only 3 functions: move, rotate, and compound_move. Each time you call these functions, it's a completely fresh start. It will start doing exactly what you called it to do.

mec_driver knows absolutely nothing about what it's current state is.

THE FUNCTIONS.

move(speed, angle)

Pass it a speed (between 0 and 100) and a translation angle (where 0 is the front of the bot and positive angles are counter-clockwise). The bot will move at the given speed and strafe at that angle, thus maintaining its orientation but changing position.

rotate(rotate_speed)

Pass it a rotation speed between -100 and 100. Positive rotate_speeds are counter-clockwise. This is staying in place.

compound_move(translate_speed, translate_angle, rotate_speed)

Pass it a translation speed, translation angle, and a rotate speed. The sum of translation_speed and rotate_speed must add up to be less than or equal to 100. It will rotate AND translate, which will cause it to move in an arc-like shape.

move_strafe(forward, strafe)

Pass it a Forward velocity, and a Sideways (left) velocity. It moves in the total vector.