robot
Dependencies: Encoder HIDScope MODSERIAL TouchButton mbed-dsp mbed
Fork of Robot2false by
Diff: main.cpp
- Revision:
- 49:7ae21c58ba92
- Parent:
- 48:5b1b90260239
- Child:
- 50:43ead068c523
--- a/main.cpp Sun Nov 02 14:13:22 2014 +0000 +++ b/main.cpp Sun Nov 02 14:14:35 2014 +0000 @@ -27,7 +27,7 @@ void Calibratie_Triceps(); void Calibratie_Biceps(); float pid(float setspeed, float measurement, bool reset = false); -float pidpositie(float setposition, float measurement, bool reset = false); //------------------,bool reset = false toegevoegd +float pidpositie(float setposition, float measurement); void motor2aansturing(); void motor1aansturing(); void motor1aansturingdeel2(); @@ -474,17 +474,13 @@ return out_p + out_i + out_d; } -float pidpositie(float setposition, float measurement, bool reset ) //----------------------------bool reset toegevoegd +float pidpositie(float setposition, float measurement) { float error; static float prev_error = 0; float out_p = 0; static float out_i = 0; float out_d = 0; - if(reset==true) {//-------------------------------------------------------------------if reset stukje toegevoegd - out_i = 0; - prev_error = 0; - } error = setposition-measurement; out_p = error*K_Pp; out_i += error*K_Ip;