Plane: reset HIL attitude if off by more than 5 degrees
This commit is contained in:
parent
8bfe59cea5
commit
1e36ebc31b
@ -2065,6 +2065,13 @@ mission_failed:
|
|||||||
barometer.setHIL(packet.alt*0.001f);
|
barometer.setHIL(packet.alt*0.001f);
|
||||||
compass.setHIL(packet.roll, packet.pitch, packet.yaw);
|
compass.setHIL(packet.roll, packet.pitch, packet.yaw);
|
||||||
airspeed.disable();
|
airspeed.disable();
|
||||||
|
|
||||||
|
// cope with DCM getting badly off due to HIL lag
|
||||||
|
if (fabsf(packet.roll - ahrs.roll) > ToRad(5) ||
|
||||||
|
fabsf(packet.pitch - ahrs.pitch) > ToRad(5) ||
|
||||||
|
fabsf(packet.yaw - ahrs.yaw) > ToRad(5)) {
|
||||||
|
ahrs.reset_attitude(packet.roll, packet.pitch, packet.yaw);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif // HIL_MODE
|
#endif // HIL_MODE
|
||||||
|
Loading…
Reference in New Issue
Block a user