mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 11:06:04 +08:00
Trajectory auto - Handle EKF xy reset
This commit is contained in:
@@ -123,6 +123,14 @@ void FlightTaskAutoLineSmoothVel::_prepareSetpoints()
|
|||||||
// that one is used as a velocity limit.
|
// that one is used as a velocity limit.
|
||||||
// If the position setpoints are set to NAN, the values in the velocity setpoints are used as velocity targets: nothing to do here.
|
// If the position setpoints are set to NAN, the values in the velocity setpoints are used as velocity targets: nothing to do here.
|
||||||
|
|
||||||
|
// Check if a reset event has happened.
|
||||||
|
if (_sub_vehicle_local_position->get().xy_reset_counter != _reset_counter) {
|
||||||
|
// Reset the XY axes
|
||||||
|
_trajectory[0].setCurrentPosition(_position(0));
|
||||||
|
_trajectory[1].setCurrentPosition(_position(1));
|
||||||
|
_reset_counter = _sub_vehicle_local_position->get().xy_reset_counter;
|
||||||
|
}
|
||||||
|
|
||||||
if (PX4_ISFINITE(_position_setpoint(0)) &&
|
if (PX4_ISFINITE(_position_setpoint(0)) &&
|
||||||
PX4_ISFINITE(_position_setpoint(1))) {
|
PX4_ISFINITE(_position_setpoint(1))) {
|
||||||
// Use position setpoints to generate velocity setpoints
|
// Use position setpoints to generate velocity setpoints
|
||||||
|
|||||||
@@ -76,4 +76,5 @@ protected:
|
|||||||
void _generateTrajectory();
|
void _generateTrajectory();
|
||||||
VelocitySmoothing _trajectory[3]; ///< Trajectories in x, y and z directions
|
VelocitySmoothing _trajectory[3]; ///< Trajectories in x, y and z directions
|
||||||
float _yaw_sp_prev;
|
float _yaw_sp_prev;
|
||||||
|
uint8_t _reset_counter{0}; /**< counter for estimator resets in xy-direction */
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user