ActionServer

class mavsdk.action_server.ActionServer(async_plugin_manager)

Bases: AsyncBase

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

Generated by dcsdkgen - MAVSDK ActionServer API

async arm_disarm()

Subscribe to ARM/DISARM commands

Yields:

arm (ArmDisarm)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async flight_mode_change()

Subscribe to DO_SET_MODE

Yields:

flight_mode (FlightMode)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async get_allowable_flight_modes()

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

Returns:

flight_modes

Return type:

AllowableFlightModes

async land()

Subscribe to land command

Yields:

land (bool)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

name = 'ActionServer'
async reboot()

Subscribe to reboot command

Yields:

reboot (bool)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async set_allow_takeoff(allow_takeoff)

Can the vehicle takeoff

Parameters:

allow_takeoff (bool) – Is takeoff allowed?

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async set_allowable_flight_modes(flight_modes)

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

Parameters:

flight_modes (AllowableFlightModes)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async set_armable(armable, force_armable)

Can the vehicle arm when requested

Parameters:
  • armable (bool) – Is Armable now?

  • force_armable (bool) – Is armable with force?

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async set_armed_state(is_armed)

Set/override the armed/disarmed state of the vehicle directly, and notify subscribers

Parameters:

is_armed (bool) – Is armed now?

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async set_disarmable(disarmable, force_disarmable)

Can the vehicle disarm when requested

Parameters:
  • disarmable (bool) – Is disarmable now?

  • force_disarmable (bool) – Is disarmable with force? (Kill)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async set_flight_mode(flight_mode)

Set/override the flight mode of the vehicle directly, and notify subscribers

Parameters:

flight_mode (FlightMode) – Current vehicle flight mode, e.g. Takeoff/Mission/Land/etc.

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async shutdown()

Subscribe to shutdown command

Yields:

shutdown (bool)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async takeoff()

Subscribe to takeoff command

Yields:

takeoff (bool)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

async terminate()

Subscribe to terminate command

Yields:

terminate (bool)

Raises:

ActionServerError – If the request fails. The error contains the reason for the failure.

exception mavsdk.action_server.ActionServerError(result, origin, *params)

Bases: Exception

Raised when a ActionServerResult is a fail code

class mavsdk.action_server.ActionServerResult(result, result_str)

Bases: object

Result type.

Parameters:
  • result (Result) – Result enum value

  • result_str (std::string) – Human-readable English string describing the result

class Result(value)

Bases: Enum

Possible results returned for action requests.

Values

UNKNOWN

Unknown result

SUCCESS

Request was successful

NO_SYSTEM

No system is connected

CONNECTION_ERROR

Connection error

BUSY

Vehicle is busy

COMMAND_DENIED

Command refused by vehicle

COMMAND_DENIED_LANDED_STATE_UNKNOWN

Command refused because landed state is unknown

COMMAND_DENIED_NOT_LANDED

Command refused because vehicle not landed

TIMEOUT

Request timed out

VTOL_TRANSITION_SUPPORT_UNKNOWN

Hybrid/VTOL transition support is unknown

NO_VTOL_TRANSITION_SUPPORT

Vehicle does not support hybrid/VTOL transitions

PARAMETER_ERROR

Error getting or setting parameter

NEXT

Intermediate message showing progress or instructions on the next steps

BUSY = 4
COMMAND_DENIED = 5
COMMAND_DENIED_LANDED_STATE_UNKNOWN = 6
COMMAND_DENIED_NOT_LANDED = 7
CONNECTION_ERROR = 3
NEXT = 12
NO_SYSTEM = 2
NO_VTOL_TRANSITION_SUPPORT = 10
PARAMETER_ERROR = 11
SUCCESS = 1
TIMEOUT = 8
UNKNOWN = 0
VTOL_TRANSITION_SUPPORT_UNKNOWN = 9
class mavsdk.action_server.AllowableFlightModes(can_auto_mode, can_guided_mode, can_stabilize_mode)

Bases: object

State to check if the vehicle can transition to respective flightmodes

Parameters:
  • can_auto_mode (bool) – Auto/mission mode

  • can_guided_mode (bool) – Guided mode

  • can_stabilize_mode (bool) – Stabilize mode

class mavsdk.action_server.ArmDisarm(arm, force)

Bases: object

Arming message type

Parameters:
  • arm (bool) – Should vehicle arm

  • force (bool) – Should arm override pre-flight checks

class mavsdk.action_server.FlightMode(value)

Bases: Enum

Flight modes.

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

Values

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

RETURN_TO_LAUNCH

Returning to launch position (then landing)

LAND

Landing

OFFBOARD

In ‘offboard’ mode

FOLLOW_ME

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

ACRO = 12
ALTCTL = 10
FOLLOW_ME = 8
HOLD = 3
LAND = 6
MANUAL = 9
MISSION = 4
OFFBOARD = 7
POSCTL = 11
READY = 1
RETURN_TO_LAUNCH = 5
STABILIZED = 13
TAKEOFF = 2
UNKNOWN = 0