Skip to content

Commit

Permalink
AP_InertialNav: add get_origin function
Browse files Browse the repository at this point in the history
  • Loading branch information
jschall committed Feb 3, 2015
1 parent dd465c5 commit 4d5dfcf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions libraries/AP_InertialNav/AP_InertialNav.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ class AP_InertialNav
*/
virtual nav_filter_status get_filter_status() const;

/**
* get_origin - returns the inertial navigation origin in lat/lon/alt
*
* @return origin Location
*/
virtual struct Location get_origin() const { return _ahrs.get_home(); }

//
// XY Axis specific methods
//
Expand Down
9 changes: 9 additions & 0 deletions libraries/AP_InertialNav/AP_InertialNav_NavEKF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ nav_filter_status AP_InertialNav_NavEKF::get_filter_status() const
return AP_InertialNav::get_filter_status();
}

struct Location AP_InertialNav_NavEKF::get_origin() const {
if (_ahrs.have_inertial_nav()) {
struct Location ret;
_ahrs_ekf.get_NavEKF().getOriginLLH(ret);
return ret;
}
return AP_InertialNav::get_origin();
}

/**
* get_position - returns the current position relative to the home location in cm.
*
Expand Down
7 changes: 7 additions & 0 deletions libraries/AP_InertialNav/AP_InertialNav_NavEKF.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ class AP_InertialNav_NavEKF : public AP_InertialNav
*/
nav_filter_status get_filter_status() const;

/**
* get_origin - returns the inertial navigation origin in lat/lon/alt
*
* @return origin Location
*/
struct Location get_origin() const;

/**
* get_position - returns the current position relative to the home location in cm.
*
Expand Down

0 comments on commit 4d5dfcf

Please sign in to comment.