mavsdk::ActionServer Class Reference

#include: action_server.h


Provide vehicle actions (as a server) such as arming, taking off, and landing.

Data Structures

struct AllowableFlightModes

struct ArmDisarm

Public Types

Type Description
enum FlightMode Flight modes.
enum Result Possible results returned for action requests.
std::function< void(Result)> ResultCallback Callback type for asynchronous ActionServer calls.
std::function< void(ActionServer::Result, ArmDisarm)> ArmDisarmCallback Callback type for subscribe_arm_disarm.
std::function< void(ActionServer::Result, FlightMode)> FlightModeChangeCallback Callback type for subscribe_flight_mode_change.
std::function< void(ActionServer::Result, bool)> TakeoffCallback Callback type for subscribe_takeoff.
std::function< void(ActionServer::Result, bool)> LandCallback Callback type for subscribe_land.
std::function< void(ActionServer::Result, bool)> RebootCallback Callback type for subscribe_reboot.
std::function< void(ActionServer::Result, bool)> ShutdownCallback Callback type for subscribe_shutdown.
std::function< void(ActionServer::Result, bool)> TerminateCallback Callback type for subscribe_terminate.

Public Member Functions

Type Name Description
  ActionServer (System & system) Constructor. Creates the plugin for a specific System.
  ActionServer (std::shared_ptr< System > system) Constructor. Creates the plugin for a specific System.
  ~ActionServer () Destructor (internal use only).
  ActionServer (const ActionServer & other) Copy constructor.
void subscribe_arm_disarm (ArmDisarmCallback callback) Subscribe to ARM/DISARM commands.
void subscribe_flight_mode_change (FlightModeChangeCallback callback) Subscribe to DO_SET_MODE.
void subscribe_takeoff (TakeoffCallback callback) Subscribe to takeoff command.
void subscribe_land (LandCallback callback) Subscribe to land command.
void subscribe_reboot (RebootCallback callback) Subscribe to reboot command.
void subscribe_shutdown (ShutdownCallback callback) Subscribe to shutdown command.
void subscribe_terminate (TerminateCallback callback) Subscribe to terminate command.
Result set_allow_takeoff (bool allow_takeoff)const Can the vehicle takeoff.
Result set_armable (bool armable, bool force_armable)const Can the vehicle arm when requested.
Result set_disarmable (bool disarmable, bool force_disarmable)const Can the vehicle disarm when requested.
Result set_allowable_flight_modes (AllowableFlightModes flight_modes)const Set which modes the vehicle can transition to (Manual always allowed)
ActionServer::AllowableFlightModes get_allowable_flight_modes () const Get which modes the vehicle can transition to (Manual always allowed)
const ActionServer & operator= (const ActionServer &)=delete Equality operator (object is not copyable).

Constructor & Destructor Documentation

ActionServer()

mavsdk::ActionServer::ActionServer(System &system)

Constructor. Creates the plugin for a specific System.

The plugin is typically created as shown below:

auto action_server = ActionServer(system);

Parameters

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

ActionServer()

mavsdk::ActionServer::ActionServer(std::shared_ptr< System > system)

Constructor. Creates the plugin for a specific System.

The plugin is typically created as shown below:

auto action_server = ActionServer(system);

Parameters

  • std::shared_ptr< System > system - The specific system associated with this plugin.

~ActionServer()

mavsdk::ActionServer::~ActionServer()

Destructor (internal use only).

ActionServer()

mavsdk::ActionServer::ActionServer(const ActionServer &other)

Copy constructor.

Parameters

Member Typdef Documentation

typedef ResultCallback

using mavsdk::ActionServer::ResultCallback =  std::function<void(Result)>

Callback type for asynchronous ActionServer calls.

typedef ArmDisarmCallback

using mavsdk::ActionServer::ArmDisarmCallback =  std::function<void(ActionServer::Result, ArmDisarm)>

Callback type for subscribe_arm_disarm.

typedef FlightModeChangeCallback

using mavsdk::ActionServer::FlightModeChangeCallback =  std::function<void(ActionServer::Result, FlightMode)>

Callback type for subscribe_flight_mode_change.

typedef TakeoffCallback

using mavsdk::ActionServer::TakeoffCallback =  std::function<void(ActionServer::Result, bool)>

Callback type for subscribe_takeoff.

typedef LandCallback

using mavsdk::ActionServer::LandCallback =  std::function<void(ActionServer::Result, bool)>

Callback type for subscribe_land.

typedef RebootCallback

using mavsdk::ActionServer::RebootCallback =  std::function<void(ActionServer::Result, bool)>

