YRL Maze lab made more script-y
Dependencies: PsiSwarmLab-ScriptingBased mbed
Fork of UKESF_Lab by
Revision 34:232559052b2f, committed 2018-09-18
- Comitter:
- YRL44
- Date:
- Tue Sep 18 09:38:42 2018 +0000
- Parent:
- 33:e9ac9613b51c
- Commit message:
- Fixed int/float issue in move functions that made the lab nearly impossible; ; Renamed a couple of calibration functions to make things more intuitive
Changed in this revision
main.h | Show annotated file Show diff for this revision Revisions of this file |
setMotorSpeeds.txt | Show annotated file Show diff for this revision Revisions of this file |
diff -r e9ac9613b51c -r 232559052b2f main.h --- a/main.h Fri Sep 14 17:33:20 2018 +0000 +++ b/main.h Tue Sep 18 09:38:42 2018 +0000 @@ -22,17 +22,17 @@ static float cm_in_5_seconds = 40; static float degrees_in_5_seconds = 300; -void inline set_distance_in_5_seconds(float dist) { cm_in_5_seconds = dist; } -void inline set_degrees_in_5_seconds(float degrees) { degrees_in_5_seconds = degrees; } +void inline cms_travelled_in_5_seconds(float dist) { cm_in_5_seconds = dist; } +void inline degrees_turned_in_5_seconds(float degrees) { degrees_in_5_seconds = degrees; } -inline void forward_timed(int seconds) +inline void forward_timed(float seconds) { set_motor_speed(forward_speeds[0], forward_speeds[1]); wait(seconds); brake(); } -inline void forward_cm(int distance_in_cm) +inline void forward_cm(float distance_in_cm) { float cm_in_1_second = cm_in_5_seconds/5; float seconds_for_1_cm = 1/cm_in_1_second;
diff -r e9ac9613b51c -r 232559052b2f setMotorSpeeds.txt --- a/setMotorSpeeds.txt Fri Sep 14 17:33:20 2018 +0000 +++ b/setMotorSpeeds.txt Tue Sep 18 09:38:42 2018 +0000 @@ -2,5 +2,5 @@ set_left_turn_speeds(-0.8, 0.8); set_right_turn_speeds(0.8, -0.8); -set_distance_in_5_seconds(40); -set_degrees_in_5_seconds(300); \ No newline at end of file +cms_travelled_in_5_seconds(40); +degrees_turned_in_5_seconds(300); \ No newline at end of file