mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 20:23:35 +08:00
Shift variable definition inside calculateOutputStates
This commit is contained in:
committed by
Mathieu Bresciani
parent
f59343b343
commit
430497e2f7
+7
-8
@@ -418,15 +418,7 @@ void Ekf::calculateOutputStates()
|
|||||||
// calculate a corrrection to the delta angle
|
// calculate a corrrection to the delta angle
|
||||||
// that will cause the INS to track the EKF quaternions
|
// that will cause the INS to track the EKF quaternions
|
||||||
_delta_angle_corr = delta_ang_error * att_gain;
|
_delta_angle_corr = delta_ang_error * att_gain;
|
||||||
|
|
||||||
// calculate velocity and position tracking errors
|
|
||||||
const Vector3f vel_err(_state.vel - _output_sample_delayed.vel);
|
|
||||||
const Vector3f pos_err(_state.pos - _output_sample_delayed.pos);
|
|
||||||
|
|
||||||
// collect magnitude tracking error for diagnostics
|
|
||||||
_output_tracking_error(0) = delta_ang_error.norm();
|
_output_tracking_error(0) = delta_ang_error.norm();
|
||||||
_output_tracking_error(1) = vel_err.norm();
|
|
||||||
_output_tracking_error(2) = pos_err.norm();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Loop through the output filter state history and apply the corrections to the velocity and position states.
|
* Loop through the output filter state history and apply the corrections to the velocity and position states.
|
||||||
@@ -495,6 +487,13 @@ void Ekf::calculateOutputStates()
|
|||||||
* the fusion time horizon. This option provides the most accurate tracking of EKF states.
|
* the fusion time horizon. This option provides the most accurate tracking of EKF states.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// calculate velocity and position tracking errors
|
||||||
|
const Vector3f vel_err(_state.vel - _output_sample_delayed.vel);
|
||||||
|
const Vector3f pos_err(_state.pos - _output_sample_delayed.pos);
|
||||||
|
|
||||||
|
_output_tracking_error(1) = vel_err.norm();
|
||||||
|
_output_tracking_error(2) = pos_err.norm();
|
||||||
|
|
||||||
// calculate a velocity correction that will be applied to the output state history
|
// calculate a velocity correction that will be applied to the output state history
|
||||||
_vel_err_integ += vel_err;
|
_vel_err_integ += vel_err;
|
||||||
const Vector3f vel_correction = vel_err * vel_gain + _vel_err_integ * sq(vel_gain) * 0.1f;
|
const Vector3f vel_correction = vel_err * vel_gain + _vel_err_integ * sq(vel_gain) * 0.1f;
|
||||||
|
|||||||
Reference in New Issue
Block a user