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:
- 122:2e77adcf0c0d
- Parent:
- 119:43ac44c68ff0
- Child:
- 127:839ae718713b
diff -r 1d5b3e1f0d21 -r 2e77adcf0c0d servo.cpp
--- a/servo.cpp Thu Mar 31 09:00:53 2022 +0000
+++ b/servo.cpp Tue Apr 05 06:57:21 2022 +0000
@@ -69,15 +69,21 @@
Matrix vihat = eskf.getVihat();
float vihat_norm = vihat(1, 1) * vihat(1, 1) + vihat(2, 1) * vihat(2, 1) + vihat(3, 1) * vihat(3, 1);
- if (vihat_norm > 9.0f || rc[2] > -0.8f)
- {
- pitchPID.setGain(6.36f, 10.6f*0.5f,0.0);
- pitchratePID.setGain(0.9540f,0.0f,0.0f);
+ if (hilFlag == false){
+ if (vihat_norm > 9.0f || rc[2] > -0.8f)
+ {
+ pitchPID.setGain(6.36f, 10.6f*0.5f,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);
+
+ }
}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);