FlightTask smoothVel - Initialize ekf reset counters when task is activated

This commit is contained in:
bresch
2019-07-16 13:09:09 +02:00
committed by Mathieu Bresciani
parent 1414f50cea
commit 24811cf550
6 changed files with 30 additions and 0 deletions
@@ -50,6 +50,7 @@ bool FlightTaskManualAltitudeSmoothVel::activate(vehicle_local_position_setpoint
_smoothing.reset(state_prev.acc_z, state_prev.vz, state_prev.z);
_initEkfResetCounters();
_resetPositionLock();
return ret;
@@ -61,6 +62,7 @@ void FlightTaskManualAltitudeSmoothVel::reActivate()
// using the generated jerk, reset the z derivatives to zero
_smoothing.reset(0.f, 0.f, _position(2));
_initEkfResetCounters();
_resetPositionLock();
}
@@ -71,6 +73,12 @@ void FlightTaskManualAltitudeSmoothVel::_resetPositionLock()
_position_setpoint_z_locked = NAN;
}
void FlightTaskManualAltitudeSmoothVel::_initEkfResetCounters()
{
_reset_counters.z = _sub_vehicle_local_position->get().z_reset_counter;
_reset_counters.vz = _sub_vehicle_local_position->get().vz_reset_counter;
}
void FlightTaskManualAltitudeSmoothVel::_checkEkfResetCounters()
{
if (_sub_vehicle_local_position->get().z_reset_counter != _reset_counters.z) {