mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-20 14:55:21 +03:00
initiate roll smoothly and only once flying straight home
This commit is contained in:
parent
3498d7e8bf
commit
da02aff97e
1 changed files with 4 additions and 2 deletions
|
@ -797,7 +797,6 @@ void updateGPSRescueState(void)
|
||||||
// once , gradually increase target velocity and roll angle
|
// once , gradually increase target velocity and roll angle
|
||||||
rescueState.intent.targetVelocityCmS = gpsRescueConfig()->rescueGroundspeed * angleToHome;
|
rescueState.intent.targetVelocityCmS = gpsRescueConfig()->rescueGroundspeed * angleToHome;
|
||||||
rescueState.intent.pitchAngleLimitDeg = gpsRescueConfig()->angle * angleToHome;
|
rescueState.intent.pitchAngleLimitDeg = gpsRescueConfig()->angle * angleToHome;
|
||||||
rescueState.intent.rollAngleLimitDeg = gpsRescueConfig()->angle * angleToHome;
|
|
||||||
if (rescueState.sensor.absErrorAngle < 10.0f) {
|
if (rescueState.sensor.absErrorAngle < 10.0f) {
|
||||||
// enter fly home phase with full forward velocity target and full angle values
|
// enter fly home phase with full forward velocity target and full angle values
|
||||||
rescueState.phase = RESCUE_FLY_HOME;
|
rescueState.phase = RESCUE_FLY_HOME;
|
||||||
|
@ -805,13 +804,16 @@ void updateGPSRescueState(void)
|
||||||
rescueState.intent.yawAttenuator = 1.0f;
|
rescueState.intent.yawAttenuator = 1.0f;
|
||||||
rescueState.intent.targetVelocityCmS = gpsRescueConfig()->rescueGroundspeed;
|
rescueState.intent.targetVelocityCmS = gpsRescueConfig()->rescueGroundspeed;
|
||||||
rescueState.intent.pitchAngleLimitDeg = gpsRescueConfig()->angle;
|
rescueState.intent.pitchAngleLimitDeg = gpsRescueConfig()->angle;
|
||||||
rescueState.intent.rollAngleLimitDeg = gpsRescueConfig()->angle;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RESCUE_FLY_HOME:
|
case RESCUE_FLY_HOME:
|
||||||
// fly home with full control on all axes, pitching forward to gain speed
|
// fly home with full control on all axes, pitching forward to gain speed
|
||||||
|
// gradually open up the roll limits up as we get underway
|
||||||
|
if (rescueState.intent.rollAngleLimitDeg < gpsRescueConfig()->angle) {
|
||||||
|
rescueState.intent.rollAngleLimitDeg += 0.05f;
|
||||||
|
}
|
||||||
if (newGPSData) {
|
if (newGPSData) {
|
||||||
if (rescueState.sensor.distanceToHomeM <= rescueState.intent.descentDistanceM) {
|
if (rescueState.sensor.distanceToHomeM <= rescueState.intent.descentDistanceM) {
|
||||||
rescueState.phase = RESCUE_DESCENT;
|
rescueState.phase = RESCUE_DESCENT;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue