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
Control/drivecontrol.h@31:f7a8a9b82bc1, 2017-05-28 (annotated)
- Committer:
- kolanery
- Date:
- Sun May 28 09:54:40 2017 +0000
- Revision:
- 31:f7a8a9b82bc1
- Parent:
- 30:daf286ac049f
Update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
kolanery | 0:cb667de3a336 | 1 | #ifndef __DRIVE_CONTROL_H__ |
kolanery | 0:cb667de3a336 | 2 | #define __DRIVE_CONTROL_H__ |
kolanery | 0:cb667de3a336 | 3 | |
kolanery | 0:cb667de3a336 | 4 | /** |
kolanery | 0:cb667de3a336 | 5 | * Control mouse movements. |
kolanery | 0:cb667de3a336 | 6 | * - PID Control based on sensor readings. |
kolanery | 0:cb667de3a336 | 7 | * - Output PWM signals to motors based on feedback loop. |
kolanery | 0:cb667de3a336 | 8 | * - Provides directional signals to the main control loop. |
kolanery | 0:cb667de3a336 | 9 | */ |
kolanery | 0:cb667de3a336 | 10 | class DriveControl { |
kolanery | 0:cb667de3a336 | 11 | |
kolanery | 0:cb667de3a336 | 12 | public: |
kolanery | 0:cb667de3a336 | 13 | int y; |
kolanery | 0:cb667de3a336 | 14 | int x; |
szh66 | 6:1bcfda49e146 | 15 | //float total_error; |
kolanery | 0:cb667de3a336 | 16 | DriveControl (int start_x, int start_y); |
ryan_whr | 25:7155cb993870 | 17 | DriveControl () {}; |
ryan_whr | 25:7155cb993870 | 18 | |
kolanery | 0:cb667de3a336 | 19 | ~DriveControl(); |
kolanery | 0:cb667de3a336 | 20 | |
kolanery | 0:cb667de3a336 | 21 | int get_next_direction(); |
kolanery | 0:cb667de3a336 | 22 | |
kolanery | 0:cb667de3a336 | 23 | // Stops both motors. Assume no coasting. |
kolanery | 0:cb667de3a336 | 24 | void stop(); |
kolanery | 0:cb667de3a336 | 25 | |
kolanery | 15:151e59899221 | 26 | void print_serial_ports(); |
szh66 | 8:4a32fc9ee939 | 27 | |
kolanery | 7:7215adbae3da | 28 | void drive_forward(); |
kolanery | 0:cb667de3a336 | 29 | |
kolanery | 0:cb667de3a336 | 30 | void turn(); |
kolanery | 0:cb667de3a336 | 31 | |
kolanery | 0:cb667de3a336 | 32 | void turn_left(); |
kolanery | 0:cb667de3a336 | 33 | |
kolanery | 0:cb667de3a336 | 34 | void turn_right(); |
kolanery | 0:cb667de3a336 | 35 | |
kolanery | 7:7215adbae3da | 36 | void turn_around(); |
kolanery | 7:7215adbae3da | 37 | |
kolanery | 4:73510c7fa316 | 38 | void drive(float speed); |
kolanery | 4:73510c7fa316 | 39 | |
kolanery | 0:cb667de3a336 | 40 | bool has_front_wall(); |
kolanery | 0:cb667de3a336 | 41 | |
kolanery | 0:cb667de3a336 | 42 | bool has_right_wall(); |
kolanery | 0:cb667de3a336 | 43 | |
kolanery | 0:cb667de3a336 | 44 | bool has_left_wall(); |
kolanery | 14:a646667ac9ea | 45 | |
kolanery | 14:a646667ac9ea | 46 | void resetEncoders(); |
kolanery | 14:a646667ac9ea | 47 | |
kolanery | 16:c26d8e007df5 | 48 | void clear_pid(); |
kolanery | 16:c26d8e007df5 | 49 | |
kolanery | 30:daf286ac049f | 50 | void set_wall_follower_speed(); |
kolanery | 30:daf286ac049f | 51 | |
kolanery | 31:f7a8a9b82bc1 | 52 | void set_wall_follower_sensor_thres(); |
kolanery | 31:f7a8a9b82bc1 | 53 | |
kolanery | 14:a646667ac9ea | 54 | bool should_finish_turn_right(); |
kolanery | 14:a646667ac9ea | 55 | |
kolanery | 28:600932142201 | 56 | bool right_wall_pid_debug(); |
kolanery | 28:600932142201 | 57 | |
kolanery | 14:a646667ac9ea | 58 | bool should_finish_turn_left (); |
kolanery | 14:a646667ac9ea | 59 | |
kolanery | 14:a646667ac9ea | 60 | bool should_stop_drive_forward(); |
kolanery | 16:c26d8e007df5 | 61 | |
kolanery | 16:c26d8e007df5 | 62 | bool should_finish_turn_around(); |
kolanery | 16:c26d8e007df5 | 63 | |
kolanery | 16:c26d8e007df5 | 64 | bool should_finish_drive_forward(); |
kolanery | 0:cb667de3a336 | 65 | }; |
kolanery | 0:cb667de3a336 | 66 | #endif |