![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
The final program for the #include AIR robot
Dependencies: Biquad HIDScope QEI angleandposition controlandadjust mbed
Fork of includeair by
Diff: main.cpp
- Revision:
- 21:6954cc25f2a7
- Parent:
- 20:c5fb2ff5d457
- Child:
- 22:b29ba919d93e
--- a/main.cpp Tue Oct 20 13:16:37 2015 +0000 +++ b/main.cpp Tue Oct 20 13:51:30 2015 +0000 @@ -42,8 +42,8 @@ //////////////////////////////////CONTROLLER const double control_frequency=25;// frequency at which the controller is called //controller constants -float Kp=0.5; -float Ki=0.01; +float Kp=1; +float Ki=0.1; float Kd=0.001; controlandadjust mycontroller; // make a controller @@ -94,9 +94,9 @@ //////////////////////////////// POSITION AND ANGLE SHIZZLE const float safetymarginfield=0.075; //adjustable, tweak for maximum but safe range const float mm_per_sec_emg=0.050;// move the pod 50 mm per sec if muscle is flexed -const float y_start=0.255;//starting y position of the pod +const float y_start=0.155;//starting y position of the pod const float y_punch=0.473;// position to where there is punched -const float timetoshoot=0.5;// time it can take to shoot +const float timetoshoot=0.25;// time it can take to shoot float desired_position=0; float desired_angle1=0; @@ -456,7 +456,9 @@ if (switchedmode==true) { pc.printf("Buttonmode, you can use the buttons to control the robot\n"); led1=led2=0; - ledred=ledblue=1; + ledred=ledblue=1; + encoder1.reset();// reset encoders so they are at 0 degrees + encoder2.reset(); switchedmode=false; } if (ledblink_go==true) { @@ -476,6 +478,7 @@ mycontroller.PI(error1,error2,Kp,Ki,Ts_control,error1_int,error2_int); control_go=false; } + valuechangebutton.fall(&valuechange);// used to change controller variables and the gain for the filter } }