diff --git a/libraries/AP_Follow/AP_Follow.cpp b/libraries/AP_Follow/AP_Follow.cpp index e3600784ee..5cd35ab814 100644 --- a/libraries/AP_Follow/AP_Follow.cpp +++ b/libraries/AP_Follow/AP_Follow.cpp @@ -114,8 +114,7 @@ const AP_Param::GroupInfo AP_Follow::var_info[] = { constructor is not called until detect() returns true, so we already know that we should setup the proximity sensor */ -AP_Follow::AP_Follow(const AP_AHRS &ahrs) : - _ahrs(ahrs), +AP_Follow::AP_Follow() : _p_pos(AP_FOLLOW_POS_P_DEFAULT) { AP_Param::setup_object_defaults(this, var_info); @@ -158,7 +157,7 @@ bool AP_Follow::get_target_dist_and_vel_ned(Vector3f &dist_ned, Vector3f &dist_w { // get our location Location current_loc; - if (!_ahrs.get_position(current_loc)) { + if (!AP::ahrs().get_position(current_loc)) { return false; } diff --git a/libraries/AP_Follow/AP_Follow.h b/libraries/AP_Follow/AP_Follow.h index 81c28656d6..a2fb295229 100644 --- a/libraries/AP_Follow/AP_Follow.h +++ b/libraries/AP_Follow/AP_Follow.h @@ -36,7 +36,7 @@ public: }; // constructor - AP_Follow(const AP_AHRS &ahrs); + AP_Follow(); // set which target to follow void set_target_sysid(uint8_t sysid) { _sysid = sysid; } @@ -87,9 +87,6 @@ private: // get offsets in meters in NED frame bool get_offsets_ned(Vector3f &offsets) const; - // references - const AP_AHRS &_ahrs; - // parameters AP_Int8 _enabled; // 1 if this subsystem is enabled AP_Int16 _sysid; // target's mavlink system id (0 to use first sysid seen)