
presentatie versie met potmeters enabled
Dependencies: Encoder HIDScope mbed
Revision 11:44b1c5b3b378, committed 2015-11-02
- Comitter:
- Zeekat
- Date:
- Mon Nov 02 14:15:11 2015 +0000
- Parent:
- 10:93a76bd81eef
- Commit message:
- add tekst;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Nov 02 12:30:04 2015 +0000 +++ b/main.cpp Mon Nov 02 14:15:11 2015 +0000 @@ -26,7 +26,7 @@ Encoder motor1_enc(D12,D11), motor2_enc(D10,D9); // encoderinputpins // EXTRA INPUTS AND REQUIRED VARIABLES -//POTMETERS (used for debugging purposes, not reliable anymore) +//POTMETERS (used for debugging purposes, not reliable due to mechanical failure) AnalogIn potright(A4); // define the potmeter outputpins AnalogIn potleft(A5); @@ -63,7 +63,7 @@ // bool switch_xy = false; // bool for switching axes double sw1 = 0; // counter for switching axes double t_switch = 0.8; // seconds for switching - bool switch_xy = false; + bool switch_xy = false; // set the start value // physical constants const double L = 36; // lenght of arms @@ -149,7 +149,7 @@ // FILTER VARIABLES // storage variables - // differential action filter, same is used for PID controllers + // differential action filter. double m_f_v1 = 0, m_f_v2 = 0; // input filter to smooth angle reference signals double r1_f_v1 = 0, r1_f_v2 = 0, r2_f_v1 = 0, r2_f_v2 = 0; @@ -494,7 +494,7 @@ } // calibrate the emg-signal -// works bij taking a certain amount of samples taking the max then normalize to the desired value +// works bij taking a certain amount of samples taking the max value then normalize to the desired value // went to max-value type. must be tested.! void calibrate_amp() { @@ -516,7 +516,7 @@ //////////// DEFINE GO-FLAG FUNCTIONS /////////////////////////// //////////////////////////////////////////////////////////////// - +// go-flag functions void EMG_activate(){emg_go = true;} void angle_activate(){cart_go = true;} void motor1_activate(){motor1_go = true;} @@ -524,9 +524,10 @@ int main() { + // call go-flag tickers main_filter.attach(&EMG_activate, EMG_step); cartesian.attach(&angle_activate, controlstep); - controller1.attach(&motor1_activate, controlstep); // call a go-flag + controller1.attach(&motor1_activate, controlstep); controller2.attach(&motor2_activate, controlstep); while(true) {