Data structures
- class multiwii.data.box.MspBox(items: tuple[MspBoxItem])[source]
Bases:
object
Represents data values for the MSP_BOX command.
This class is used to store the state values of various control boxes in a MultiWii flight controller. Control boxes can be used to enable or disable specific functions or modes during flight.
- as_serializable() tuple[int] [source]
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
- items: tuple[MspBoxItem]
A tuple with the box items.
- Type:
tuple[MspBoxItem]
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspBox class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspBox class populated with the parsed data.
- Return type:
- class multiwii.data.box.MspBoxIds(values: tuple[MultiWiiBox])[source]
Bases:
object
Represents data values for the MSP_BOXIDS command.
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspBoxIds class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspBoxIds class populated with the parsed data.
- Return type:
- values: tuple[MultiWiiBox]
A tuple with MultiWiiBox values.
- Type:
tuple[MultiWiiBox]
- class multiwii.data.box.MspBoxItem(aux1: MultiWiiBoxState, aux2: MultiWiiBoxState, aux3: MultiWiiBoxState, aux4: MultiWiiBoxState)[source]
Bases:
object
Represents data values for the MSP_SET_BOX command.
This class encapsulates the configuration of auxiliary (aux) control boxes in a MultiWii flight controller. Each box can be assigned a specific function or mode, and its state can be set to the following values:
Empty (0b000) (Unselected)
Low (0b001) (LOW)
Mid (0b010) (MID)
High (0b100) (HIGH)
- aux1: MultiWiiBoxState
The state value for the first auxiliary function.
- Type:
MultiWiiStateBox
- aux2: MultiWiiBoxState
The state value for the second auxiliary function.
- Type:
MultiWiiStateBox
- aux3: MultiWiiBoxState
The state value for the third auxiliary function.
- Type:
MultiWiiStateBox
- aux4: MultiWiiBoxState
The state value for the fourth auxiliary function.
- Type:
MultiWiiStateBox
- compile() int [source]
Compiles all of the box state values into a single unsigned integer value.
- Returns:
The compiled integer value representing the combined state of all auxiliary control boxes.
- Return type:
int
- classmethod parse(value: int) Self [source]
Parses all auxiliary state values from the given parameter and instantiates an instance with the parsed state values.
- Parameters:
value (int) – A single integer value consisting of all of the auxiliary states.
- Returns:
An instance of the MspBoxItem class with parsed box item state values.
- Return type:
- class multiwii.data.box.MspBoxNames(names: tuple[str])[source]
Bases:
object
Represents data values for the MSP_BOXNAMES command.
This class is used to store the names of various boxes that can be checked in a MultiWii flight controller. Each box corresponds to a specific function or mode that can be activated in the flight controller’s configuration.
- names: tuple[str]
The name of the boxes as strings.
- Type:
tuple[str]
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspBoxNames class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspBoxNames class populated with the parsed data.
- Return type:
- class multiwii.data.info.MspAnalog(voltage: float, power_meter_sum: int, rssi: int, amperage: int)[source]
Bases:
object
Represents data values for the MSP_ANALOG command.
This class encapsulates the analog telemetry data from the MultiWii flight controller. It provides information about the system’s voltage, power meter, RSSI, and amperage.
- amperage: int
The current amperage drawn, measured in milliamps.
- Type:
int
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspAnalog class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspAnalog class populated with the parsed data.
- Return type:
- power_meter_sum: int
The accumulated power consumption, measured in arbitrary units.
- Type:
int
- rssi: int
The Received Signal Strength Indicator (RSSI), representing the signal strength.
- Type:
int
- voltage: float
The voltage of the system, measured in volts.
- Type:
float
- class multiwii.data.info.MspIdent(version: int, multitype: MultiWiiMultitype, capabilities: tuple[MultiWiiCapability], navigation_version: int)[source]
Bases:
object
Represents data values for the MSP_IDENT command.
This class encapsulates the identification data from the MultiWii flight controller. It provides information about the firmware version, multitype, capabilities, and navigation version.
- capabilities: tuple[MultiWiiCapability]
A tuple with available flight capabilities.
- Type:
tuple[MultiWiiCapability]
- multitype: MultiWiiMultitype
The vehicle configuration type.
- Type:
The navigation version of the firmware.
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspIdent class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspIdent class populated with the parsed data.
- Return type:
- version: int
The firmware version of the flight controller.
- Type:
int
- class multiwii.data.info.MspMisc(power_trigger: int, throttle_failsafe: int, throttle_idle: int, throttle_min: int, throttle_max: int, power_logger_arm: int, power_logger_lifetime: int, magnetometer_declination: float, battery_scale: int, battery_warning_1: float, battery_warning_2: float, battery_critical: float)[source]
Bases:
object
Represents data values for the MSP_MISC command.
This class encapsulates miscellaneous configuration and status data from the MultiWii flight controller. It includes information about power triggers, throttle settings, battery warnings, and other miscellaneous parameters.
- battery_critical: float
The critical battery level, measured in volts.
- Type:
float
- battery_scale: int
The battery scale value.
- Type:
int
- battery_warning_1: float
The first battery warning level, measured in volts.
- Type:
float
- battery_warning_2: float
The second battery warning level, measured in volts.
- Type:
float
- magnetometer_declination: float
The magnetic declination value, measured in degrees.
- Type:
float
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspMisc class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspMisc class populated with the parsed data.
- Return type:
- power_logger_arm: int
The power logger arm value.
- Type:
int
- power_logger_lifetime: int
The power logger lifetime value.
- Type:
int
- power_trigger: int
The power trigger value.
- Type:
int
- throttle_failsafe: int
The throttle failsafe value.
- Type:
int
- throttle_idle: int
The idle throttle value.
- Type:
int
- throttle_max: int
The maximum throttle value.
- Type:
int
- throttle_min: int
The minimum throttle value.
- Type:
int
- class multiwii.data.info.MspSetMisc(power_trigger: int, throttle_min: int, throttle_max: int, min_command: int, throttle_failsafe: int, power_logger_arm: int, power_logger_lifetime: int, magnetometer_declination: float, battery_scale: int, battery_warning_1: float, battery_warning_2: float, battery_critical: float)[source]
Bases:
object
Represents data values for the MSP_SET_MISC command.
This class encapsulates miscellaneous configuration data to be set on the MultiWii flight controller. It includes information about power triggers, throttle settings, battery warnings, and other miscellaneous parameters.
- as_serializable() tuple[int] [source]
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
- battery_critical: float
The critical battery level, measured in volts.
- Type:
float
- battery_scale: int
The battery scale value.
- Type:
int
- battery_warning_1: float
The first battery warning level, measured in volts.
- Type:
float
- battery_warning_2: float
The second battery warning level, measured in volts.
- Type:
float
- magnetometer_declination: float
The magnetic declination value, measured in degrees.
- Type:
float
- min_command: int
The minimum command value.
- Type:
int
- power_logger_arm: int
The power logger arm value.
- Type:
int
- power_logger_lifetime: int
The power logger lifetime value.
- Type:
int
- power_trigger: int
The power trigger value.
- Type:
int
- throttle_failsafe: int
The throttle value for failsafe.
- Type:
int
- throttle_max: int
The maximum throttle value.
- Type:
int
- throttle_min: int
The minimum throttle value.
- Type:
int
- class multiwii.data.info.MspStatus(cycle_time: int, i2c_errors: int, sensors: tuple[MultiWiiSensor], status_flag: int, global_config: int)[source]
Bases:
object
Represents data values for the MSP_STATUS command.
This class encapsulates the status data from the MultiWii flight controller. It provides information about cycle time, I2C errors, sensors, flags, and global configuration.
- cycle_time: int
The cycle time in microseconds.
- Type:
int
- global_config: int
The global configuration value.
- Type:
int
- i2c_errors: int
The count of I2C errors.
- Type:
int
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspStatus class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspStatus class populated with the parsed data.
- Return type:
- sensors: tuple[MultiWiiSensor]
A tuple representing the sensors’ status.
- Type:
tuple[MultiWiiSensor]
- status_flag: int
The status flag.
- Type:
int
- class multiwii.data.motor.MspMotor(motor1: int, motor2: int, motor3: int, motor4: int, motor5: int, motor6: int, motor7: int, motor8: int)[source]
Bases:
object
Represents data values for the MSP_MOTOR command.
This class encapsulates the motor speed values for up to eight motors in a MultiWii flight controller. Each motor’s speed is represented as an integer value.
- as_serializable() tuple[int] [source]
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
- motor1: int
The speed value for motor 1.
- Type:
int
- motor2: int
The speed value for motor 2.
- Type:
int
- motor3: int
The speed value for motor 3.
- Type:
int
- motor4: int
The speed value for motor 4.
- Type:
int
- motor5: int
The speed value for motor 5.
- Type:
int
- motor6: int
The speed value for motor 6.
- Type:
int
- motor7: int
The speed value for motor 7.
- Type:
int
- motor8: int
The speed value for motor 8.
- Type:
int
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspMotor class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspMotor class populated with the parsed data.
- Return type:
- class multiwii.data.motor.MspMotorPins(motor1: int, motor2: int, motor3: int, motor4: int, motor5: int, motor6: int, motor7: int, motor8: int)[source]
Bases:
MspMotor
Represents data values for the MSP_MOTOR_PINS command.
This class extends MspMotor to provide the motor pin values for up to eight motors in a MultiWii flight controller. Each motor’s pin value is represented as an integer value.
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspMotorPins class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspMotorPins class populated with the parsed data.
- Return type:
Bases:
object
Represents data values for the MSP_RAW_GPS command.
This class encapsulates the GPS compass data from the MultiWii flight controller. It provides information about the GPS fix status, number of satellites in view, coordinates (latitude and longitude), altitude, speed, and ground course.
The altitude in meters.
- Type:
int
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
The GPS coordinates (latitude and longitude).
- Type:
Coordinates[float]
The GPS fix status.
- Type:
int
The ground course in degrees.
- Type:
float
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspRawGps class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspRawGps class populated with the parsed data.
- Return type:
The number of satellites in view.
- Type:
int
The speed in cm/s.
- Type:
int
Bases:
object
Represents data values for the MSP_WP command.
This class encapsulates the waypoint data from the MultiWii flight controller. It provides information about the waypoint number, coordinates, altitude hold, heading, time to stay at the waypoint, and the waypoint flag.
The altitude hold value in meters.
- Type:
int
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
The GPS coordinates (latitude and longitude) of the waypoint.
- Type:
Coordinates[int]
The heading in degrees.
- Type:
int
The waypoint number.
- Type:
int
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspWaypoint class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspWaypoint class populated with the parsed data.
- Return type:
The waypoint flag indicating the waypoint’s status or type.
- Type:
int
The time to stay at the waypoint in seconds.
- Type:
int
- class multiwii.data.pid.MspPid(roll: Pid[int], pitch: Pid[int], yaw: Pid[int], altitude_hold: Pid[int], position_hold: Pid[int], position_rate: Pid[int], navigation_rate: Pid[int], level_mode: Pid[int], magnetometer: Pid[int], velocity: Pid[int])[source]
Bases:
object
Represents data values for the MSP_PID command.
This class encapsulates the PID controller settings for various control axes and functions in the MultiWii flight controller.
- as_serializable() tuple[int] [source]
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
PID values for the navigation rate.
- Type:
Pid[int]
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspPid class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspPid class populated with the parsed data.
- Return type:
- class multiwii.data.pid.MspPidNames(names: tuple[str])[source]
Bases:
object
Represents data values for the MSP_PIDNAMES command.
This class is used to store the names of various PID controllers used in the MultiWii flight controller. Each name corresponds to a specific PID controller setting.
- names: tuple[str]
The names of the PID controllers.
- Type:
tuple[str]
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspPidNames class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspPidNames class populated with the parsed data.
- Return type:
- class multiwii.data.rc.MspRc(roll: int, pitch: int, yaw: int, throttle: int, aux1: int, aux2: int, aux3: int, aux4: int)[source]
Bases:
object
Represents data values for the MSP_RC command.
This class encapsulates the RC (Remote Control) input values for various control axes in the MultiWii flight controller.
- as_serializable() tuple[int] [source]
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
- aux1: int
The input value for the first auxiliary channel.
- Type:
int
- aux2: int
The input value for the second auxiliary channel.
- Type:
int
- aux3: int
The input value for the third auxiliary channel.
- Type:
int
- aux4: int
The input value for the fourth auxiliary channel.
- Type:
int
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspRc class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspRc class populated with the parsed data.
- Return type:
- pitch: int
The input value for the pitch axis.
- Type:
int
- roll: int
The input value for the roll axis.
- Type:
int
- throttle: int
The input value for the throttle.
- Type:
int
- yaw: int
The input value for the yaw axis.
- Type:
int
- class multiwii.data.rc.MspRcTuning(rate: int, expo: int, roll_pitch_rate: int, yaw_rate: int, dynamic_throttle_pid: int, throttle_mid: int, throttle_expo: int)[source]
Bases:
object
Represents data values for the MSP_RC_TUNING command.
This class encapsulates the tuning parameters for the RC (Remote Control) inputs in the MultiWii flight controller. It provides information about the rates, expo, and throttle settings.
- as_serializable() tuple[int] [source]
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
- dynamic_throttle_pid: int
The dynamic throttle PID.
- Type:
int
- expo: int
The RC expo.
- Type:
int
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspRcTuning class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspRcTuning class populated with the parsed data.
- Return type:
- rate: int
The RC rate.
- Type:
int
- roll_pitch_rate: int
The roll and pitch rate.
- Type:
int
- throttle_expo: int
The throttle expo value.
- Type:
int
- throttle_mid: int
The throttle mid-point value.
- Type:
int
- yaw_rate: int
The yaw rate.
- Type:
int
- class multiwii.data.servo.MspServo(values: tuple[int])[source]
Bases:
object
Represents data values for the MSP_SERVO command.
This class encapsulates the servo values for channels in the MultiWii flight controller.
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspServo class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspServo class populated with the parsed data.
- Return type:
- values: tuple[int]
The servo output values for each channel.
- Type:
tuple[int]
- class multiwii.data.servo.MspServoConf(values: tuple[MspServoConfItem])[source]
Bases:
object
Represents data values for the MSP_SERVO_CONF command.
This class encapsulates the servo configuration values for setting up servo endpoints, middle points, and rates in the MultiWii flight controller.
- as_serializable() tuple[int] [source]
Returns a tuple with integer values to be used for serialization.
- Returns:
A tuple with serializable integer values.
- Return type:
tuple[int]
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns aninstance of the MspServoConf class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspServoConf class populated with the parsed data.
- Return type:
- values: tuple[MspServoConfItem]
The servo configuration values for each servo channel.
- Type:
tuple[MspServoConfItem]
- class multiwii.data.servo.MspServoConfItem(min: int, max: int, middle: int, rate: int)[source]
Bases:
object
Represents data values for the MSP_SET_SERVO_CONF command.
This class encapsulates the configuration values for a single servo channel in the MultiWii flight controller.
- max: int
The maximum value for the servo endpoint.
- Type:
int
- middle: int
The middle value for the servo endpoint.
- Type:
int
- min: int
The minimum value for the servo endpoint.
- Type:
int
- rate: int
The rate vlaue for the servo channel.
- Type:
int
- class multiwii.data.telemetry.MspAltitude(estimation: int, pressure_variation: int)[source]
Bases:
object
Represents data values for the MSP_ALTITUDE command.
This class encapsulates altitude-related data from a MultiWii flight controller.
- estimation: int
The estimated altitude.
- Type:
int
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspAltitude class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspAltitude class populated with the parsed data.
- Return type:
- pressure_variation: int
The variation in pressure.
- Type:
int
- class multiwii.data.telemetry.MspAttitude(pitch_angle: float, roll_angle: float, yaw_angle: int)[source]
Bases:
object
Represents data values for the MSP_ATTITUDE command.
This class encapsulates attitude-related data from a MultiWii flight controller.
- classmethod parse(data: tuple) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspAttitude class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
- Returns:
An instance of the MspAttitude class populated with the parsed data.
- Return type:
- pitch_angle: float
The pitch angle of the aircraft in degrees, ranging from -180.0 to 180.0.
- Type:
float
- roll_angle: float
The roll angle of the aircraft in degrees, ranging from -90.0 to 90.0.
- Type:
float
- yaw_angle: int
The heading angle of the aircraft in degrees, ranging from 0 to 360.
- Type:
int
- class multiwii.data.telemetry.MspRawImu(accelerometer: Point3D[float], gyroscope: Point3D[float], magnetometer: Point3D[float])[source]
Bases:
object
Represents data values for the MSP_RAW_IMU command.
This class encapsulates raw IMU (Intertial Measurement Unit) data from a MultiWii flight controller.
- classmethod parse(data: tuple, accelerometer_unit: int = 1.0, gyroscope_unit: int = 1.0, magnetometer_unit: int = 1.0) Self [source]
Parses a tuple of data values obtained from struct.unpack and returns an instance of the MspRawImu class.
- Parameters:
data (tuple) – A tuple containing unpacked data values.
accelerometer_unit (int, optional) – The unit conversion factor for the accelerometer data (default is 1.0).
gyroscope_unit (int, optional) – The unit conversion factor for the gyroscope data (default is 1.0).
magnetometer_unit (int, optional) – The unit conversion factor for the magnetometer data (default is 1.0).
- Returns:
An instance of the MspRawImu class populated with the parsed data.
- Return type:
Value types
- class multiwii.data._types.Coordinates(latitude: float, longitude: float)[source]
Bases:
NamedTuple
Represents 2D geographics coordinates with longitude and latitude values.
- latitude: float
The latitude value of the coordinate.
- Type:
float
- longitude: float
The longitude value of the coordinate.
- Type:
float
- class multiwii.data._types.Pid(proportional: T, integral: T, derivative: T)[source]
Bases:
NamedTuple
,Generic
[T
]Represents PID values.
- derivative: T
The derivative (D) component of the PID controller.
- Type:
T
- integral: T
The integral (I) component of the PID controller.
- Type:
T
- proportional: T
The proportional (P) component of the PID controller.
- Type:
T