AP_AHRS: give zero lat/lng and baro alt if no position yet in DCM
This commit is contained in:
parent
59a56c9b46
commit
eedd88c2ec
@ -861,17 +861,14 @@ float AP_AHRS_DCM::get_error_yaw(void)
|
|||||||
// dead-reckoning or GPS
|
// dead-reckoning or GPS
|
||||||
bool AP_AHRS_DCM::get_position(struct Location &loc)
|
bool AP_AHRS_DCM::get_position(struct Location &loc)
|
||||||
{
|
{
|
||||||
if (!_have_position) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
loc.lat = _last_lat;
|
loc.lat = _last_lat;
|
||||||
loc.lng = _last_lng;
|
loc.lng = _last_lng;
|
||||||
loc.alt = _baro.get_altitude() * 100 + _home.alt;
|
loc.alt = _baro.get_altitude() * 100 + _home.alt;
|
||||||
location_offset(loc, _position_offset_north, _position_offset_east);
|
location_offset(loc, _position_offset_north, _position_offset_east);
|
||||||
if (_flags.fly_forward) {
|
if (_flags.fly_forward && _have_position) {
|
||||||
location_update(loc, degrees(yaw), _gps->ground_speed_cm * 0.01 * _gps->get_lag());
|
location_update(loc, degrees(yaw), _gps->ground_speed_cm * 0.01 * _gps->get_lag());
|
||||||
}
|
}
|
||||||
return true;
|
return _have_position;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return an airspeed estimate if available
|
// return an airspeed estimate if available
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
void reset_attitude(const float &roll, const float &pitch, const float &yaw);
|
void reset_attitude(const float &roll, const float &pitch, const float &yaw);
|
||||||
|
|
||||||
// dead-reckoning support
|
// dead-reckoning support
|
||||||
bool get_position(struct Location &loc);
|
virtual bool get_position(struct Location &loc);
|
||||||
|
|
||||||
// status reporting
|
// status reporting
|
||||||
float get_error_rp(void);
|
float get_error_rp(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user