mirror of https://github.com/ArduPilot/ardupilot
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:
parent
308f4e99b4
commit
e342ce0da4
|
@ -650,6 +650,13 @@ void Plane::calc_nav_yaw_ground(void)
|
||||||
return;
|
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;
|
float steer_rate = (rudder_input()/4500.0f) * g.ground_steer_dps;
|
||||||
if (flight_stage == AP_Vehicle::FixedWing::FLIGHT_TAKEOFF ||
|
if (flight_stage == AP_Vehicle::FixedWing::FLIGHT_TAKEOFF ||
|
||||||
flight_stage == AP_Vehicle::FixedWing::FLIGHT_ABORT_LAND) {
|
flight_stage == AP_Vehicle::FixedWing::FLIGHT_ABORT_LAND) {
|
||||||
|
@ -666,6 +673,7 @@ void Plane::calc_nav_yaw_ground(void)
|
||||||
steer_state.locked_course_err = 0;
|
steer_state.locked_course_err = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!steer_state.locked_course) {
|
if (!steer_state.locked_course) {
|
||||||
// use a rate controller at the pilot specified rate
|
// use a rate controller at the pilot specified rate
|
||||||
steering_control.steering = steerController.get_steering_out_rate(steer_rate);
|
steering_control.steering = steerController.get_steering_out_rate(steer_rate);
|
||||||
|
|
|
@ -432,6 +432,7 @@ private:
|
||||||
// when ground steering is active, and for steering in auto-takeoff
|
// when ground steering is active, and for steering in auto-takeoff
|
||||||
bool locked_course;
|
bool locked_course;
|
||||||
float locked_course_err;
|
float locked_course_err;
|
||||||
|
uint32_t last_steer_ms;
|
||||||
} steer_state;
|
} steer_state;
|
||||||
|
|
||||||
// flight mode specific
|
// flight mode specific
|
||||||
|
|
|
@ -30,6 +30,7 @@ bool Mode::enter()
|
||||||
|
|
||||||
// zero locked course
|
// zero locked course
|
||||||
plane.steer_state.locked_course_err = 0;
|
plane.steer_state.locked_course_err = 0;
|
||||||
|
plane.steer_state.locked_course = false;
|
||||||
|
|
||||||
// reset crash detection
|
// reset crash detection
|
||||||
plane.crash_state.is_crashed = false;
|
plane.crash_state.is_crashed = false;
|
||||||
|
|
Loading…
Reference in New Issue