TomYumBoys / Mbed 2 deprecated MM2017

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers drivecontrol.h Source File

drivecontrol.h

00001 #ifndef __DRIVE_CONTROL_H__
00002 #define __DRIVE_CONTROL_H__
00003 
00004 /**
00005 * Control mouse movements.
00006 * - PID Control based on sensor readings.
00007 * - Output PWM signals to motors based on feedback loop.
00008 * - Provides directional signals to the main control loop.
00009 */
00010 class DriveControl {
00011 
00012 public:
00013     int y;
00014     int x;
00015     //float total_error;
00016     DriveControl (int start_x, int start_y);
00017     DriveControl () {};
00018     
00019     ~DriveControl();
00020     
00021     int get_next_direction();
00022     
00023     // Stops both motors. Assume no coasting.
00024     void stop();
00025     
00026     void print_serial_ports();
00027     
00028     void drive_forward();
00029     
00030     void turn();
00031     
00032     void turn_left();
00033     
00034     void turn_right();
00035     
00036     void turn_around();
00037     
00038     void drive(float speed);
00039     
00040     bool has_front_wall();
00041     
00042     bool has_right_wall();
00043     
00044     bool has_left_wall();
00045     
00046     void resetEncoders();
00047     
00048     void clear_pid();
00049     
00050     void set_wall_follower_speed();
00051     
00052     void set_wall_follower_sensor_thres();
00053     
00054     bool should_finish_turn_right();
00055     
00056     bool right_wall_pid_debug();
00057     
00058     bool should_finish_turn_left ();
00059     
00060     bool should_stop_drive_forward();
00061     
00062     bool should_finish_turn_around();
00063     
00064     bool should_finish_drive_forward();
00065 };
00066 #endif