Classes | Functions | Variables
pymavlink.mavutil Namespace Reference

Classes

class  FakeSerial
 
class  location
 
class  mavchildexec
 
class  mavfile
 
class  mavfile_state
 
class  MavlinkSerialPort
 
class  mavlogfile
 
class  mavmcast
 
class  mavmmaplog
 
class  mavserial
 
class  mavtcp
 
class  mavtcpin
 
class  mavudp
 
class  param_state
 
class  periodic_event
 
class  SerialPort
 
class  x25crc
 

Functions

def all_printable (buf)
 
def auto_detect_serial (preferred_list=['*'])
 
def auto_detect_serial_unix (preferred_list=['*'])
 
def auto_detect_serial_win32 (preferred_list=['*'])
 
def evaluate_condition (condition, vars)
 
def evaluate_expression (expression, vars)
 
def interpret_px4_mode (base_mode, custom_mode)
 
def is_printable (c)
 
def mavlink10 ()
 
def mavlink20 ()
 
def mavlink_connection (device, baud=115200, source_system=255, source_component=0, planner_format=None, write=False, append=False, robust_parsing=True, notimestamps=False, input=True, dialect=None, autoreconnect=False, zero_time_base=False, retries=3, use_native=default_native, force_connected=False, progress_callback=None)
 
def mode_mapping_byname (mav_type)
 
def mode_mapping_bynumber (mav_type)
 
def mode_string_acm (mode_number)
 
def mode_string_apm (mode_number)
 
def mode_string_px4 (MainState)
 
def mode_string_v09 (msg)
 
def mode_string_v10 (msg)
 
def set_close_on_exec (fd)
 
def set_dialect (dialect)
 
def u_ord (c)
 

Variables

 auto_mode_flags = mavlink.MAV_MODE_FLAG_AUTO_ENABLED\
 
bool default_native = False
 
int global_link_id = 0
 
dictionary mainstate_mapping_px4
 
 mavfile_global = None
 
 mavlink = None
 
dictionary mode_mapping_acm
 
dictionary mode_mapping_apm
 
dictionary mode_mapping_rover
 
dictionary mode_mapping_sub
 
dictionary mode_mapping_tracker
 
int PX4_CUSTOM_MAIN_MODE_ACRO = 5
 
int PX4_CUSTOM_MAIN_MODE_ALTCTL = 2
 
int PX4_CUSTOM_MAIN_MODE_AUTO = 4
 
int PX4_CUSTOM_MAIN_MODE_MANUAL = 1
 
int PX4_CUSTOM_MAIN_MODE_OFFBOARD = 6
 
int PX4_CUSTOM_MAIN_MODE_POSCTL = 3
 
int PX4_CUSTOM_MAIN_MODE_RATTITUDE = 8
 
int PX4_CUSTOM_MAIN_MODE_STABILIZED = 7
 
int PX4_CUSTOM_SUB_MODE_AUTO_FOLLOW_TARGET = 8
 
int PX4_CUSTOM_SUB_MODE_AUTO_LAND = 6
 
int PX4_CUSTOM_SUB_MODE_AUTO_LOITER = 3
 
int PX4_CUSTOM_SUB_MODE_AUTO_MISSION = 4
 
int PX4_CUSTOM_SUB_MODE_AUTO_READY = 1
 
int PX4_CUSTOM_SUB_MODE_AUTO_RTGS = 7
 
int PX4_CUSTOM_SUB_MODE_AUTO_RTL = 5
 
int PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF = 2
 
int PX4_CUSTOM_SUB_MODE_OFFBOARD = 0
 
dictionary px4_map
 
 serial_list = auto_detect_serial(preferred_list=['*FTDI*',"*Arduino_Mega_2560*", "*3D_Robotics*", "*USB_to_UART*", '*PX4*', '*FMU*'])
 
int UDP_MAX_PACKET_LEN = 65535
 

Detailed Description

mavlink python utility functions

Copyright Andrew Tridgell 2011
Released under GNU GPL version 3 or later

Function Documentation

def pymavlink.mavutil.all_printable (   buf)
see if a string is all printable

Definition at line 1691 of file mavutil.py.

