mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 17:28:54 +08:00
ekf2: check if vision_position pos/vel are valid before using them
This commit is contained in:
committed by
Lorenz Meier
parent
6609e4843b
commit
66c67f89e6
@@ -867,8 +867,11 @@ void Ekf2::run()
|
||||
ev_data.posErr = fmaxf(_ev_pos_noise.get(), fmaxf(ev_pos.eph, ev_pos.epv));
|
||||
ev_data.angErr = _ev_ang_noise.get();
|
||||
|
||||
// use timestamp from external computer, clocks are synchronized when using MAVROS
|
||||
_ekf.setExtVisionData(vision_position_updated ? ev_pos.timestamp : ev_att.timestamp, &ev_data);
|
||||
// only set data if all positions and velocities are valid
|
||||
if (ev_pos.xy_valid && ev_pos.z_valid && ev_pos.v_xy_valid && ev_pos.v_z_valid) {
|
||||
// use timestamp from external computer, clocks are synchronized when using MAVROS
|
||||
_ekf.setExtVisionData(vision_position_updated ? ev_pos.timestamp : ev_att.timestamp, &ev_data);
|
||||
}
|
||||
}
|
||||
|
||||
orb_check(vehicle_land_detected_sub, &vehicle_land_detected_updated);
|
||||
|
||||
Reference in New Issue
Block a user