mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-14 00:17:34 +08:00
Refactor gps fusion commencing
This commit is contained in:
committed by
Mathieu Bresciani
parent
38cbd1a182
commit
74780aa512
+7
-15
@@ -572,25 +572,17 @@ void Ekf::controlGpsFusion()
|
||||
|
||||
// If the heading is valid start using gps aiding
|
||||
if (_control_status.flags.yaw_align) {
|
||||
// if we are not already aiding with optical flow, then we need to reset the position and velocity
|
||||
// otherwise we only need to reset the position
|
||||
_control_status.flags.gps = true;
|
||||
resetHorizontalPositionToGps();
|
||||
|
||||
// when adding with optical flow,
|
||||
// velocity reset is not necessary
|
||||
if (!_control_status.flags.opt_flow) {
|
||||
if (!resetHorizontalPosition() || !resetVelocity()) {
|
||||
_control_status.flags.gps = false;
|
||||
|
||||
}
|
||||
|
||||
} else if (!resetHorizontalPosition()) {
|
||||
_control_status.flags.gps = false;
|
||||
|
||||
resetVelocityToGps();
|
||||
}
|
||||
|
||||
if (_control_status.flags.gps) {
|
||||
ECL_INFO_TIMESTAMPED("starting GPS fusion");
|
||||
_time_last_gps = _time_last_imu;
|
||||
}
|
||||
ECL_INFO_TIMESTAMPED("starting GPS fusion");
|
||||
_control_status.flags.gps = true;
|
||||
_time_last_gps = _time_last_imu;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user