def pymavlink.mavutil.auto_detect_serial (   preferred_list = ['*'])
try to auto-detect serial port

Definition at line 1762 of file mavutil.py.

def pymavlink.mavutil.auto_detect_serial_unix (   preferred_list = ['*'])
try to auto-detect serial ports on unix

Definition at line 1741 of file mavutil.py.

def pymavlink.mavutil.auto_detect_serial_win32 (   preferred_list = ['*'])
try to auto-detect serial ports on win32

Definition at line 1713 of file mavutil.py.

def pymavlink.mavutil.evaluate_condition (   condition,
  vars 
)
evaluation a conditional (boolean) statement

Definition at line 57 of file mavutil.py.

def pymavlink.mavutil.evaluate_expression (   expression,
  vars 
)
evaluation an expression

Definition at line 53 of file mavutil.py.

def pymavlink.mavutil.interpret_px4_mode (   base_mode,
  custom_mode 
)

Definition at line 1965 of file mavutil.py.

def pymavlink.mavutil.is_printable (   c)
see if a character is printable

Definition at line 1680 of file mavutil.py.

def pymavlink.mavutil.mavlink10 ( )
return True if using MAVLink 1.0 or later

Definition at line 45 of file mavutil.py.

def pymavlink.mavutil.mavlink20 ( )
return True if using MAVLink 2.0

Definition at line 49 of file mavutil.py.

def pymavlink.mavutil.mavlink_connection (   device,
  baud = 115200,
  source_system = 255,
  source_component = 0,
  planner_format = None,
  write = False,
  append = False,
  robust_parsing = True,
  notimestamps = False,
  input = True,
  dialect = None,
  autoreconnect = False,
  zero_time_base = False,
  retries = 3,
  use_native = default_native,
  force_connected = False,
  progress_callback = None 
)
open a serial, UDP, TCP or file mavlink connection

Definition at line 1581 of file mavutil.py.

def pymavlink.mavutil.mode_mapping_byname (   mav_type)
return dictionary mapping mode names to numbers, or None if unknown

Definition at line 2002 of file mavutil.py.

def pymavlink.mavutil.mode_mapping_bynumber (   mav_type)
return dictionary mapping mode numbers to name, or None if unknown

Definition at line 2027 of file mavutil.py.

def pymavlink.mavutil.mode_string_acm (   mode_number)
return mode string for APM:Copter

Definition at line 2088 of file mavutil.py.

def pymavlink.mavutil.mode_string_apm (   mode_number)
return mode string for APM:Plane

Definition at line 2082 of file mavutil.py.

def pymavlink.mavutil.mode_string_px4 (   MainState)

Definition at line 1921 of file mavutil.py.

def pymavlink.mavutil.mode_string_v09 (   msg)
mode string for 0.9 protocol

Definition at line 1769 of file mavutil.py.

def pymavlink.mavutil.mode_string_v10 (   msg)
mode string for 1.0 protocol, from heartbeat

Definition at line 2053 of file mavutil.py.

def pymavlink.mavutil.set_close_on_exec (   fd)
set the clone on exec flag on a file descriptor. Ignore exceptions

Definition at line 879 of file mavutil.py.

def pymavlink.mavutil.set_dialect (   dialect)
set the MAVLink dialect to work with.
For example, set_dialect("ardupilotmega")

Definition at line 80 of file mavutil.py.

def pymavlink.mavutil.u_ord (   c)

Definition at line 66 of file mavutil.py.

Variable Documentation

pymavlink.mavutil.auto_mode_flags = mavlink.MAV_MODE_FLAG_AUTO_ENABLED\

Definition at line 1945 of file mavutil.py.

bool pymavlink.mavutil.default_native = False

Definition at line 36 of file mavutil.py.

int pymavlink.mavutil.global_link_id = 0

Definition at line 39 of file mavutil.py.

