pymavswarm.state package#

Submodules#

pymavswarm.state.acceleration module#

class pymavswarm.state.acceleration.Acceleration(optional_context_props: Optional[dict] = None)#

Bases: State

Acceleration state.

property context: dict#

Acceleration context.

Returns

context

Return type

dict

property global_frame: Vector#

Acceleration in the global frame (MAV_FRAME_GLOBAL).

Returns

global acceleration

Return type

Vector

property global_relative_frame: Vector#

Acceleration in the global relative frame (MAV_FRAME_GLOBAL_TERRAIN_ALT).

Returns

global relative acceleration

Return type

Vector

property local_frame: Vector#

Acceleration in the local frame (MAV_FRAME_LOCAL_NED).

Returns

local acceleration

Return type

Vector

pymavswarm.state.attitude module#

class pymavswarm.state.attitude.Attitude(pitch: float, yaw: float, roll: float, pitch_speed: float, yaw_speed: float, roll_speed: float, optional_context_props: Optional[dict] = None)#

Bases: State

Attitude of an agent.

property context: dict#

Attitude context.

Returns

context

Return type

dict

property pitch: float#

Pitch angle [-pi..+pi].

Returns

pitch

Return type

float

property pitch_speed: float#

Pitch angular speed [rad/s].

Returns

pitch speed

Return type

float

property roll: float#

Roll angle [-pi..+pi].

Returns

roll

Return type

float

property roll_speed: float#

Roll angular speed [rad/s].

Returns

roll speed

Return type

float

property yaw: float#

Yaw angle [-pi..+pi].

Returns

yaw

Return type

float

property yaw_speed: float#

Yaw angular speed [rad/s].

Returns

yaw speed

Return type

float

pymavswarm.state.battery module#

class pymavswarm.state.battery.Battery(voltage: float, current: float, level: float, optional_context_props: Optional[dict] = None)#

Bases: State

Agent battery state.

property context: dict#

Battery context.

Returns

context

Return type

dict

property current: float#

Battery current [cA].

-1: Current not sent by autopilot.

Returns

current

Return type

float

property level: float#

Battery energy remaining [%].

-1: Battery remaining energy not sent by autopilot.

Return type

float

property voltage: float#

Battery voltage [mV].

UINT16_MAX: Voltage not sent by autopilot.

Returns

voltage

Return type

float

pymavswarm.state.docker_info module#

class pymavswarm.state.docker_info.DockerInfo(version: str, last_update: datetime, optional_context_props: Optional[dict] = None)#

Bases: State

Information related to the agent’s deployed Docker image.

property context: dict#

Docker info context.

Returns

context

Return type

dict

property last_update: datetime#

Date that the image was last updated.

Returns

last update date

Return type

str

property version: str#

Docker image version deployed on an agent.

Returns

docker image version

Return type

str

pymavswarm.state.ekf_status module#

class pymavswarm.state.ekf_status.EKFStatus(velocity_variance: float, pos_horiz_variance: float, pos_vert_variance: float, compass_variance: float, terrain_alt_variance: float, pos_horiz_abs: float, const_pos_mode: float, pred_pos_horiz_abs: float, optional_context_props: Optional[dict] = None)#

Bases: State

Agent EKF status.

property compass_variance: float#

Compass variance.

Returns

variance

Return type

float

property const_pos_mode: float#

EKF Flags.

EKF is in constant position mode and does not know it’s absolute or relative position.

Returns

flags

Return type

float

property context: dict#

EKF status context.

Returns

context

Return type

dict

property pos_horiz_abs: float#

EKF Flags.

EKF’s Horizontal position (absolute) estimate is good.

Returns

flags

Return type

float

property pos_horiz_variance: float#

Horizontal position variance.

Returns

position variance

Return type

float

property pos_vert_variance: float#

Vertical position variance.

Returns

position variance

Return type

float

property pred_pos_horiz_abs: float#

EKF flags.

EKF’s predicted horizontal position (absolute) estimate is good.

Returns

flags

Return type

float

property terrain_alt_variance: float#

Terrain altitude variance.

Returns

variance

Return type

float

property velocity_variance: float#

Velocity variance.

Returns

variance

Return type

float

pymavswarm.state.generic module#

class pymavswarm.state.generic.Generic(name: str, value: Any, optional_context_props: Optional[dict] = None)#

Bases: State

Generic state object used to provide event capabilities to basic types.

property context: dict#

State context.

Returns

context

Return type

dict

property name: str#

Name associated with the state to provide when retrieving the context.

Returns

name

Return type

str

property value: Any#

Value of the state property.

Returns

state value

Return type

Any

pymavswarm.state.gps_info module#

class pymavswarm.state.gps_info.GPSInfo(eph: float, epv: float, fix_type: int, satellites_visible: int, optional_context_props: Optional[dict] = None)#

Bases: State

GPS information associated with an agent.

property context: dict#

GPS info context.

Returns

context

Return type

dict

property eph: float#

GPS HDOP horizontal dilution of position (unitless * 100).

