Communications#

class payloadcomputerdroneprojekt.communications.Communications(address: str, config: Dict[str, Any] | None = None)[source]#

Bases: object

Handles communication with the drone, including connection, arming, movement, telemetry, and image transfer.

This class abstracts the MAVSDK API and provides high-level methods for controlling and monitoring the drone, as well as sending data to a ground station.

async await_arm(**kwargs)#
async await_disarm(**kwargs)#
async check_health() bool[source]#

Check if the drone’s global position is OK (GPS ready).

Returns:

True if global position is OK, False otherwise.

Return type:

bool

async connect() bool[source]#

Establish a connection to the drone and set telemetry data rates.

Returns:

True if connection is established, False otherwise.

Return type:

bool

This method initializes the MAVSDK System, connects to the specified address, and waits until the connection is confirmed. It also sets telemetry data rates.

async get_position_lat_lon_alt() List[float][source]#

Get the drone’s global position and attitude.

Returns:

[latitude_deg, longitude_deg, relative_altitude_m, roll, pitch, yaw]

Return type:

list[float]

If GPS is not ready, returns zeros.

async get_position_xyz() List[float][source]#

Get the drone’s local position and attitude.

Returns:

[x, y, z, roll, pitch, yaw] in meters and degrees.

Return type:

list[float]

If GPS is not ready, returns zeros.

async get_relative_height() float[source]#

Get the drone’s height above the ground.

Returns:

Relative altitude in meters.

Return type:

float

async is_flying() bool[source]#

Check if the drone is currently flying (in air).

Returns:

True if the drone is in air, False otherwise.

Return type:

bool

async land(**kwargs)#
async landed() bool[source]#

Check if the drone is currently flying (in air).

Returns:

True if the drone is in air, False otherwise.

Return type:

bool

async mov_by_vel(**kwargs)#
async mov_by_xy(**kwargs)#
async mov_by_xyz(**kwargs)#
async mov_by_xyz_old(**kwargs)#
async mov_to_lat_lon_alt(**kwargs)#
async mov_to_xyz(**kwargs)#
async mov_with_vel(**kwargs)#
async send_status(status: str) None[source]#

Send a status text message to the ground station.

Parameters:

status (str) – Status message to send.

This method uses the MAVSDK server utility to send a status text.

async set_data_rates() None[source]#

Set telemetry data rates for attitude, position, and in-air status.

This method configures the frequency at which telemetry data is received.

async start(**kwargs)#
async wait_for_health() None[source]#

Wait until both the home position and global position are OK.

This method blocks until the drone’s telemetry reports both positions as ready.