mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
ekf2: replace quatToInverseRotMat if only used once
This commit is contained in:
parent
fb3adc3faa
commit
5030b21d2e
@ -83,8 +83,7 @@ void Ekf::fuseDrag(const dragSample &drag_sample)
|
||||
// predicted specific forces
|
||||
// calculate relative wind velocity in earth frame and rotate into body frame
|
||||
const Vector3f rel_wind_earth(vn - vwn, ve - vwe, vd);
|
||||
const Dcmf earth_to_body = quatToInverseRotMat(_state.quat_nominal);
|
||||
const Vector3f rel_wind_body = earth_to_body * rel_wind_earth;
|
||||
const Vector3f rel_wind_body = _state.quat_nominal.rotateVectorInverse(rel_wind_earth);
|
||||
|
||||
// perform sequential fusion of XY specific forces
|
||||
for (uint8_t axis_index = 0; axis_index < 2; axis_index++) {
|
||||
|
||||
@ -80,9 +80,8 @@ void Ekf::controlMagFusion()
|
||||
|
||||
// compute magnetometer innovations (for estimator_aid_src_mag logging)
|
||||
// rotate magnetometer earth field state into body frame
|
||||
const Dcmf R_to_body = quatToInverseRotMat(_state.quat_nominal);
|
||||
const Vector3f mag_I_rot = R_to_body * _state.mag_I;
|
||||
const Vector3f mag_innov = mag_I_rot - mag_observation;
|
||||
const Vector3f mag_I_body = _state.quat_nominal.rotateVectorInverse(_state.mag_I);
|
||||
const Vector3f mag_innov = mag_I_body - mag_observation;
|
||||
|
||||
resetEstimatorAidStatus(_aid_src_mag);
|
||||
_aid_src_mag.timestamp_sample = mag_sample.time_us;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user