Browse Source

AP_AHRS: give zero lat/lng and baro alt if no position yet in DCM

mission-4.1.18
Andrew Tridgell 11 years ago
parent
commit
eedd88c2ec
  1. 7
      libraries/AP_AHRS/AP_AHRS_DCM.cpp
  2. 2
      libraries/AP_AHRS/AP_AHRS_DCM.h

7
libraries/AP_AHRS/AP_AHRS_DCM.cpp

@ -861,17 +861,14 @@ float AP_AHRS_DCM::get_error_yaw(void) @@ -861,17 +861,14 @@ float AP_AHRS_DCM::get_error_yaw(void)
// dead-reckoning or GPS
bool AP_AHRS_DCM::get_position(struct Location &loc)
{
if (!_have_position) {
return false;
}
loc.lat = _last_lat;
loc.lng = _last_lng;
loc.alt = _baro.get_altitude() * 100 + _home.alt;
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());
}
return true;
return _have_position;
}
// return an airspeed estimate if available

2
libraries/AP_AHRS/AP_AHRS_DCM.h

@ -61,7 +61,7 @@ public: @@ -61,7 +61,7 @@ public:
void reset_attitude(const float &roll, const float &pitch, const float &yaw);
// dead-reckoning support
bool get_position(struct Location &loc);
virtual bool get_position(struct Location &loc);
// status reporting
float get_error_rp(void);

Loading…
Cancel
Save