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: Encoder HIDScope MODSERIAL QEI biquadFilter mbed
Diff: main.cpp
- Revision:
- 47:c61873a0b646
- Parent:
- 46:9279c7a725bf
- Child:
- 48:950b1f34161b
--- a/main.cpp Wed Oct 14 21:00:20 2015 +0000 +++ b/main.cpp Wed Oct 14 21:26:02 2015 +0000 @@ -37,6 +37,69 @@ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////| ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////| ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////| +// Groep 12: The Chenne Band // +// ___________________________ +// // \\ +// || [Table of content] || +// \\___________________________// +// +// Introduction + +// Libraries................................................. +// Flow and debugging tools ................................. +// LEDS................................................. +// Buttons.............................................. +// Potmeter............................................. +// Flow................................................. +// HIDscope............................................. +// EMG....................................................... +// EMG variables........................................ +// EMG filter........................................... +// motors..................................................... +// motor turn........................................... +// motor strike......................................... +// d-action filter...................................... +// system constants........................................... +// functions used............................................. +// motor function....................................... +// EMG functions........................................ +// action controller.................................... + +// Main + +// Start of code.............................................. +// calibrate.................................................. +// starting position motor.............................. +// EMG calibration...................................... +// Attach Ticker.............................................. +// Start infinite loop........................................ +// Debug buttons........................................ +// Wait for go signal................................... +// Limit position value and convert to degrees.......... +// Get current EMG values............................... +// Action controller.................................... +// Strike......................................... +// Turn left...................................... +// Turn right..................................... +// PID controller....................................... +// PID error -> pwm motor............................... +// pwm -> plant......................................... +// HIDscope............................................. +// Deactivate if reached position....................... + +// Functions described + +// Motor Functions............................................ +// EMG functions.............................................. +// Action controller functions................................ + +// +// +// +// +// + + //============================================================================================================================ // ___________________________ // // \\ @@ -420,11 +483,11 @@ looptimerflag = false; -// ___________________________ -// // \\ -// || [Calibrate position] || -// \\___________________________// -// // Keep motor position between -4200 and 4200 counts +// __________________________________________________ +// // \\ +// || [Limit position value and convert to degrees] || +// \\__________________________________________________// +// // Keep motor position between -4200 and 4200 counts if ((motor_turn.getPulses()>4200) || (motor_turn.getPulses()<-4200)) // If value is outside -4200 and 4200 (number of counts equal to one revolution) reset to zero { @@ -472,7 +535,7 @@ // pc.printf("moving_average_left = %f moving_average_right = %f \n\r", moving_average_left, moving_average_right); // // -// // SLAG // (No LED -> 0.55s -> red on (turns on every time a new pwm is given) -> finish) +// // STRIKE // (No LED -> 0.55s -> red on (turns on every time a new pwm is given) -> finish) // if (moving_average_left > Threshold_Bicep_Left_1 && moving_average_right > Threshold_Bicep_Right_1) // { // TICKER OFF @@ -510,7 +573,7 @@ // debug_led_blue=off; // debug_led_green=on; // want het kan zijn dat bovenste script half wordt uitgevoerd en dan moet het slag mechanisme wel weer terug // -// // DRAAI LINKS // // (blue->blue off (very short/visible?)-> red<->blue<-> red -> klaar) +// // TURN LEFT // // (blue->blue off (very short/visible?)-> red<->blue<-> red -> klaar) // if (moving_average_left > Threshold_Bicep_Left_2 && moving_average_right < Threshold_Bicep_Right_1) // { // debug_led_green=off; // Executing action @@ -545,7 +608,7 @@ // debug_led_green=on; // not executing an action // TICKER AAN // -// // DRAAI RECHTS // (blue->blue uit (heel kort/zichtbaar?)-> red<->blue<-> red -> klaar) +// // TURN RIGHT // (blue->blue uit (heel kort/zichtbaar?)-> red<->blue<-> red -> klaar) // if (moving_average_right > Threshold_Bicep_Right_2 && moving_average_left < Threshold_Bicep_Right_1) // { // TICKER UIT @@ -647,10 +710,10 @@ scope.set(2,pwm_to_motor_turn); // HIDSCOPE channel 2 : Pwm_to_motor_turn scope.send(); // Send channel info to HIDSCOPE -// ___________________________ -// // \\ -// || [Deactivate?] || -// \\___________________________// +// __________________________________ +// // \\ +// || [Deactivate if reached position] || +// \\__________________________________// // // Check whether the motor has reached reference position and can be shut down if(fabs(error_turn)<2) // Shut down if error is smaller than two degrees @@ -897,4 +960,9 @@ n++; } -//============================================================================================================================ \ No newline at end of file +//============================================================================================================================ +// ___________________________ +// // \\ +// || [Action Controller] || +// \\___________________________// +// \ No newline at end of file