dictionary pymavlink.mavutil.mainstate_mapping_px4
Initial value:
1 = {
2  0 : 'MANUAL',
3  1 : 'ALTCTL',
4  2 : 'POSCTL',
5  3 : 'AUTO_MISSION',
6  4 : 'AUTO_LOITER',
7  5 : 'AUTO_RTL',
8  6 : 'ACRO',
9  7 : 'OFFBOARD',
10  8 : 'STAB',
11  9 : 'RATTITUDE',
12  10 : 'AUTO_TAKEOFF',
13  11 : 'AUTO_LAND',
14  12 : 'AUTO_FOLLOW_TARGET',
15  13 : 'MAX',
16 }

Definition at line 1905 of file mavutil.py.

pymavlink.mavutil.mavfile_global = None

Definition at line 33 of file mavutil.py.

pymavlink.mavutil.mavlink = None

Definition at line 29 of file mavutil.py.

dictionary pymavlink.mavutil.mode_mapping_acm
Initial value:
1 = {
2  0 : 'STABILIZE',
3  1 : 'ACRO',
4  2 : 'ALT_HOLD',
5  3 : 'AUTO',
6  4 : 'GUIDED',
7  5 : 'LOITER',
8  6 : 'RTL',
9  7 : 'CIRCLE',
10  8 : 'POSITION',
11  9 : 'LAND',
12  10 : 'OF_LOITER',
13  11 : 'DRIFT',
14  13 : 'SPORT',
15  14 : 'FLIP',
16  15 : 'AUTOTUNE',
17  16 : 'POSHOLD',
18  17 : 'BRAKE',
19  18 : 'THROW',
20  19 : 'AVOID_ADSB',
21  20 : 'GUIDED_NOGPS',
22  21 : 'SMART_RTL',
23  22 : 'FLOWHOLD',
24  23 : 'FOLLOW',
25 }

Definition at line 1841 of file mavutil.py.

dictionary pymavlink.mavutil.mode_mapping_apm
Initial value:
1 = {
2  0 : 'MANUAL',
3  1 : 'CIRCLE',
4  2 : 'STABILIZE',
5  3 : 'TRAINING',
6  4 : 'ACRO',
7  5 : 'FBWA',
8  6 : 'FBWB',
9  7 : 'CRUISE',
10  8 : 'AUTOTUNE',
11  10 : 'AUTO',
12  11 : 'RTL',
13  12 : 'LOITER',
14  14 : 'LAND',
15  15 : 'GUIDED',
16  16 : 'INITIALISING',
17  17 : 'QSTABILIZE',
18  18 : 'QHOVER',
19  19 : 'QLOITER',
20  20 : 'QLAND',
21  21 : 'QRTL',
22  22 : 'QAUTOTUNE',
23  }

Definition at line 1818 of file mavutil.py.

dictionary pymavlink.mavutil.mode_mapping_rover
Initial value:
1 = {
2  0 : 'MANUAL',
3  1 : 'ACRO',
4  2 : 'LEARNING',
5  3 : 'STEERING',
6  4 : 'HOLD',
7  5 : 'LOITER',
8  10 : 'AUTO',
9  11 : 'RTL',
10  12 : 'SMART_RTL',
11  15 : 'GUIDED',
12  16 : 'INITIALISING'
13  }

Definition at line 1866 of file mavutil.py.

dictionary pymavlink.mavutil.mode_mapping_sub
Initial value:
1 = {
2  0: 'STABILIZE',
3  1: 'ACRO',
4  2: 'ALT_HOLD',
5  3: 'AUTO',
6  4: 'GUIDED',
7  7: 'CIRCLE',
8  9: 'SURFACE',
9  16: 'POSHOLD',
10  19: 'MANUAL',
11  }

Definition at line 1888 of file mavutil.py.

dictionary pymavlink.mavutil.mode_mapping_tracker
Initial value:
1 = {
2  0 : 'MANUAL',
3  1 : 'STOP',
4  2 : 'SCAN',
5  10 : 'AUTO',
6  16 : 'INITIALISING'
7  }

Definition at line 1880 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_MAIN_MODE_ACRO = 5

Definition at line 1930 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_MAIN_MODE_ALTCTL = 2

Definition at line 1927 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_MAIN_MODE_AUTO = 4

Definition at line 1929 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_MAIN_MODE_MANUAL = 1

Definition at line 1926 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_MAIN_MODE_OFFBOARD = 6

Definition at line 1931 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_MAIN_MODE_POSCTL = 3

