Browse Source

AP_AHRS: use const reference not pointers for locations

this makes life easier for the new AP_Mission library

Pair-Programmed-With: Brandon Jones <brnjones@gmail.com>
mission-4.1.18
Andrew Tridgell 12 years ago
parent
commit
0d36832b82
  1. 2
      libraries/AP_AHRS/AP_AHRS.cpp
  2. 8
      libraries/AP_AHRS/AP_AHRS.h
  3. 6
      libraries/AP_AHRS/AP_AHRS_DCM.cpp
  4. 2
      libraries/AP_AHRS/AP_AHRS_DCM.h

2
libraries/AP_AHRS/AP_AHRS.cpp

@ -203,7 +203,7 @@ Vector2f AP_AHRS::groundspeed_vector(void)
/* /*
get position projected by groundspeed and heading get position projected by groundspeed and heading
*/ */
bool AP_AHRS::get_projected_position(struct Location *loc) bool AP_AHRS::get_projected_position(struct Location &loc)
{ {
if (!get_position(loc)) { if (!get_position(loc)) {
return false; return false;

8
libraries/AP_AHRS/AP_AHRS.h

@ -128,18 +128,18 @@ public:
// dead-reckoning. Return true if a position is available, // dead-reckoning. Return true if a position is available,
// otherwise false. This only updates the lat and lng fields // otherwise false. This only updates the lat and lng fields
// of the Location // of the Location
virtual bool get_position(struct Location *loc) { virtual bool get_position(struct Location &loc) {
if (!_gps || _gps->status() <= GPS::NO_FIX) { if (!_gps || _gps->status() <= GPS::NO_FIX) {
return false; return false;
} }
loc->lat = _gps->latitude; loc.lat = _gps->latitude;
loc->lng = _gps->longitude; loc.lng = _gps->longitude;
return true; return true;
} }
// get our projected position, based on our GPS position plus // get our projected position, based on our GPS position plus
// heading and ground speed // heading and ground speed
bool get_projected_position(struct Location *loc); bool get_projected_position(struct Location &loc);
// return a wind estimation vector, in m/s // return a wind estimation vector, in m/s
virtual Vector3f wind_estimate(void) { virtual Vector3f wind_estimate(void) {

6
libraries/AP_AHRS/AP_AHRS_DCM.cpp

@ -765,13 +765,13 @@ float AP_AHRS_DCM::get_error_yaw(void)
// return our current position estimate using // return our current position estimate using
// 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) { if (!_have_position) {
return false; return false;
} }
loc->lat = _last_lat; loc.lat = _last_lat;
loc->lng = _last_lng; loc.lng = _last_lng;
location_offset(loc, _position_offset_north, _position_offset_east); location_offset(loc, _position_offset_north, _position_offset_east);
return true; return true;
} }

2
libraries/AP_AHRS/AP_AHRS_DCM.h

@ -45,7 +45,7 @@ public:
void reset(bool recover_eulers = false); void reset(bool recover_eulers = false);
// dead-reckoning support // dead-reckoning support
bool get_position(struct Location *loc); bool get_position(struct Location &loc);
// status reporting // status reporting
float get_error_rp(void); float get_error_rp(void);

Loading…
Cancel
Save