AP_L1_Control: coverity scan - ignoring get_position() result

- if no GPS location is available, do not continue computing navigation values. Hold old nav/target bearings and allow GPS failsafe to switch modes
This commit is contained in:
Tom Pittenger 2016-07-05 13:18:37 -07:00
parent a74e86c234
commit 5f16d873b8

View File

@ -149,7 +149,11 @@ void AP_L1_Control::update_waypoint(const struct Location &prev_WP, const struct
float K_L1 = 4.0f * _L1_damping * _L1_damping;
// Get current position and velocity
_ahrs.get_position(_current_loc);
if (_ahrs.get_position(_current_loc) == false) {
// if no GPS loc available, maintain last nav/target_bearing
_data_is_stale = true;
return;
}
Vector2f _groundspeed_vector = _ahrs.groundspeed_vector();
@ -277,7 +281,11 @@ void AP_L1_Control::update_loiter(const struct Location &center_WP, float radius
float K_L1 = 4.0f * _L1_damping * _L1_damping;
//Get current position and velocity
_ahrs.get_position(_current_loc);
if (_ahrs.get_position(_current_loc) == false) {
// if no GPS loc available, maintain last nav/target_bearing
_data_is_stale = true;
return;
}
Vector2f _groundspeed_vector = _ahrs.groundspeed_vector();