mavsdk::Param Class Reference

#include: param.h


The Param class provides raw access to get and set parameters.

Public Types

Type Description
enum Result Possible results returned for param requests.

Public Member Functions

Type Name Description
  Param (System & system) Constructor. Creates the plugin for a specific System.
  ~Param () Destructor (internal use only).
  Param (const Param &)=delete Copy Constructor (object is not copyable).
std::pair< Result, int32_t > get_param_int (const std::string & name) Get an int parameter.
Result set_param_int (const std::string & name, int32_t value) Set an int parameter.
std::pair< Result, float > get_param_float (const std::string & name) Get a float parameter.
Result set_param_float (const std::string & name, float value) Set a float parameter.
const Param & operator= (const Param &)=delete Equality operator (object is not copyable).

Static Public Member Functions

Type Name Description
std::string result_str (Result result) Returns a human-readable English string for Param::Result.

Constructor & Destructor Documentation

Param()

mavsdk::Param::Param(System &system)

Constructor. Creates the plugin for a specific System.

The plugin is typically created as shown below:

auto param = std::make_shared<Param>(system);

Parameters

  • System& system - The specific system associated with this plugin.

~Param()

mavsdk::Param::~Param()

Destructor (internal use only).

Param()

mavsdk::Param::Param(const Param &)=delete

Copy Constructor (object is not copyable).

Parameters

Member Enumeration Documentation

enum Result

Possible results returned for param requests.

Value Description
UNKNOWN Unknown error.
SUCCESS Request succeeded.
TIMEOUT Request timed out.
CONNECTION_ERROR Connection error.
WRONG_TYPE Error.
PARAM_NAME_TOO_LONG Parameter name too long (> 16).

Member Function Documentation

get_param_int()

std::pair<Result, int32_t> mavsdk::Param::get_param_int(const std::string &name)

Get an int parameter.

If the type is wrong, the result will be Result::WRONG_TYPE.

Parameters

  • const std::string& name -

Returns

 std::pair< Result, int32_t > - a pair of the result of the request and the param (if successful).

set_param_int()

Result mavsdk::Param::set_param_int(const std::string &name, int32_t value)

Set an int parameter.

If the type is wrong, the result will be Result::WRONG_TYPE.

Parameters

  • const std::string& name -
  • int32_t value -

Returns

Result - result of the request.

get_param_float()

std::pair<Result, float> mavsdk::Param::get_param_float(const std::string &name)

Get a float parameter.

If the type is wrong, the result will be Result::WRONG_TYPE.

Parameters

  • const std::string& name -

Returns

 std::pair< Result, float > - a pair of the result of the request and the param (if successful).

set_param_float()

Result mavsdk::Param::set_param_float(const std::string &name, float value)

Set a float parameter.

If the type is wrong, the result will be Result::WRONG_TYPE.

Parameters

  • const std::string& name -
  • float value -

Returns

Result - result of the request.

operator=()

const Param& mavsdk::Param::operator=(const Param &)=delete

Equality operator (object is not copyable).

Parameters

Returns

 const Param & -

result_str()

static std::string mavsdk::Param::result_str(Result result)

Returns a human-readable English string for Param::Result.

Parameters

  • Result result - The enum value for which a human readable string is required.

Returns

 std::string - Human readable string for the Param::Result.

© Dronecode 2017-2019. License: CC BY 4.0            Updated: 2019-11-05 22:27:07

results matching ""

    No results matching ""