mavsdk::FollowMe Class Reference
#include: follow_me.h
This class enables vehicle tracking of a specified target (typically a ground station carried by a user).
The API is used to supply both the position(s) for the target and the relative follow position of the vehicle. Applications must get target position information from the underlying platform (or some other source).
See Also:
- Follow Me Mode (PX4 User Guide)
Data Structures
struct Config
struct TargetLocation
Public Types
Type | Description |
---|---|
enum Result | Results of FollowMe operations. |
Public Member Functions
Type | Name | Description |
---|---|---|
FollowMe (System & system) | Constructor. Creates the plugin for a specific System. | |
~FollowMe () | Destructor (internal use only). | |
FollowMe (const FollowMe &)=delete | Copy constructor (object is not copyable). | |
const Config & | get_config () const | Gets current FollowMe configuration. |
Result | set_config (const Config & config) | Applies FollowMe configuration by sending it to system. |
bool | is_active () const | Checks whether FollowMe is active. |
void | set_target_location (const TargetLocation & location) | Sets location of the moving target. |
const TargetLocation & | get_last_location () const | Returns the last location of the target. |
FollowMe::Result | start () const | Starts FollowMe mode. |
FollowMe::Result | stop () const | Stops FollowMe mode. |
const FollowMe & | operator= (const FollowMe &)=delete | Equality operator (object is not copyable). |
Static Public Member Functions
Type | Name | Description |
---|---|---|
std::string | result_str (Result result) | Returns English string for FollowMe error codes. |
Constructor & Destructor Documentation
FollowMe()
mavsdk::FollowMe::FollowMe(System &system)
Constructor. Creates the plugin for a specific System.
The plugin is typically created as shown below:
auto follow_me = std::make_shared<FollowMe>(system);
Parameters
- System& system - The specific system associated with this plugin.
~FollowMe()
mavsdk::FollowMe::~FollowMe()
Destructor (internal use only).
FollowMe()
mavsdk::FollowMe::FollowMe(const FollowMe &)=delete
Copy constructor (object is not copyable).
Parameters
- const FollowMe& -
Member Enumeration Documentation
enum Result
Results of FollowMe operations.
Value | Description |
---|---|
SUCCESS |
Request succeeded. |
NO_SYSTEM |
No system connected. |
CONNECTION_ERROR |
Connection error. |
BUSY |
Vehicle busy. |
COMMAND_DENIED |
Command denied. |
TIMEOUT |
Request timeout. |
NOT_ACTIVE |
FollowMe is not activated. |
SET_CONFIG_FAILED |
Failed to set FollowMe configuration. |
UNKNOWN |
Unknown error. |
See Also:
Member Function Documentation
get_config()
const Config& mavsdk::FollowMe::get_config() const
Gets current FollowMe configuration.
Returns
const Config & - Current FollowMe configuration.
See Also:
set_config()
Result mavsdk::FollowMe::set_config(const Config &config)
Applies FollowMe configuration by sending it to system.
Parameters
Returns
Result - FollowMe::Result::SUCCESS if configuration is applied successfully, FollowMe::Result::SET_CONFIG_FAILED on failure. In case of failure, last configuration is preserved.
See Also:
is_active()
bool mavsdk::FollowMe::is_active() const
Checks whether FollowMe is active.
Returns
bool - true
if FollowMe is active, false
otherwise.
set_target_location()
void mavsdk::FollowMe::set_target_location(const TargetLocation &location)
Sets location of the moving target.
An app can obtain the location of the moving target from Location framework of the underlying platform.
The following links provide information about location services on different platforms:
Parameters
- const TargetLocation& location - Location of the moving target.
See Also:
get_last_location()
const TargetLocation& mavsdk::FollowMe::get_last_location() const
Returns the last location of the target.
Returns
const TargetLocation & - Last location of the target.
See Also:
start()
FollowMe::Result mavsdk::FollowMe::start() const
Starts FollowMe mode.
Returns
FollowMe::Result - FollowMe::Result::SUCCESS if succeeded, error otherwise.
stop()
FollowMe::Result mavsdk::FollowMe::stop() const
Stops FollowMe mode.
Returns
FollowMe::Result - FollowMe::Result::SUCCESS if succeeded, error otherwise. See FollowMe::Result for error codes.
operator=()
const FollowMe& mavsdk::FollowMe::operator=(const FollowMe &)=delete
Equality operator (object is not copyable).
Parameters
- const FollowMe& -
Returns
const FollowMe & -
result_str()
static std::string mavsdk::FollowMe::result_str(Result result)
Returns English string for FollowMe error codes.
Parameters
Returns
std::string - Returns std::string describing error code.