Definition at line 1928 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_MAIN_MODE_RATTITUDE = 8

Definition at line 1933 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_MAIN_MODE_STABILIZED = 7

Definition at line 1932 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_AUTO_FOLLOW_TARGET = 8

Definition at line 1943 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_AUTO_LAND = 6

Definition at line 1941 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_AUTO_LOITER = 3

Definition at line 1938 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_AUTO_MISSION = 4

Definition at line 1939 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_AUTO_READY = 1

Definition at line 1936 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_AUTO_RTGS = 7

Definition at line 1942 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_AUTO_RTL = 5

Definition at line 1940 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF = 2

Definition at line 1937 of file mavutil.py.

int pymavlink.mavutil.PX4_CUSTOM_SUB_MODE_OFFBOARD = 0

Definition at line 1935 of file mavutil.py.

dictionary pymavlink.mavutil.px4_map
Initial value:
1 = { "MANUAL": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | mavlink.MAV_MODE_FLAG_STABILIZE_ENABLED | mavlink.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, PX4_CUSTOM_MAIN_MODE_MANUAL, 0 ),
2  "STABILIZED": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | mavlink.MAV_MODE_FLAG_STABILIZE_ENABLED | mavlink.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, PX4_CUSTOM_MAIN_MODE_STABILIZED, 0 ),
3  "ACRO": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | mavlink.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, PX4_CUSTOM_MAIN_MODE_ACRO, 0 ),
4  "RATTITUDE": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | mavlink.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, PX4_CUSTOM_MAIN_MODE_RATTITUDE, 0 ),
5  "ALTCTL": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | mavlink.MAV_MODE_FLAG_STABILIZE_ENABLED | mavlink.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, PX4_CUSTOM_MAIN_MODE_ALTCTL, 0 ),
6  "POSCTL": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | mavlink.MAV_MODE_FLAG_STABILIZE_ENABLED | mavlink.MAV_MODE_FLAG_MANUAL_INPUT_ENABLED, PX4_CUSTOM_MAIN_MODE_POSCTL, 0 ),
7  "LOITER": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | auto_mode_flags, PX4_CUSTOM_MAIN_MODE_AUTO, PX4_CUSTOM_SUB_MODE_AUTO_LOITER ),
8  "MISSION": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | auto_mode_flags, PX4_CUSTOM_MAIN_MODE_AUTO, PX4_CUSTOM_SUB_MODE_AUTO_MISSION ),
9  "RTL": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | auto_mode_flags, PX4_CUSTOM_MAIN_MODE_AUTO, PX4_CUSTOM_SUB_MODE_AUTO_RTL ),
10  "LAND": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | auto_mode_flags, PX4_CUSTOM_MAIN_MODE_AUTO, PX4_CUSTOM_SUB_MODE_AUTO_LAND ),
11  "RTGS": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | auto_mode_flags, PX4_CUSTOM_MAIN_MODE_AUTO, PX4_CUSTOM_SUB_MODE_AUTO_RTGS ),
12  "FOLLOWME": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | auto_mode_flags, PX4_CUSTOM_MAIN_MODE_AUTO, PX4_CUSTOM_SUB_MODE_AUTO_FOLLOW_TARGET ),
13  "OFFBOARD": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | auto_mode_flags, PX4_CUSTOM_MAIN_MODE_OFFBOARD, 0 ),
14  "TAKEOFF": (mavlink.MAV_MODE_FLAG_CUSTOM_MODE_ENABLED | auto_mode_flags, PX4_CUSTOM_MAIN_MODE_AUTO, PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF )}

Definition at line 1949 of file mavutil.py.

pymavlink.mavutil.serial_list = auto_detect_serial(preferred_list=['*FTDI*',"*Arduino_Mega_2560*", "*3D_Robotics*", "*USB_to_UART*", '*PX4*', '*FMU*'])

Definition at line 2223 of file mavutil.py.

int pymavlink.mavutil.UDP_MAX_PACKET_LEN = 65535

Definition at line 25 of file mavutil.py.



mavlink
Author(s): Lorenz Meier
autogenerated on Sun Apr 7 2019 02:06:02