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: mbed MatrixMath LPS25HB_I2C LSM9DS1 Matrix2 PIDcontroller LoopTicker SBUS_without_mainfile UsaPack solaESKF_wind Vector3 CalibrateMagneto FastPWM
Diff: servo.cpp
- Revision:
- 111:00f991005d2d
- Parent:
- 109:27ae949bc38e
- Child:
- 112:5a82800e1485
diff -r 3251582e03e4 -r 00f991005d2d servo.cpp
--- a/servo.cpp Wed Mar 09 13:05:55 2022 +0000
+++ b/servo.cpp Thu Mar 17 01:30:08 2022 +0000
@@ -55,11 +55,14 @@
float objgain = 15.0f*M_PI/180.0f;
float pitchobj = -objgain * (deobj+updateValues.de_command);
- //pc.printf("%f %f %f\r\n",pitchobj,deobj,updateValues.de_command);
- //ゲインの係数をrc8で変更
- //float gaincoef = 1.0f;
- pitchPID.setGain(6.36f, 10.6f*0.0f,0.0);
- pitchratePID.setGain(0.9540f,0.0f,0.0f);
+ if(rc[7] > 0.3f){
+ pitchPID.setGain(6.36f, 10.6f,0.0);
+ pitchratePID.setGain(0.9540f,0.0f,0.0f);
+ }else{
+ pitchPID.setGain(6.36f, 0.0f,0.0);
+ pitchPID.resetIntError();
+ pitchratePID.setGain(0.9540f,0.0f,0.0f);
+ }
yawratePID.setGain(2.0f,0.0f,0.0f);
pitchPID.setProcessValue(rpy.y);
pitchratePID.setProcessValue((gyro.y-gyroBias(2,1)));