Skip to main content

__init__

Instantiates a Mavlink client to handle message passing and command sending to/from a mavlink drone. Additionally sets up video stream manager for handling RTSP streams from the drone.
str
IP address of the ground control station (default: ‘192.168.8.10’)
port number for mavlink connection (default: ‘14550’)
str
IP address of the vehicle (default: ‘192.168.8.1’)
str
communication protocol to use, one of (‘udp’|‘tcp’) (default: ‘udp’)
Optional[Dict[str, Dict[str, Any]]]
Dictionary of dictionaries containing the
bool
whether to enable arming the drone (default: False)
bool
whether to run in dry run mode which bypasses arming exceptions (default: False)
str
logging level to be displayed to the user, one of (‘DEBUG’|‘INFO’|‘WARNING’|‘ERROR’),
List[str]
list of expected message types to handle without warning (default: None)

get_msg

Thread-safe method to get a message from msg_dict.
str
name of the message type to be retrieved.
msg
returns message if found, else None

update_setpoint

Update the current setpoint of the drone as well as the currently active set of controls.
List[str]
controls

attempt_command

Attempt to perform a given command with name and id. Includes retry logic with delays.
str
arbitrary command name for logging/display
int
Mavlink ID of the command to be attempted
int
whether this is first transmission of command (0, default), or a confirmation (1-255)
int
maximum number of attempts to send the command (default=3)
float
delay in seconds between attempts (default=1.0)
bool
whether command was successfully completed

set_custom_msg_rates

Set custom message publishing rates for a given message ID.
int
mavlink message ID to set custom rate for
int
interval in microseconds to publish message

request_msg

Request a specific message from the drone.
int
mavlink message ID to request
bool
whether command was successful

reset_ned_origin

Saves current position as the arming waypoint and resets mavlink origin.
bool
whether mavlink origin reset was successful

check_props_spinning

Check if props are spinning by requesting and monitoring servo outputs. NOTE: this is the commanded PWM value, not the actual RPM.
float
minimum PWM threshold for prop spinning
bool
whether all props are spinning above threshold

arm

Arm the drone if enabled.
bool
whether drone was successfully armed

disarm

Disarm the drone.
bool
whether drone was successfully disarmed

set_offboard_control

Sets drone control mode to OFFBOARD. This enables us to send position, velocity, or acceleration setpoints to the drone. NOTE: Drone may reject offboard mode if certain conditions are not met (recent setpoint message received, armed, etc.)
bool
whether offboard control mode was successfully set

start

Start the drone by resetting NED origin, arming the drone, and setting offboard control mode.

terminate

Terminate the drone client and shut down all threads.

get_single_frame

Get a single frame from the named video stream.
str
name of the camera stream to capture frame from
np.ndarray
frame as numpy array if successful, else None