AP_Follow: use ahrs singleton

This commit is contained in:
Peter Barker 2018-03-31 23:27:58 +11:00 committed by Francisco Ferreira
parent ac99d37bc1
commit e33ce5eb48
2 changed files with 3 additions and 7 deletions

View File

@ -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;
}

View File

@ -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)