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: HIDScope Servo mbed QEI biquadFilter
Diff: THE.cpp
- Revision:
- 23:cc8b95d7eb57
- Parent:
- 22:be961d1830bb
- Child:
- 24:ebcb41126f21
--- a/THE.cpp Fri Nov 02 08:11:09 2018 +0000 +++ b/THE.cpp Fri Nov 02 08:34:45 2018 +0000 @@ -50,9 +50,6 @@ // Define here all variables needed throughout the whole code volatile double time_overall; volatile double time_in_state; -volatile double motor_velocity = 0; -volatile double EMG = 0; -volatile double errors = 0; volatile int counts1_prev = 0; volatile int counts2_prev = 0; volatile int counts1; @@ -181,7 +178,7 @@ volatile double Trans_error = 0.0; volatile double Trans_prev_error = 0.0; -// states +// States enum states {WAIT, MOTOR_CAL, EMG_CAL, START, OPERATING}; // states the robot can be in states CurrentState = WAIT; // the CurrentState to start with is the WAIT state bool StateChanged = true; // the state must be changed to go into the next state @@ -303,16 +300,6 @@ filtering(); MovAg(); } - -// WAIT -// To do nothing -void wait_mode() -{ - // go back to the initial values - // Copy here the variables list with initial values - // all pwm's to zero - // all counts to zero - } // MOTOR_CAL // To calibrate the motor angle to some mechanical boundaries @@ -425,6 +412,20 @@ pc.printf("Motor calibration done"); } +// WAIT +// To do nothing +void wait_mode() +{ + // Go back to the initial values + + // All pwm's to zero + translation_stop(); + rotation_stop(); + // All counts to zero + counts1 = 0; + counts2 = 0; + } + // EMG_CAL // To calibrate the EMG signal to some boundary values // Void to switch between signals to calibrate