Returns

dilution

Return type

float

property epv: float#

GPS VDOP vertical dilution of position (unitless * 100).

If unknown, set to: UINT16_MAX.

Returns

dilution

Return type

float

property fix_type: int#

GPS fix type.

(GPS_FIX_TYPE)

Returns

fix type

Return type

int

property satellites_visible: int#

Total number of satellites visible.

Returns

satellites visible

Return type

int

pymavswarm.state.parameter module#

class pymavswarm.state.parameter.Parameter(parameter_id: str, parameter_value: float | int, parameter_type: int, parameter_index: int, parameter_count: int)#

Bases: object

Parameter that has been read from an agent.

property parameter_count: int#

Parameter count.

Returns

parameter count

Return type

int

property parameter_id: str#

Parameter ID.

Returns

parameter ID

Return type

str

property parameter_index: int#

Index of the parameter.

Returns

parameter index

Return type

int

property parameter_type: int#

Type of value that the parameter may contain.

Should be 6: float or int.

Returns

parameter type

Return type

int

property parameter_value: float | int#

Parameter value.

Returns

parameter value

Return type

float | int

pymavswarm.state.parameter_list module#

class pymavswarm.state.parameter_list.ParameterList(max_length: int, optional_context_props: Optional[dict] = None)#

Bases: State

List of parameters read from an agent.

Implemented as a circular buffer.

append(item: Parameter) None#

Add a parameter to the buffer.

Parameters

item (Parameter) – parameter to add to the buffer

clear() None#

Clear all items from the parameter buffer.

property context: dict#

Parameter list context.

Returns

context

Return type

dict

extend(params: list[pymavswarm.state.parameter.Parameter]) None#

Extend the parameter buffer to include the iterable collection of parameters.

Parameters

params (list) – list of parameters to add to the parameter buffer

property max_length: int#

Maximum length of the circular buffer.

Returns

length

Return type

int

property parameters: list[pymavswarm.state.parameter.Parameter]#

List of stored parameters.

Returns

stored parameters

Return type

List[Parameter]

remove(item: Parameter) None#

Remove a parameter from the buffer.

Parameters

item (Parameter) – parameter to remove

pymavswarm.state.position module#

class pymavswarm.state.position.Position(optional_context_props: Optional[dict] = None)#

Bases: State

Agent position.

property context: dict#

Position context.

Returns

context

Return type

dict

property global_frame: Vector#

Position in the global frame (MAV_FRAME_GLOBAL).

Returns

global position

Return type

Vector

property global_relative_frame: Vector#

Position in the global relative frame (MAV_FRAME_GLOBAL_TERRAIN_ALT).

Returns

global relative position

Return type

Vector

property local_frame: Vector#

Position in the local frame (MAV_FRAME_LOCAL_NED).

Returns

local position

Return type

Vector

pymavswarm.state.state module#

class pymavswarm.state.state.State(optional_context_props: Optional[dict] = None)#

Bases: ABC

Base state class.

property context: dict#

State context.

Returns

context

Return type

dict

property state_changed_event: Event#

Event signaling state changes.

Returns

state change event

Return type

Event

pymavswarm.state.telemetry module#

class pymavswarm.state.telemetry.Telemetry(drop_rate: float, optional_context_props: Optional[dict] = None)#

Bases: State

Telemetry state information.

property context: dict#

Telemetry state context.

Returns

context

Return type

dict

property drop_rate: float#

Drop rate.

Communication drop rate, (UART, I2C, SPI, CAN), dropped packets on all links (packets that were corrupted on reception on the MAV)

Returns

drop rate

Return type

float

pymavswarm.state.vector module#

class pymavswarm.state.vector.Vector(x: float, y: float, z: float, frame: int, timestamp: float, optional_context_props: Optional[dict] = None)#

Bases: State

Vector in 3D space.

property context: dict#

Vector context.

Returns

context

Return type

dict

property frame: int#

Coordinate frame that the vector is in.

Returns

frame

Return type

int

property timestamp: float#

Timestamp that the vector was last updated.

Returns

timestamp

Return type

float

property x: float#

x component.

Returns

x component

Return type

float

property y: float#

y component.

Returns

y component

Return type

float

property z: float#

z component.

Valueitive for up.

Returns

z component

Return type

float

pymavswarm.state.velocity module#

class pymavswarm.state.velocity.Velocity(optional_context_props: Optional[dict] = None)#

Bases: State

Velocity state.

property context: dict#

Velocity context.

Returns

context

Return type

dict

property global_frame: Vector#

Velocity in the global frame (MAV_FRAME_GLOBAL).

Returns

global velocity

Return type

Vector

property global_relative_frame: Vector#

Velocity in the global relative frame (MAV_FRAME_GLOBAL_TERRAIN_ALT).

Returns

global relative velocity

Return type

Vector

property local_frame: Vector#

Velocity in the local frame (MAV_FRAME_LOCAL_NED).

Returns

local velocity

Return type

Vector

Module contents#