Trajectory manual - Handle EKF xy reset

This commit is contained in:
bresch
2018-12-13 15:30:11 +01:00
parent e1472818dc
commit a2d5485c7f
2 changed files with 11 additions and 0 deletions

View File

@@ -147,6 +147,16 @@ void FlightTaskManualPositionSmoothVel::_updateSetpoints()
VelocitySmoothing::timeSynchronization(_smoothing, 2); // Synchronize x and y only
if (_position_lock_xy_active) {
// Check if a reset event has happened.
if (_sub_vehicle_local_position->get().xy_reset_counter != _reset_counter) {
// Reset the XY axes
_smoothing[0].setCurrentPosition(_position(0));
_smoothing[1].setCurrentPosition(_position(1));
_reset_counter = _sub_vehicle_local_position->get().xy_reset_counter;
}
}
Vector3f pos_sp_smooth;
Vector3f accel_sp_smooth;

View File

@@ -70,4 +70,5 @@ private:
matrix::Vector3f _vel_sp_smooth;
bool _position_lock_xy_active{false};
matrix::Vector2f _position_setpoint_xy_locked;
uint8_t _reset_counter{0}; /**< counter for estimator resets in xy-direction */
};