-
Notifications
You must be signed in to change notification settings - Fork 6
API: Get Methods
All of the get methods used by this library return a dict in the format {key:data}. The type of data may vary, but the keys are always strings. Keys and values are also guaranteed to be present even if the method fails or if the requested data is not available, in which case the values will be zero.
Returns the current altitude and vertical speed if available.
None
{
"altitude": (int) - current altitude in cm
"vari": (int) - change in altitude in cm/s
}
Returns data from analog sensors if configured.
None
{
"vbat": (int) - battery level in tenths of a volt
"powermetersum": (int) - total power consumed
"rssi": (int) - signal strength
"amperage": (int) - current draw
}
Returns the devices calculated pitch and roll attitude and heading. Note that these relative values are based on the orientation of the device when it was powered on, not on compass bearing or any other more absolute sensing method.
None
{
"angx": (int) - roll angle in degrees (+/- 180); right is positive
"angy": (int) - pitch angle in degrees (+/- 90); down is positive
"heading": (int) - heading (yaw angle) in degrees (+/- 180); right is positive
}
Returns the checkbox names. I don't think CleanFlight uses this.
None
{
"boxnames": (str) - list of box names separated by ';'
}
Returns the distance and heading to the configured 'home' location. Only available if a GPS sensor is installed.
None
{
"distance": (int) - distance to home in meters
"heading": (int) - heading to home in degrees
}
Returns the current GPS coordinate and fix information
None
{
"fix": (bool) - True for a valid fix, False otherwise
"numsat": (int) - number of satellites being used
"latitude": (int) - current latitude in 1/1,000,000 of a degree
"longitude": (int) - current longitude in 1/1,000,000 of a degree
"altitude": (int) - current altitude in meters
"speed": (int) - current speed in cm/s
"course": (int) - current ground course in 1/10 of a degree
}
Returns raw IMU data before any calculations or corrections (other than calibration) are performed. Units depend on the sensor installed, and not all devices have the same sensors.
None
{
"accx": (int) - accelerometer x
"accy": (int) - accelerometer y
"accz": (int) - accelerometer z
"gyrx": (int) - gyroscope x
"gyry": (int) - gyroscope y
"gyrz": (int) - gyroscope z
"magx": (int) - magnetometer x
"magy": (int) - magnetometer y
"magz": (int) - magnetometer z
}
Returns basic identifying information about the device. See MULTITYPENAMES for a list of the string representation of type.
None
{
"version": (int) - MultiWii version
"type": (int) - multirotor (or plane) type
}
Returns noncategorized data.
None
{
"powertrigger": (int) - don't know
"minthrottle": (int) - don't know
"maxthrottle": (int) - don't know
"mincommand": (int) - don't know
"failsafethrottle": (int) - throttle level for when failsafe mode is activated
"armedtime": (int) - time device has spent in armed state
"uptime": (int) - time device has been on
"magdeclination": (int) - magnetic declination from true north
"vbatscale": (int) - battery meter scale
"vbatwarn1": (int) - first battery level warning threshold
"vbatwarn2": (int) - second battery level warning threshold
"vbatcrit": (int) - battery level critical threshold
}
Returns mode ranges and channels for each mode. This is used by CleanFlight instead of BOX values. Note that this is a dictionary of dictionaries. Each Mode is guaranteed to be present, and channel, start, and end for each mode range are also guaranteed to be present, although the values of these will be zero in the event of a communications failure. These modes should be set up in the CleanFlight configuration software. The "Reserved" item is not used and only present for index padding.
Each mode in the "outer" dictionary contains a dictionary with the following values:
{
"channel": (int) - the Aux channel that will activate this mode
"start": (int) - the lowest value that will trigger the mode
"end": (int) - the highest value that will trigger the mode
}
Example:
armingChannel = getModeRanges()["ARM"]["channel"]`None
{
"ARM":
{
"channel": (int)
"start": (int)
"end": (int)
}
"ANGLE":
{
"channel": (int)
"start": (int)
"end": (int)
}
"HORIZON":
{
"channel": (int)
"start": (int)
"end": (int)
}
"BARO":
{
"channel": (int)
"start": (int)
"end": (int)
}
"Reserved":
{
"channel": (int)
"start": (int)
"end": (int)
}
"MAG":
{
"channel": (int)
"start": (int)
"end": (int)
}
"HEADFREE":
{
"channel": (int)
"start": (int)
"end": (int)
}
"HEADADJ":
{
"channel": (int)
"start": (int)
"end": (int)
}
"CAMSTAB":
{
"channel": (int)
"start": (int)
"end": (int)
}
"CAMTRIG":
{
"channel": (int)
"start": (int)
"end": (int)
}
"GPSHOME":
{
"channel": (int)
"start": (int)
"end": (int)
}
"GPSHOLD":
{
"channel": (int)
"start": (int)
"end": (int)
}
"PASSTHRU":
{
"channel": (int)
"start": (int)
"end": (int)
}
"BEEPERON":
{
"channel": (int)
"start": (int)
"end": (int)
}
"LEDMAX":
{
"channel": (int)
"start": (int)
"end": (int)
}
"LEDLOW":
{
"channel": (int)
"start": (int)
"end": (int)
}
"LLIGHTS":
{
"channel": (int)
"start": (int)
"end": (int)
}
"CALIB":
{
"channel": (int)
"start": (int)
"end": (int)
}
"GOV":
{
"channel": (int)
"start": (int)
"end": (int)
}
"OSD":
{
"channel": (int)
"start": (int)
"end": (int)
}
"TELEMETRY":
{
"channel": (int)
"start": (int)
"end": (int)
}
"AUTOTUNE":
{
"channel": (int)
"start": (int)
"end": (int)
}
"SONAR":
{
"channel": (int)
"start": (int)
"end": (int)
}
}
Returns the current PWM signal value sent to each ESC by the flight controller. Note that these values are simply the value sent by the FC and do not necessarily represent motor speed. Motors that are not installed or configured will have a value of zero.
None
{
"motor1": (int) - motor 1 signal value
"motor2": (int) - motor 2 signal value
"motor3": (int) - motor 3 signal value
"motor4": (int) - motor 4 signal value
"motor5": (int) - motor 5 signal value
"motor6": (int) - motor 6 signal value
"motor7": (int) - motor 7 signal value
"motor8": (int) - motor 8 signal value
}
Returns the RC signal values the flight controller is currently acting on. These could either be from another RC transmitter if one is in use or the last values sent to the flight controller over MSP.
None
{
"pitch": (int) - pitch axis signal value
"roll": (int) - roll axis signal value
"yaw": (int)- roll axis signal value
"throttle": (int) - throttle signal value
"aux1": (int) - aux 1 signal value
"aux2": (int) - aux 2 signal value
"aux3": (int) - aux 3 signal value
"aux4": (int) - aux 4 signal value
}
Return the current PWM signal sent to each servo. Note that this only represents the signal sent to each servo and not its actual position.
None
{
"servo1": (int) - servo 1 signal value
"servo2": (int) - servo 2 signal value
"servo3": (int) - servo 3 signal value
"servo4": (int) - servo 4 signal value
"servo5": (int) - servo 5 signal value
"servo6": (int) - servo 6 signal value
"servo7": (int) - servo 7 signal value
"servo8": (int) - servo 8 signal value
}
Returns some general status information from the flight controller.
None
{
"cycletime": (int) - microseconds spent in each flight controller processing cycle
"i2cerrorcount": (int) - I2C bus error count
"sensor": (int) - supposedly a bitmask of what sensor are installed; not heavily tested
"flag": (int) - flag for checkboxes; probably not used by CleanFlight
"currentset": (int) - current configuration setting
}