Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Control/drivecontrol.h
- Revision:
- 0:cb667de3a336
- Child:
- 2:619b02232144
diff -r 000000000000 -r cb667de3a336 Control/drivecontrol.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Control/drivecontrol.h Sat May 06 19:34:26 2017 +0000 @@ -0,0 +1,40 @@ +#ifndef __DRIVE_CONTROL_H__ +#define __DRIVE_CONTROL_H__ +#include "motor.h" + +/** +* Control mouse movements. +* - PID Control based on sensor readings. +* - Output PWM signals to motors based on feedback loop. +* - Provides directional signals to the main control loop. +*/ +class DriveControl { + +public: + int y; + int x; + DriveControl (int start_x, int start_y); + ~DriveControl(); + + int get_next_direction(); + + int get_next_state(int state); + + // Stops both motors. Assume no coasting. + void stop(); + + void drive_one_forward(); + + void turn(); + + void turn_left(); + + void turn_right(); + + bool has_front_wall(); + + bool has_right_wall(); + + bool has_left_wall(); +}; +#endif \ No newline at end of file