Plane: fixed reset of steering locked course

reset when we have not been steering for 1s, to ensure that an old
locked course is not used
This commit is contained in:
Andrew Tridgell 2021-12-03 18:27:16 +11:00 committed by Randy Mackay
parent f9496843de
commit 9ee5912e8b
3 changed files with 10 additions and 0 deletions

View File

@ -592,6 +592,13 @@ void Plane::calc_nav_yaw_ground(void)
return;
}
// if we haven't been steering for 1s then clear locked course
const uint32_t now_ms = AP_HAL::millis();
if (now_ms - steer_state.last_steer_ms > 1000) {
steer_state.locked_course = false;
}
steer_state.last_steer_ms = now_ms;
float steer_rate = (rudder_input()/4500.0f) * g.ground_steer_dps;
if (flight_stage == AP_Vehicle::FixedWing::FLIGHT_TAKEOFF ||
flight_stage == AP_Vehicle::FixedWing::FLIGHT_ABORT_LAND) {
@ -608,6 +615,7 @@ void Plane::calc_nav_yaw_ground(void)
steer_state.locked_course_err = 0;
}
}
if (!steer_state.locked_course) {
// use a rate controller at the pilot specified rate
steering_control.steering = steerController.get_steering_out_rate(steer_rate);

View File

@ -431,6 +431,7 @@ private:
// when ground steering is active, and for steering in auto-takeoff
bool locked_course;
float locked_course_err;
uint32_t last_steer_ms;
} steer_state;
// flight mode specific

View File

@ -23,6 +23,7 @@ bool Mode::enter()
// zero locked course
plane.steer_state.locked_course_err = 0;
plane.steer_state.locked_course = false;
// reset crash detection
plane.crash_state.is_crashed = false;