Callback type for subscribe_reboot.

typedef ShutdownCallback

using mavsdk::ActionServer::ShutdownCallback =  std::function<void(ActionServer::Result, bool)>

Callback type for subscribe_shutdown.

typedef TerminateCallback

using mavsdk::ActionServer::TerminateCallback =  std::function<void(ActionServer::Result, bool)>

Callback type for subscribe_terminate.

Member Enumeration Documentation

enum FlightMode

Flight modes.

For more information about flight modes, check out https://docs.px4.io/master/en/config/flight_mode.html.

Value Description
Unknown Mode not known.
Ready Armed and ready to take off.
Takeoff Taking off.
Hold Holding (hovering in place (or circling for fixed-wing vehicles).
Mission In mission.
ReturnToLaunch Returning to launch position (then landing).
Land Landing.
Offboard In 'offboard' mode.
FollowMe In 'follow-me' mode.
Manual In 'Manual' mode.
Altctl In 'Altitude Control' mode.
Posctl In 'Position Control' mode.
Acro In 'Acro' mode.
Stabilized In 'Stabilize' mode.

enum Result

Possible results returned for action requests.

Value Description
Unknown Unknown result.
Success Request was successful.
NoSystem No system is connected.
ConnectionError Connection error.
Busy Vehicle is busy.
CommandDenied Command refused by vehicle.
CommandDeniedLandedStateUnknown Command refused because landed state is unknown.
CommandDeniedNotLanded Command refused because vehicle not landed.
Timeout Request timed out.
VtolTransitionSupportUnknown Hybrid/VTOL transition support is unknown.
NoVtolTransitionSupport Vehicle does not support hybrid/VTOL transitions.
ParameterError Error getting or setting parameter.
Next Intermediate message showing progress or instructions on the next steps.

Member Function Documentation

subscribe_arm_disarm()

void mavsdk::ActionServer::subscribe_arm_disarm(ArmDisarmCallback callback)

Subscribe to ARM/DISARM commands.

Parameters

subscribe_flight_mode_change()

void mavsdk::ActionServer::subscribe_flight_mode_change(FlightModeChangeCallback callback)

Subscribe to DO_SET_MODE.

Parameters

subscribe_takeoff()

void mavsdk::ActionServer::subscribe_takeoff(TakeoffCallback callback)

Subscribe to takeoff command.

Parameters

subscribe_land()

void mavsdk::ActionServer::subscribe_land(LandCallback callback)

Subscribe to land command.

Parameters

subscribe_reboot()

void mavsdk::ActionServer::subscribe_reboot(RebootCallback callback)

Subscribe to reboot command.

Parameters

subscribe_shutdown()

void mavsdk::ActionServer::subscribe_shutdown(ShutdownCallback callback)

Subscribe to shutdown command.

Parameters

subscribe_terminate()

void mavsdk::ActionServer::subscribe_terminate(TerminateCallback callback)

Subscribe to terminate command.

Parameters

set_allow_takeoff()

Result mavsdk::ActionServer::set_allow_takeoff(bool allow_takeoff) const

Can the vehicle takeoff.

This function is blocking.

Parameters

  • bool allow_takeoff -

Returns

Result - Result of request.

set_armable()

Result mavsdk::ActionServer::set_armable(bool armable, bool force_armable) const

Can the vehicle arm when requested.

This function is blocking.

Parameters

  • bool armable -
  • bool force_armable -

Returns

Result - Result of request.

set_disarmable()

Result mavsdk::ActionServer::set_disarmable(bool disarmable, bool force_disarmable) const

Can the vehicle disarm when requested.

This function is blocking.

Parameters

  • bool disarmable -
  • bool force_disarmable -

Returns

Result - Result of request.

set_allowable_flight_modes()

Result mavsdk::ActionServer::set_allowable_flight_modes(AllowableFlightModes flight_modes) const

Set which modes the vehicle can transition to (Manual always allowed)

This function is blocking.

Parameters

Returns

Result - Result of request.

get_allowable_flight_modes()

ActionServer::AllowableFlightModes mavsdk::ActionServer::get_allowable_flight_modes() const

Get which modes the vehicle can transition to (Manual always allowed)

This function is blocking.

Returns

ActionServer::AllowableFlightModes - Result of request.

operator=()

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

Equality operator (object is not copyable).

Parameters

Returns

 const ActionServer & -

© Dronecode 2017-2020. License: CC BY 4.0            Updated: 2021-09-08 02:55:32

results matching ""

    No results matching ""