INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
speak some text
def say(self, text, priority='important'): '''speak some text''' ''' http://cvs.freebsoft.org/doc/speechd/ssip.html see 4.3.1 for priorities''' self.console.writeln(text) if self.settings.speech and self.say_backend is not None: self.say_backend(text, priority=priority)
Load a previously created file list or create a new one if none is available.
def loadFileList(self): """Load a previously created file list or create a new one if none is available.""" try: data = open(self.filelist_file, 'rb') except IOError: '''print "No SRTM cached file list. Creating new one!"''' if self.offline == 0: self.createFileList() return try: self.filelist = pickle.load(data) data.close() if len(self.filelist) < self.min_filelist_len: self.filelist = {} if self.offline == 0: self.createFileList() except: '''print "Unknown error loading cached SRTM file list. Creating new one!"''' if self.offline == 0: self.createFileList()
SRTM data is split into different directories, get a list of all of them and create a dictionary for easy lookup.
def createFileList(self): """SRTM data is split into different directories, get a list of all of them and create a dictionary for easy lookup.""" global childFileListDownload if childFileListDownload is None or not childFileListDownload.is_alive(): childFileListDownload = multiprocessing.Process(target=self.createFileListHTTP) childFileListDownload.start()
Get a SRTM tile object. This function can return either an SRTM1 or SRTM3 object depending on what is available, however currently it only returns SRTM3 objects.
def getTile(self, lat, lon): """Get a SRTM tile object. This function can return either an SRTM1 or SRTM3 object depending on what is available, however currently it only returns SRTM3 objects.""" global childFileListDownload if childFileListDownload is not None and childFileListDownload.is_alive(): '''print "Getting file list"''' return 0 elif not self.filelist: '''print "Filelist download complete, loading data"''' data = open(self.filelist_file, 'rb') self.filelist = pickle.load(data) data.close() try: continent, filename = self.filelist[(int(lat), int(lon))] except KeyError: '''print "here??"''' if len(self.filelist) > self.min_filelist_len: # we appear to have a full filelist - this must be ocean return SRTMOceanTile(int(lat), int(lon)) return 0 global childTileDownload if not os.path.exists(os.path.join(self.cachedir, filename)): if childTileDownload is None or not childTileDownload.is_alive(): try: childTileDownload = multiprocessing.Process(target=self.downloadTile, args=(str(continent), str(filename))) childTileDownload.start() except Exception as ex: childTileDownload = None return 0 '''print "Getting Tile"''' return 0 elif childTileDownload is not None and childTileDownload.is_alive(): '''print "Still Getting Tile"''' return 0 # TODO: Currently we create a new tile object each time. # Caching is required for improved performance. try: return SRTMTile(os.path.join(self.cachedir, filename), int(lat), int(lon)) except InvalidTileError: return 0
Returns the weighted average of two values and handles the case where one value is None. If both values are None, None is returned.
def _avg(value1, value2, weight): """Returns the weighted average of two values and handles the case where one value is None. If both values are None, None is returned. """ if value1 is None: return value2 if value2 is None: return value1 return value2 * weight + value1 * (1 - weight)
Get the value of a pixel from the data, handling voids in the SRTM data.
def getPixelValue(self, x, y): """Get the value of a pixel from the data, handling voids in the SRTM data.""" assert x < self.size, "x: %d<%d" % (x, self.size) assert y < self.size, "y: %d<%d" % (y, self.size) # Same as calcOffset, inlined for performance reasons offset = x + self.size * (self.size - y - 1) #print offset value = self.data[offset] if value == -32768: return -1 # -32768 is a special value for areas with no data return value
Calculate offset into data array. Only uses to test correctness of the formula.
def calcOffset(self, x, y): """Calculate offset into data array. Only uses to test correctness of the formula.""" # Datalayout # X = longitude # Y = latitude # Sample for size 1201x1201 # ( 0/1200) ( 1/1200) ... (1199/1200) (1200/1200) # ( 0/1199) ( 1/1199) ... (1199/1199) (1200/1199) # ... ... ... ... # ( 0/ 1) ( 1/ 1) ... (1199/ 1) (1200/ 1) # ( 0/ 0) ( 1/ 0) ... (1199/ 0) (1200/ 0) # Some offsets: # (0/1200) 0 # (1200/1200) 1200 # (0/1199) 1201 # (1200/1199) 2401 # (0/0) 1201*1200 # (1200/0) 1201*1201-1 return x + self.size * (self.size - y - 1)
Get the altitude of a lat lon pair, using the four neighbouring pixels for interpolation.
def getAltitudeFromLatLon(self, lat, lon): """Get the altitude of a lat lon pair, using the four neighbouring pixels for interpolation. """ # print "-----\nFromLatLon", lon, lat lat -= self.lat lon -= self.lon # print "lon, lat", lon, lat if lat < 0.0 or lat >= 1.0 or lon < 0.0 or lon >= 1.0: raise WrongTileError(self.lat, self.lon, self.lat+lat, self.lon+lon) x = lon * (self.size - 1) y = lat * (self.size - 1) # print "x,y", x, y x_int = int(x) x_frac = x - int(x) y_int = int(y) y_frac = y - int(y) # print "frac", x_int, x_frac, y_int, y_frac value00 = self.getPixelValue(x_int, y_int) value10 = self.getPixelValue(x_int+1, y_int) value01 = self.getPixelValue(x_int, y_int+1) value11 = self.getPixelValue(x_int+1, y_int+1) value1 = self._avg(value00, value10, x_frac) value2 = self._avg(value01, value11, x_frac) value = self._avg(value1, value2, y_frac) # print "%4d %4d | %4d\n%4d %4d | %4d\n-------------\n%4d" % ( # value00, value10, value1, value01, value11, value2, value) return value
message receive routine
def recv_msg(self): '''message receive routine''' if self._index >= self._count: return None m = self._msgs[self._index] type = m.get_type() self._index += 1 self.percent = (100.0 * self._index) / self._count self.messages[type] = m self._timestamp = m._timestamp if self._flightmode_index < len(self._flightmodes): (mode, tstamp, t2) = self._flightmodes[self._flightmode_index] if m._timestamp >= tstamp: self.flightmode = mode self._flightmode_index += 1 self.check_param(m) return m
rewind to start
def rewind(self): '''rewind to start''' self._index = 0 self.percent = 0 self.messages = {} self._flightmode_index = 0 self._timestamp = None self.flightmode = None self.params = {}
reduce data using flightmode selections
def reduce_by_flightmodes(self, flightmode_selections): '''reduce data using flightmode selections''' if len(flightmode_selections) == 0: return all_false = True for s in flightmode_selections: if s: all_false = False if all_false: # treat all false as all modes wanted''' return new_msgs = [] idx = 0 for m in self._msgs: while idx < len(self._flightmodes) and m._timestamp >= self._flightmodes[idx][2]: idx += 1 if idx < len(flightmode_selections) and flightmode_selections[idx]: new_msgs.append(m) self._msgs = new_msgs self._count = len(new_msgs) self.rewind()
set a parameter on a mavlink connection
def mavset(self, mav, name, value, retries=3): '''set a parameter on a mavlink connection''' got_ack = False while retries > 0 and not got_ack: retries -= 1 mav.param_set_send(name.upper(), float(value)) tstart = time.time() while time.time() - tstart < 1: ack = mav.recv_match(type='PARAM_VALUE', blocking=False) if ack == None: time.sleep(0.1) continue if str(name).upper() == str(ack.param_id).upper(): got_ack = True self.__setitem__(name, float(value)) break if not got_ack: print("timeout setting %s to %f" % (name, float(value))) return False return True
save parameters to a file
def save(self, filename, wildcard='*', verbose=False): '''save parameters to a file''' f = open(filename, mode='w') k = list(self.keys()) k.sort() count = 0 for p in k: if p and fnmatch.fnmatch(str(p).upper(), wildcard.upper()): f.write("%-16.16s %f\n" % (p, self.__getitem__(p))) count += 1 f.close() if verbose: print("Saved %u parameters to %s" % (count, filename))
load parameters from a file
def load(self, filename, wildcard='*', mav=None, check=True): '''load parameters from a file''' try: f = open(filename, mode='r') except: print("Failed to open file '%s'" % filename) return False count = 0 changed = 0 for line in f: line = line.strip() if not line or line[0] == "#": continue line = line.replace(',',' ') a = line.split() if len(a) != 2: print("Invalid line: %s" % line) continue # some parameters should not be loaded from files if a[0] in self.exclude_load: continue if not fnmatch.fnmatch(a[0].upper(), wildcard.upper()): continue if mav is not None: if check: if a[0] not in self.keys(): print("Unknown parameter %s" % a[0]) continue old_value = self.__getitem__(a[0]) if math.fabs(old_value - float(a[1])) <= self.mindelta: count += 1 continue if self.mavset(mav, a[0], a[1]): print("changed %s from %f to %f" % (a[0], old_value, float(a[1]))) else: print("set %s to %f" % (a[0], float(a[1]))) self.mavset(mav, a[0], a[1]) changed += 1 else: self.__setitem__(a[0], float(a[1])) count += 1 f.close() if mav is not None: print("Loaded %u parameters from %s (changed %u)" % (count, filename, changed)) else: print("Loaded %u parameters from %s" % (count, filename)) return True
show parameters
def show(self, wildcard='*'): '''show parameters''' k = sorted(self.keys()) for p in k: if fnmatch.fnmatch(str(p).upper(), wildcard.upper()): print("%-16.16s %f" % (str(p), self.get(p)))
show differences with another parameter file
def diff(self, filename, wildcard='*'): '''show differences with another parameter file''' other = MAVParmDict() if not other.load(filename): return keys = sorted(list(set(self.keys()).union(set(other.keys())))) for k in keys: if not fnmatch.fnmatch(str(k).upper(), wildcard.upper()): continue if not k in other: print("%-16.16s %12.4f" % (k, self[k])) elif not k in self: print("%-16.16s %12.4f" % (k, other[k])) elif abs(self[k] - other[k]) > self.mindelta: print("%-16.16s %12.4f %12.4f" % (k, other[k], self[k]))
generate main header per XML file
def generate_enums(basename, xml): '''generate main header per XML file''' directory = os.path.join(basename, '''enums''') mavparse.mkdir_p(directory) for en in xml.enum: f = open(os.path.join(directory, en.name+".java"), mode='w') t.write(f, ''' /* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * java mavlink generator tool. It should not be modified by hand. */ package com.MAVLink.enums; /** * ${description} */ public class ${name} { ${{entry: public static final int ${name} = ${value}; /* ${description} |${{param:${description}| }} */ }} } ''', en) f.close()
copy the fixed protocol headers to the target directory
def copy_fixed_headers(directory, xml): '''copy the fixed protocol headers to the target directory''' import shutil hlist = [ 'Parser.java', 'Messages/MAVLinkMessage.java', 'Messages/MAVLinkPayload.java', 'Messages/MAVLinkStats.java' ] basepath = os.path.dirname(os.path.realpath(__file__)) srcpath = os.path.join(basepath, 'java/lib') print("Copying fixed headers") for h in hlist: src = os.path.realpath(os.path.join(srcpath, h)) dest = os.path.realpath(os.path.join(directory, h)) if src == dest: continue destdir = os.path.realpath(os.path.join(directory, 'Messages')) try: os.makedirs(destdir) except: print("Not re-creating Messages directory") shutil.copy(src, dest)
work out the struct format for a type
def mavfmt(field, typeInfo=False): '''work out the struct format for a type''' map = { 'float' : ('float', 'Float'), 'double' : ('double', 'Double'), 'char' : ('byte', 'Byte'), 'int8_t' : ('byte', 'Byte'), 'uint8_t' : ('short', 'UnsignedByte'), 'uint8_t_mavlink_version' : ('short', 'UnsignedByte'), 'int16_t' : ('short', 'Short'), 'uint16_t' : ('int', 'UnsignedShort'), 'int32_t' : ('int', 'Int'), 'uint32_t' : ('long', 'UnsignedInt'), 'int64_t' : ('long', 'Long'), 'uint64_t' : ('long', 'UnsignedLong'), } if typeInfo: return map[field.type][1] else: return map[field.type][0]
generate headers for one XML file
def generate_one(basename, xml): '''generate headers for one XML file''' directory = os.path.join(basename, xml.basename) print("Generating Java implementation in directory %s" % directory) mavparse.mkdir_p(directory) if xml.little_endian: xml.mavlink_endian = "MAVLINK_LITTLE_ENDIAN" else: xml.mavlink_endian = "MAVLINK_BIG_ENDIAN" if xml.crc_extra: xml.crc_extra_define = "1" else: xml.crc_extra_define = "0" if xml.sort_fields: xml.aligned_fields_define = "1" else: xml.aligned_fields_define = "0" # work out the included headers xml.include_list = [] for i in xml.include: base = i[:-4] xml.include_list.append(mav_include(base)) # form message lengths array xml.message_lengths_array = '' for mlen in xml.message_lengths: xml.message_lengths_array += '%u, ' % mlen xml.message_lengths_array = xml.message_lengths_array[:-2] # form message info array xml.message_info_array = '' for name in xml.message_names: if name is not None: xml.message_info_array += 'MAVLINK_MESSAGE_INFO_%s, ' % name else: # Several C compilers don't accept {NULL} for # multi-dimensional arrays and structs # feed the compiler a "filled" empty message xml.message_info_array += '{"EMPTY",0,{{"","",MAVLINK_TYPE_CHAR,0,0,0}}}, ' xml.message_info_array = xml.message_info_array[:-2] # add some extra field attributes for convenience with arrays for m in xml.message: m.msg_name = m.name if xml.crc_extra: m.crc_extra_arg = ", %s" % m.crc_extra else: m.crc_extra_arg = "" for f in m.fields: if f.print_format is None: f.c_print_format = 'NULL' else: f.c_print_format = '"%s"' % f.print_format f.getText = '' if f.array_length != 0: f.array_suffix = '[] = new %s[%u]' % (mavfmt(f),f.array_length) f.array_prefix = '*' f.array_tag = '_array' f.array_arg = ', %u' % f.array_length f.array_return_arg = '%s, %u, ' % (f.name, f.array_length) f.array_const = 'const ' f.decode_left = '' f.decode_right = 'm.%s' % (f.name) f.unpackField = ''' for (int i = 0; i < this.%s.length; i++) { this.%s[i] = payload.get%s(); } ''' % (f.name, f.name, mavfmt(f, True) ) f.packField = ''' for (int i = 0; i < %s.length; i++) { packet.payload.put%s(%s[i]); } ''' % (f.name, mavfmt(f, True),f.name) f.return_type = 'uint16_t' f.get_arg = ', %s *%s' % (f.type, f.name) if f.type == 'char': f.c_test_value = '"%s"' % f.test_value f.getText = ''' /** * Sets the buffer of this message with a string, adds the necessary padding */ public void set%s(String str) { int len = Math.min(str.length(), %d); for (int i=0; i<len; i++) { %s[i] = (byte) str.charAt(i); } for (int i=len; i<%d; i++) { // padding for the rest of the buffer %s[i] = 0; } } /** * Gets the message, formated as a string */ public String get%s() { String result = ""; for (int i = 0; i < %d; i++) { if (%s[i] != 0) result = result + (char) %s[i]; else break; } return result; } ''' % (f.name.title(),f.array_length,f.name,f.array_length,f.name,f.name.title(),f.array_length,f.name,f.name) else: test_strings = [] for v in f.test_value: test_strings.append(str(v)) f.c_test_value = '{ %s }' % ', '.join(test_strings) else: f.array_suffix = '' f.array_prefix = '' f.array_tag = '' f.array_arg = '' f.array_return_arg = '' f.array_const = '' f.decode_left = '%s' % (f.name) f.decode_right = '' f.unpackField = 'this.%s = payload.get%s();' % (f.name, mavfmt(f, True)) f.packField = 'packet.payload.put%s(%s);' % (mavfmt(f, True),f.name) f.get_arg = '' f.return_type = f.type if f.type == 'char': f.c_test_value = "'%s'" % f.test_value elif f.type == 'uint64_t': f.c_test_value = "%sULL" % f.test_value elif f.type == 'int64_t': f.c_test_value = "%sLL" % f.test_value else: f.c_test_value = f.test_value # cope with uint8_t_mavlink_version for m in xml.message: m.arg_fields = [] m.array_fields = [] m.scalar_fields = [] for f in m.ordered_fields: if f.array_length != 0: m.array_fields.append(f) else: m.scalar_fields.append(f) for f in m.fields: if not f.omit_arg: m.arg_fields.append(f) f.putname = f.name else: f.putname = f.const_value # fix types to java for m in xml.message: for f in m.ordered_fields: f.type = mavfmt(f) generate_CRC(directory, xml) for m in xml.message: generate_message_h(directory, m)
generate complete MAVLink Java implemenation
def generate(basename, xml_list): '''generate complete MAVLink Java implemenation''' for xml in xml_list: generate_one(basename, xml) generate_enums(basename, xml) generate_MAVLinkMessage(basename, xml_list) copy_fixed_headers(basename, xml_list[0])
The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receiving system to treat further messages from this system appropriate (e.g. by laying out the user interface based on the autopilot). type : Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) (uint8_t) autopilot : Autopilot type / class. defined in MAV_AUTOPILOT ENUM (uint8_t) base_mode : System mode bitfield, see MAV_MODE_FLAGS ENUM in mavlink/include/mavlink_types.h (uint8_t) custom_mode : A bitfield for use for autopilot-specific flags. (uint32_t) system_status : System status flag, see MAV_STATE ENUM (uint8_t) mavlink_version : MAVLink version (uint8_t)
def heartbeat_encode(self, type, autopilot, base_mode, custom_mode, system_status, mavlink_version=2): ''' The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receiving system to treat further messages from this system appropriate (e.g. by laying out the user interface based on the autopilot). type : Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) (uint8_t) autopilot : Autopilot type / class. defined in MAV_AUTOPILOT ENUM (uint8_t) base_mode : System mode bitfield, see MAV_MODE_FLAGS ENUM in mavlink/include/mavlink_types.h (uint8_t) custom_mode : A bitfield for use for autopilot-specific flags. (uint32_t) system_status : System status flag, see MAV_STATE ENUM (uint8_t) mavlink_version : MAVLink version (uint8_t) ''' return MAVLink_heartbeat_message(type, autopilot, base_mode, custom_mode, system_status, mavlink_version)
The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receiving system to treat further messages from this system appropriate (e.g. by laying out the user interface based on the autopilot). type : Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) (uint8_t) autopilot : Autopilot type / class. defined in MAV_AUTOPILOT ENUM (uint8_t) base_mode : System mode bitfield, see MAV_MODE_FLAGS ENUM in mavlink/include/mavlink_types.h (uint8_t) custom_mode : A bitfield for use for autopilot-specific flags. (uint32_t) system_status : System status flag, see MAV_STATE ENUM (uint8_t) mavlink_version : MAVLink version (uint8_t)
def heartbeat_send(self, type, autopilot, base_mode, custom_mode, system_status, mavlink_version=2, force_mavlink1=False): ''' The heartbeat message shows that a system is present and responding. The type of the MAV and Autopilot hardware allow the receiving system to treat further messages from this system appropriate (e.g. by laying out the user interface based on the autopilot). type : Type of the MAV (quadrotor, helicopter, etc., up to 15 types, defined in MAV_TYPE ENUM) (uint8_t) autopilot : Autopilot type / class. defined in MAV_AUTOPILOT ENUM (uint8_t) base_mode : System mode bitfield, see MAV_MODE_FLAGS ENUM in mavlink/include/mavlink_types.h (uint8_t) custom_mode : A bitfield for use for autopilot-specific flags. (uint32_t) system_status : System status flag, see MAV_STATE ENUM (uint8_t) mavlink_version : MAVLink version (uint8_t) ''' return self.send(self.heartbeat_encode(type, autopilot, base_mode, custom_mode, system_status, mavlink_version), force_mavlink1=force_mavlink1)
disarm motors
def cmd_disarm(self, args): '''disarm motors''' p2 = 0 if len(args) == 1 and args[0] == 'force': p2 = 21196 self.master.mav.command_long_send( self.target_system, # target_system 0, mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, # command 0, # confirmation 0, # param1 (0 to indicate disarm) p2, # param2 (all other params meaningless) 0, # param3 0, # param4 0, # param5 0, # param6 0)
Sends up to 20 raw float values. Index : Index of message (uint16_t) value1 : value1 (float) value2 : value2 (float) value3 : value3 (float) value4 : value4 (float) value5 : value5 (float) value6 : value6 (float) value7 : value7 (float) value8 : value8 (float) value9 : value9 (float) value10 : value10 (float) value11 : value11 (float) value12 : value12 (float) value13 : value13 (float) value14 : value14 (float) value15 : value15 (float) value16 : value16 (float) value17 : value17 (float) value18 : value18 (float) value19 : value19 (float) value20 : value20 (float)
def aq_telemetry_f_encode(self, Index, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20): ''' Sends up to 20 raw float values. Index : Index of message (uint16_t) value1 : value1 (float) value2 : value2 (float) value3 : value3 (float) value4 : value4 (float) value5 : value5 (float) value6 : value6 (float) value7 : value7 (float) value8 : value8 (float) value9 : value9 (float) value10 : value10 (float) value11 : value11 (float) value12 : value12 (float) value13 : value13 (float) value14 : value14 (float) value15 : value15 (float) value16 : value16 (float) value17 : value17 (float) value18 : value18 (float) value19 : value19 (float) value20 : value20 (float) ''' return MAVLink_aq_telemetry_f_message(Index, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16, value17, value18, value19, value20)
Sends ESC32 telemetry data for up to 4 motors. Multiple messages may be sent in sequence when system has > 4 motors. Data is described as follows: // unsigned int state : 3; // unsigned int vin : 12; // x 100 // unsigned int amps : 14; // x 100 // unsigned int rpm : 15; // unsigned int duty : 8; // x (255/100) // - Data Version 2 - // unsigned int errors : 9; // Bad detects error count // - Data Version 3 - // unsigned int temp : 9; // (Deg C + 32) * 4 // unsigned int errCode : 3; time_boot_ms : Timestamp of the component clock since boot time in ms. (uint32_t) seq : Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). (uint8_t) num_motors : Total number of active ESCs/motors on the system. (uint8_t) num_in_seq : Number of active ESCs in this sequence (1 through this many array members will be populated with data) (uint8_t) escid : ESC/Motor ID (uint8_t) status_age : Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. (uint16_t) data_version : Version of data structure (determines contents). (uint8_t) data0 : Data bits 1-32 for each ESC. (uint32_t) data1 : Data bits 33-64 for each ESC. (uint32_t)
def aq_esc_telemetry_encode(self, time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1): ''' Sends ESC32 telemetry data for up to 4 motors. Multiple messages may be sent in sequence when system has > 4 motors. Data is described as follows: // unsigned int state : 3; // unsigned int vin : 12; // x 100 // unsigned int amps : 14; // x 100 // unsigned int rpm : 15; // unsigned int duty : 8; // x (255/100) // - Data Version 2 - // unsigned int errors : 9; // Bad detects error count // - Data Version 3 - // unsigned int temp : 9; // (Deg C + 32) * 4 // unsigned int errCode : 3; time_boot_ms : Timestamp of the component clock since boot time in ms. (uint32_t) seq : Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). (uint8_t) num_motors : Total number of active ESCs/motors on the system. (uint8_t) num_in_seq : Number of active ESCs in this sequence (1 through this many array members will be populated with data) (uint8_t) escid : ESC/Motor ID (uint8_t) status_age : Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. (uint16_t) data_version : Version of data structure (determines contents). (uint8_t) data0 : Data bits 1-32 for each ESC. (uint32_t) data1 : Data bits 33-64 for each ESC. (uint32_t) ''' return MAVLink_aq_esc_telemetry_message(time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1)
Sends ESC32 telemetry data for up to 4 motors. Multiple messages may be sent in sequence when system has > 4 motors. Data is described as follows: // unsigned int state : 3; // unsigned int vin : 12; // x 100 // unsigned int amps : 14; // x 100 // unsigned int rpm : 15; // unsigned int duty : 8; // x (255/100) // - Data Version 2 - // unsigned int errors : 9; // Bad detects error count // - Data Version 3 - // unsigned int temp : 9; // (Deg C + 32) * 4 // unsigned int errCode : 3; time_boot_ms : Timestamp of the component clock since boot time in ms. (uint32_t) seq : Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). (uint8_t) num_motors : Total number of active ESCs/motors on the system. (uint8_t) num_in_seq : Number of active ESCs in this sequence (1 through this many array members will be populated with data) (uint8_t) escid : ESC/Motor ID (uint8_t) status_age : Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. (uint16_t) data_version : Version of data structure (determines contents). (uint8_t) data0 : Data bits 1-32 for each ESC. (uint32_t) data1 : Data bits 33-64 for each ESC. (uint32_t)
def aq_esc_telemetry_send(self, time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1, force_mavlink1=False): ''' Sends ESC32 telemetry data for up to 4 motors. Multiple messages may be sent in sequence when system has > 4 motors. Data is described as follows: // unsigned int state : 3; // unsigned int vin : 12; // x 100 // unsigned int amps : 14; // x 100 // unsigned int rpm : 15; // unsigned int duty : 8; // x (255/100) // - Data Version 2 - // unsigned int errors : 9; // Bad detects error count // - Data Version 3 - // unsigned int temp : 9; // (Deg C + 32) * 4 // unsigned int errCode : 3; time_boot_ms : Timestamp of the component clock since boot time in ms. (uint32_t) seq : Sequence number of message (first set of 4 motors is #1, next 4 is #2, etc). (uint8_t) num_motors : Total number of active ESCs/motors on the system. (uint8_t) num_in_seq : Number of active ESCs in this sequence (1 through this many array members will be populated with data) (uint8_t) escid : ESC/Motor ID (uint8_t) status_age : Age of each ESC telemetry reading in ms compared to boot time. A value of 0xFFFF means timeout/no data. (uint16_t) data_version : Version of data structure (determines contents). (uint8_t) data0 : Data bits 1-32 for each ESC. (uint32_t) data1 : Data bits 33-64 for each ESC. (uint32_t) ''' return self.send(self.aq_esc_telemetry_encode(time_boot_ms, seq, num_motors, num_in_seq, escid, status_age, data_version, data0, data1), force_mavlink1=force_mavlink1)
child process - this holds all the GUI elements
def child_task(self): '''child process - this holds all the GUI elements''' self.parent_pipe_send.close() self.parent_pipe_recv.close() import wx_processguard from wx_loader import wx from wxconsole_ui import ConsoleFrame app = wx.App(False) app.frame = ConsoleFrame(state=self, title=self.title) app.frame.Show() app.MainLoop()
watch for menu events from child
def watch_thread(self): '''watch for menu events from child''' from mp_settings import MPSetting try: while True: msg = self.parent_pipe_recv.recv() if self.menu_callback is not None: self.menu_callback(msg) time.sleep(0.1) except EOFError: pass
write to the console
def write(self, text, fg='black', bg='white'): '''write to the console''' try: self.parent_pipe_send.send(Text(text, fg, bg)) except Exception: pass
set a status value
def set_status(self, name, text='', row=0, fg='black', bg='white'): '''set a status value''' if self.is_alive(): self.parent_pipe_send.send(Value(name, text, row, fg, bg))
close the console
def close(self): '''close the console''' self.close_event.set() if self.is_alive(): self.child.join(2)
Radio buttons for Original/RGB/HSV/YUV images
def initUI(self): #self.setMinimumSize(WIDTH,HEIGTH) #self.setMaximumSize(WIDTH,HEIGTH) '''Radio buttons for Original/RGB/HSV/YUV images''' self.origButton = QRadioButton("Original") self.rgbButton = QRadioButton("RGB") self.hsvButton = QRadioButton("HSV") self.yuvButton = QRadioButton("YUV") '''HSV status scheck''' self.hsvCheck = QCheckBox('HSV Color Disc') self.hsvCheck.setObjectName("hsvCheck") self.hsvCheck.stateChanged.connect(self.showHSVWidget) '''Signals for toggled radio buttons''' self.origButton.toggled.connect(lambda:self.origButtonState()) self.rgbButton.toggled.connect(lambda:self.rgbButtonState()) self.hsvButton.toggled.connect(lambda:self.hsvButtonState()) self.yuvButton.toggled.connect(lambda:self.yuvButtonState()) self.origButton.setChecked(True) '''Main layout of the widget will contain several vertical layouts''' self.gLayout = QGridLayout(self) self.gLayout.setObjectName("gLayout") ''' Vertical Layout for radio buttons ''' self.radio1Layout = QHBoxLayout() self.radio2Layout = QVBoxLayout() self.radio3Layout = QVBoxLayout() self.radioLayout = QVBoxLayout() self.radioLayout.setObjectName("radioLayout") self.radio1Layout.addWidget(self.origButton) self.radio1Layout.addWidget(self.rgbButton) self.radio1Layout.addWidget(self.hsvButton) self.radio1Layout.addWidget(self.yuvButton) self.radio1Layout.addWidget(self.hsvCheck) #self.radio1Layout.addLayout(self.radio2Layout) #self.radio1Layout.addLayout(self.radio3Layout) self.radioLayout.addLayout(self.radio1Layout) self.vSpacer = QSpacerItem(10, 10, QSizePolicy.Ignored, QSizePolicy.Ignored); self.radioLayout.addItem(self.vSpacer) hmin,smin,vmin = HSVMIN hmax,smax,vmax = HSVMAX ''' Vertical Layout for HMIN Slider''' self.hminLayout = QVBoxLayout() self.hminLayout.setObjectName("hminLayout") self.hminLabel = QLabel("HMin") self.hminValue = QLineEdit(str(hmin),self) self.hminValue.setValidator(QIntValidator(hmin, hmax, self)); self.hminValue.setFixedWidth(40) self.hminValue.setFixedHeight(27) self.hminValue.setAlignment(Qt.AlignCenter); self.hminSlider = QSlider(Qt.Vertical) self.hminSlider.setMinimum(hmin) self.hminSlider.setMaximum(hmax) self.hminSlider.setValue(hmin) self.hminLayout.addWidget(self.hminLabel, Qt.AlignCenter) self.hminLayout.addWidget(self.hminValue,Qt.AlignCenter) self.hminLayout.addWidget(self.hminSlider) ''' Vertical Layout for HMAX Slider''' self.hmaxLayout = QVBoxLayout() self.hmaxLayout.setObjectName("hmaxLayout") self.hmaxLabel = QLabel("HMax") self.hmaxValue = QLineEdit(str(hmax),self) self.hmaxValue.setValidator(QIntValidator(hmin, hmax, self)); self.hmaxValue.setFixedWidth(40) self.hmaxValue.setFixedHeight(27) self.hmaxValue.setAlignment(Qt.AlignCenter); self.hmaxSlider = QSlider(Qt.Vertical) self.hmaxSlider.setMinimum(hmin) self.hmaxSlider.setMaximum(hmax) self.hmaxSlider.setValue(hmax) self.hmaxLayout.addWidget(self.hmaxLabel) self.hmaxLayout.addWidget(self.hmaxValue) self.hmaxLayout.addWidget(self.hmaxSlider) ''' Vertical Layout for SMIN Slider''' self.sminLayout = QVBoxLayout() self.sminLayout.setObjectName("sminLayout") self.sminLabel = QLabel("SMin") self.sminValue = QLineEdit(str(smin),self) self.sminValue.setValidator(QIntValidator(smin, smax, self)); self.sminValue.setFixedWidth(40) self.sminValue.setFixedHeight(27) self.sminValue.setAlignment(Qt.AlignCenter); self.sminSlider = QSlider(Qt.Vertical) self.sminSlider.setMinimum(smin) self.sminSlider.setMaximum(smax) self.sminSlider.setValue(smin) self.sminLayout.addWidget(self.sminLabel) self.sminLayout.addWidget(self.sminValue) self.sminLayout.addWidget(self.sminSlider) ''' Vertical Layout for SMAX Slider''' self.smaxLayout = QVBoxLayout() self.smaxLayout.setObjectName("smaxLayout") self.smaxLabel = QLabel("SMax") self.smaxValue = QLineEdit(str(smax),self) self.smaxValue.setValidator(QIntValidator(smin, smax, self)); self.smaxValue.setFixedWidth(40) self.smaxValue.setFixedHeight(27) self.smaxValue.setAlignment(Qt.AlignCenter); self.smaxSlider = QSlider(Qt.Vertical) self.smaxSlider.setMinimum(smin) self.smaxSlider.setMaximum(smax) self.smaxSlider.setValue(smax) self.smaxLayout.addWidget(self.smaxLabel) self.smaxLayout.addWidget(self.smaxValue) self.smaxLayout.addWidget(self.smaxSlider) ''' Vertical Layout for VMIN Slider''' self.vminLayout = QVBoxLayout() self.vminLayout.setObjectName("vminLayout") self.vminLabel = QLabel("VMin") self.vminValue = QLineEdit(str(vmin),self) self.vminValue.setValidator(QIntValidator(vmin, vmax, self)); self.vminValue.setFixedWidth(40) self.vminValue.setFixedHeight(27) self.vminValue.setAlignment(Qt.AlignCenter); self.vminSlider = QSlider(Qt.Vertical) self.vminSlider.setMinimum(vmin) self.vminSlider.setMaximum(vmax) self.vminSlider.setValue(vmin) self.vminLayout.addWidget(self.vminLabel) self.vminLayout.addWidget(self.vminValue) self.vminLayout.addWidget(self.vminSlider) ''' Vertical Layout for VMAX Slider''' self.vmaxLayout = QVBoxLayout() self.vmaxLayout.setObjectName("vmaxLayout") self.vmaxLabel = QLabel("VMax") self.vmaxValue = QLineEdit(str(vmax),self) self.vmaxValue.setValidator(QIntValidator(vmin, vmax, self)); self.vmaxValue.setFixedWidth(40) self.vmaxValue.setFixedHeight(27) self.vmaxValue.setAlignment(Qt.AlignCenter); self.vmaxSlider = QSlider(Qt.Vertical) self.vmaxSlider.setMinimum(vmin) self.vmaxSlider.setMaximum(vmax) self.vmaxSlider.setValue(vmax) self.vmaxLayout.addWidget(self.vmaxLabel) self.vmaxLayout.addWidget(self.vmaxValue) self.vmaxLayout.addWidget(self.vmaxSlider) '''Adding all the vertical layouts to the main horizontal layout''' self.gLayout.addLayout(self.radioLayout,1,0,1,6,Qt.AlignCenter) self.gLayout.addLayout(self.hminLayout,2,0,Qt.AlignCenter) self.gLayout.addLayout(self.hmaxLayout,2,1,Qt.AlignCenter) self.gLayout.addLayout(self.sminLayout,2,2,Qt.AlignCenter) self.gLayout.addLayout(self.smaxLayout,2,3,Qt.AlignCenter) self.gLayout.addLayout(self.vminLayout,2,4,Qt.AlignCenter) self.gLayout.addLayout(self.vmaxLayout,2,5,Qt.AlignCenter) self.setLayout(self.gLayout) '''Signals for sliders value changes''' self.hminSlider.valueChanged.connect(self.changeHmin) self.hmaxSlider.valueChanged.connect(self.changeHmax) self.sminSlider.valueChanged.connect(self.changeSmin) self.smaxSlider.valueChanged.connect(self.changeSmax) self.vminSlider.valueChanged.connect(self.changeVmin) self.vmaxSlider.valueChanged.connect(self.changeVmax) self.hminValue.textChanged.connect(self.changeHmin2) self.hmaxValue.textChanged.connect(self.changeHmax2) self.sminValue.textChanged.connect(self.changeSmin2) self.smaxValue.textChanged.connect(self.changeSmax2) self.vminValue.textChanged.connect(self.changeVmin2) self.vmaxValue.textChanged.connect(self.changeVmax2)
called on idle
def idle_task(self): '''called on idle''' if self.module('console') is not None and not self.menu_added_console: self.menu_added_console = True self.module('console').add_menu(self.menu) if self.module('map') is not None and not self.menu_added_map: self.menu_added_map = True self.module('map').add_menu(self.menu) '''handle abort command; it is critical that the AP to receive it''' if self.abort_ack_received is False: #only send abort every second (be insistent, but don't spam) if (time.time() - self.abort_previous_send_time > 1): self.master.mav.command_long_send(self.settings.target_system, self.settings.target_component, mavutil.mavlink.MAV_CMD_DO_GO_AROUND, 0, int(self.abort_alt), 0, 0, 0, 0, 0, 0,) self.abort_previous_send_time = time.time() #try to get an ACK from the plane: if self.abort_first_send_time == 0: self.abort_first_send_time = time.time() elif time.time() - self.abort_first_send_time > 10: #give up after 10 seconds print ("Unable to send abort command!\n") self.abort_ack_received = True
handle rally alt change
def cmd_rally_alt(self, args): '''handle rally alt change''' if (len(args) < 2): print("Usage: rally alt RALLYNUM newAlt <newBreakAlt>") return if not self.have_list: print("Please list rally points first") return idx = int(args[0]) if idx <= 0 or idx > self.rallyloader.rally_count(): print("Invalid rally point number %u" % idx) return new_alt = int(args[1]) new_break_alt = None if (len(args) > 2): new_break_alt = int(args[2]) self.rallyloader.set_alt(idx, new_alt, new_break_alt) self.send_rally_point(idx-1) self.fetch_rally_point(idx-1) self.rallyloader.reindex()
handle rally add
def cmd_rally_add(self, args): '''handle rally add''' if len(args) < 1: alt = self.settings.rallyalt else: alt = float(args[0]) if len(args) < 2: break_alt = self.settings.rally_breakalt else: break_alt = float(args[1]) if len(args) < 3: flag = self.settings.rally_flags else: flag = int(args[2]) #currently only supporting autoland values: #True (nonzero) and False (zero) if (flag != 0): flag = 2 if not self.have_list: print("Please list rally points first") return if (self.rallyloader.rally_count() > 4): print ("Only 5 rally points possible per flight plan.") return try: latlon = self.module('map').click_position except Exception: print("No map available") return if latlon is None: print("No map click position available") return land_hdg = 0.0 self.rallyloader.create_and_append_rally_point(latlon[0] * 1e7, latlon[1] * 1e7, alt, break_alt, land_hdg, flag) self.send_rally_points() print("Added Rally point at %s %f %f, autoland: %s" % (str(latlon), alt, break_alt, bool(flag & 2)))
handle rally move
def cmd_rally_move(self, args): '''handle rally move''' if len(args) < 1: print("Usage: rally move RALLYNUM") return if not self.have_list: print("Please list rally points first") return idx = int(args[0]) if idx <= 0 or idx > self.rallyloader.rally_count(): print("Invalid rally point number %u" % idx) return rpoint = self.rallyloader.rally_point(idx-1) try: latlon = self.module('map').click_position except Exception: print("No map available") return if latlon is None: print("No map click position available") return oldpos = (rpoint.lat*1e-7, rpoint.lng*1e-7) self.rallyloader.move(idx, latlon[0], latlon[1]) self.send_rally_point(idx-1) p = self.fetch_rally_point(idx-1) if p.lat != int(latlon[0]*1e7) or p.lng != int(latlon[1]*1e7): print("Rally move failed") return self.rallyloader.reindex() print("Moved rally point from %s to %s at %fm" % (str(oldpos), str(latlon), rpoint.alt))
rally point commands
def cmd_rally(self, args): '''rally point commands''' #TODO: add_land arg if len(args) < 1: self.print_usage() return elif args[0] == "add": self.cmd_rally_add(args[1:]) elif args[0] == "move": self.cmd_rally_move(args[1:]) elif args[0] == "clear": self.rallyloader.clear() self.mav_param.mavset(self.master,'RALLY_TOTAL',0,3) elif args[0] == "remove": if not self.have_list: print("Please list rally points first") return if (len(args) < 2): print("Usage: rally remove RALLYNUM") return self.rallyloader.remove(int(args[1])) self.send_rally_points() elif args[0] == "list": self.list_rally_points() self.have_list = True elif args[0] == "load": if (len(args) < 2): print("Usage: rally load filename") return try: self.rallyloader.load(args[1]) except Exception as msg: print("Unable to load %s - %s" % (args[1], msg)) return self.send_rally_points() self.have_list = True print("Loaded %u rally points from %s" % (self.rallyloader.rally_count(), args[1])) elif args[0] == "save": if (len(args) < 2): print("Usage: rally save filename") return self.rallyloader.save(args[1]) print("Saved rally file %s" % args[1]) elif args[0] == "alt": self.cmd_rally_alt(args[1:]) elif args[0] == "land": if (len(args) >= 2 and args[1] == "abort"): self.abort_ack_received = False self.abort_first_send_time = 0 self.abort_alt = self.settings.rally_breakalt if (len(args) >= 3): self.abort_alt = int(args[2]) else: self.master.mav.command_long_send(self.settings.target_system, self.settings.target_component, mavutil.mavlink.MAV_CMD_DO_RALLY_LAND, 0, 0, 0, 0, 0, 0, 0, 0) else: self.print_usage()
handle incoming mavlink packet
def mavlink_packet(self, m): '''handle incoming mavlink packet''' type = m.get_type() if type in ['COMMAND_ACK']: if m.command == mavutil.mavlink.MAV_CMD_DO_GO_AROUND: if (m.result == 0 and self.abort_ack_received == False): self.say("Landing Abort Command Successfully Sent.") self.abort_ack_received = True elif (m.result != 0 and self.abort_ack_received == False): self.say("Landing Abort Command Unsuccessful.") elif m.command == mavutil.mavlink.MAV_CMD_DO_RALLY_LAND: if (m.result == 0): self.say("Landing.")
send rally points from fenceloader
def send_rally_point(self, i): '''send rally points from fenceloader''' p = self.rallyloader.rally_point(i) p.target_system = self.target_system p.target_component = self.target_component self.master.mav.send(p)
send rally points from rallyloader
def send_rally_points(self): '''send rally points from rallyloader''' self.mav_param.mavset(self.master,'RALLY_TOTAL',self.rallyloader.rally_count(),3) for i in range(self.rallyloader.rally_count()): self.send_rally_point(i)
Returns last Bumper. @return last JdeRobotTypes Bumper saved
def getBumper(self): ''' Returns last Bumper. @return last JdeRobotTypes Bumper saved ''' if self.hasproxy(): self.lock.acquire() bumper = self.bumper self.lock.release() return bumper return None
Translates from ROS Image to JderobotTypes Image. @param img: ROS Image to translate @param bridge: bridge to do translation @type img: sensor_msgs.msg.Image @type brige: CvBridge @return a JderobotTypes.Image translated from img
def imageMsg2Image(img, bridge): ''' Translates from ROS Image to JderobotTypes Image. @param img: ROS Image to translate @param bridge: bridge to do translation @type img: sensor_msgs.msg.Image @type brige: CvBridge @return a JderobotTypes.Image translated from img ''' image = Image() image.width = img.width image.height = img.height image.format = "RGB8" image.timeStamp = img.header.stamp.secs + (img.header.stamp.nsecs *1e-9) cv_image=0 if (img.encoding == "32FC1"): gray_img_buff = bridge.imgmsg_to_cv2(img, "32FC1") cv_image = depthToRGB8(gray_img_buff) else: cv_image = bridge.imgmsg_to_cv2(img, "rgb8") image.data = cv_image return image
Translates from ROS Images to JderobotTypes Rgbd. @param rgb: ROS color Image to translate @param d: ROS depth image to translate @type rgb: ImageROS @type d: ImageROS @return a Rgbd translated from Images
def Images2Rgbd(rgb, d): ''' Translates from ROS Images to JderobotTypes Rgbd. @param rgb: ROS color Image to translate @param d: ROS depth image to translate @type rgb: ImageROS @type d: ImageROS @return a Rgbd translated from Images ''' data = Rgbd() data.color=imageMsg2Image(rgb) data.depth=imageMsg2Image(d) data.timeStamp = rgb.header.stamp.secs + (rgb.header.stamp.nsecs *1e-9) return data
Callback function to receive and save Rgbd Scans. @param rgb: ROS color Image to translate @param d: ROS depth image to translate @type rgb: ImageROS @type d: ImageROS
def __callback (self, rgb, d): ''' Callback function to receive and save Rgbd Scans. @param rgb: ROS color Image to translate @param d: ROS depth image to translate @type rgb: ImageROS @type d: ImageROS ''' data = Images2Rgbd(rgb, d) self.lock.acquire() self.data = data self.lock.release()
Starts (Subscribes) the client.
def start (self): ''' Starts (Subscribes) the client. ''' self.subrgb = rospy.Subscriber(self.topicrgb, ImageROS) self.subd = rospy.Subscriber(self.topicd, ImageROS) self.ts = message_filters.ApproximateTimeSynchronizer([subrgb, subd], 1, 0.1, allow_headerless=True) self.ts.registerCallback(self.__callback)
Returns last RgbdData. @return last JdeRobotTypes Rgbd saved
def getRgbdData(self): ''' Returns last RgbdData. @return last JdeRobotTypes Rgbd saved ''' self.lock.acquire() data = self.data self.lock.release() return data
Offsets and calibrations values for hardware sensors. This makes it easier to debug the calibration process. mag_ofs_x : magnetometer X offset (int16_t) mag_ofs_y : magnetometer Y offset (int16_t) mag_ofs_z : magnetometer Z offset (int16_t) mag_declination : magnetic declination (radians) (float) raw_press : raw pressure from barometer (int32_t) raw_temp : raw temperature from barometer (int32_t) gyro_cal_x : gyro X calibration (float) gyro_cal_y : gyro Y calibration (float) gyro_cal_z : gyro Z calibration (float) accel_cal_x : accel X calibration (float) accel_cal_y : accel Y calibration (float) accel_cal_z : accel Z calibration (float)
def sensor_offsets_encode(self, mag_ofs_x, mag_ofs_y, mag_ofs_z, mag_declination, raw_press, raw_temp, gyro_cal_x, gyro_cal_y, gyro_cal_z, accel_cal_x, accel_cal_y, accel_cal_z): ''' Offsets and calibrations values for hardware sensors. This makes it easier to debug the calibration process. mag_ofs_x : magnetometer X offset (int16_t) mag_ofs_y : magnetometer Y offset (int16_t) mag_ofs_z : magnetometer Z offset (int16_t) mag_declination : magnetic declination (radians) (float) raw_press : raw pressure from barometer (int32_t) raw_temp : raw temperature from barometer (int32_t) gyro_cal_x : gyro X calibration (float) gyro_cal_y : gyro Y calibration (float) gyro_cal_z : gyro Z calibration (float) accel_cal_x : accel X calibration (float) accel_cal_y : accel Y calibration (float) accel_cal_z : accel Z calibration (float) ''' return MAVLink_sensor_offsets_message(mag_ofs_x, mag_ofs_y, mag_ofs_z, mag_declination, raw_press, raw_temp, gyro_cal_x, gyro_cal_y, gyro_cal_z, accel_cal_x, accel_cal_y, accel_cal_z)
Offsets and calibrations values for hardware sensors. This makes it easier to debug the calibration process. mag_ofs_x : magnetometer X offset (int16_t) mag_ofs_y : magnetometer Y offset (int16_t) mag_ofs_z : magnetometer Z offset (int16_t) mag_declination : magnetic declination (radians) (float) raw_press : raw pressure from barometer (int32_t) raw_temp : raw temperature from barometer (int32_t) gyro_cal_x : gyro X calibration (float) gyro_cal_y : gyro Y calibration (float) gyro_cal_z : gyro Z calibration (float) accel_cal_x : accel X calibration (float) accel_cal_y : accel Y calibration (float) accel_cal_z : accel Z calibration (float)
def sensor_offsets_send(self, mag_ofs_x, mag_ofs_y, mag_ofs_z, mag_declination, raw_press, raw_temp, gyro_cal_x, gyro_cal_y, gyro_cal_z, accel_cal_x, accel_cal_y, accel_cal_z, force_mavlink1=False): ''' Offsets and calibrations values for hardware sensors. This makes it easier to debug the calibration process. mag_ofs_x : magnetometer X offset (int16_t) mag_ofs_y : magnetometer Y offset (int16_t) mag_ofs_z : magnetometer Z offset (int16_t) mag_declination : magnetic declination (radians) (float) raw_press : raw pressure from barometer (int32_t) raw_temp : raw temperature from barometer (int32_t) gyro_cal_x : gyro X calibration (float) gyro_cal_y : gyro Y calibration (float) gyro_cal_z : gyro Z calibration (float) accel_cal_x : accel X calibration (float) accel_cal_y : accel Y calibration (float) accel_cal_z : accel Z calibration (float) ''' return self.send(self.sensor_offsets_encode(mag_ofs_x, mag_ofs_y, mag_ofs_z, mag_declination, raw_press, raw_temp, gyro_cal_x, gyro_cal_y, gyro_cal_z, accel_cal_x, accel_cal_y, accel_cal_z), force_mavlink1=force_mavlink1)
Deprecated. Use MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS instead. Set the magnetometer offsets target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mag_ofs_x : magnetometer X offset (int16_t) mag_ofs_y : magnetometer Y offset (int16_t) mag_ofs_z : magnetometer Z offset (int16_t)
def set_mag_offsets_encode(self, target_system, target_component, mag_ofs_x, mag_ofs_y, mag_ofs_z): ''' Deprecated. Use MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS instead. Set the magnetometer offsets target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mag_ofs_x : magnetometer X offset (int16_t) mag_ofs_y : magnetometer Y offset (int16_t) mag_ofs_z : magnetometer Z offset (int16_t) ''' return MAVLink_set_mag_offsets_message(target_system, target_component, mag_ofs_x, mag_ofs_y, mag_ofs_z)
Deprecated. Use MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS instead. Set the magnetometer offsets target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mag_ofs_x : magnetometer X offset (int16_t) mag_ofs_y : magnetometer Y offset (int16_t) mag_ofs_z : magnetometer Z offset (int16_t)
def set_mag_offsets_send(self, target_system, target_component, mag_ofs_x, mag_ofs_y, mag_ofs_z, force_mavlink1=False): ''' Deprecated. Use MAV_CMD_PREFLIGHT_SET_SENSOR_OFFSETS instead. Set the magnetometer offsets target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mag_ofs_x : magnetometer X offset (int16_t) mag_ofs_y : magnetometer Y offset (int16_t) mag_ofs_z : magnetometer Z offset (int16_t) ''' return self.send(self.set_mag_offsets_encode(target_system, target_component, mag_ofs_x, mag_ofs_y, mag_ofs_z), force_mavlink1=force_mavlink1)
raw ADC output adc1 : ADC output 1 (uint16_t) adc2 : ADC output 2 (uint16_t) adc3 : ADC output 3 (uint16_t) adc4 : ADC output 4 (uint16_t) adc5 : ADC output 5 (uint16_t) adc6 : ADC output 6 (uint16_t)
def ap_adc_encode(self, adc1, adc2, adc3, adc4, adc5, adc6): ''' raw ADC output adc1 : ADC output 1 (uint16_t) adc2 : ADC output 2 (uint16_t) adc3 : ADC output 3 (uint16_t) adc4 : ADC output 4 (uint16_t) adc5 : ADC output 5 (uint16_t) adc6 : ADC output 6 (uint16_t) ''' return MAVLink_ap_adc_message(adc1, adc2, adc3, adc4, adc5, adc6)
raw ADC output adc1 : ADC output 1 (uint16_t) adc2 : ADC output 2 (uint16_t) adc3 : ADC output 3 (uint16_t) adc4 : ADC output 4 (uint16_t) adc5 : ADC output 5 (uint16_t) adc6 : ADC output 6 (uint16_t)
def ap_adc_send(self, adc1, adc2, adc3, adc4, adc5, adc6, force_mavlink1=False): ''' raw ADC output adc1 : ADC output 1 (uint16_t) adc2 : ADC output 2 (uint16_t) adc3 : ADC output 3 (uint16_t) adc4 : ADC output 4 (uint16_t) adc5 : ADC output 5 (uint16_t) adc6 : ADC output 6 (uint16_t) ''' return self.send(self.ap_adc_encode(adc1, adc2, adc3, adc4, adc5, adc6), force_mavlink1=force_mavlink1)
Configure on-board Camera Control System. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mode : Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore) (uint8_t) shutter_speed : Divisor number //e.g. 1000 means 1/1000 (0 means ignore) (uint16_t) aperture : F stop number x 10 //e.g. 28 means 2.8 (0 means ignore) (uint8_t) iso : ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore) (uint8_t) exposure_type : Exposure type enumeration from 1 to N (0 means ignore) (uint8_t) command_id : Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once (uint8_t) engine_cut_off : Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off) (uint8_t) extra_param : Extra parameters enumeration (0 means ignore) (uint8_t) extra_value : Correspondent value to given extra_param (float)
def digicam_configure_encode(self, target_system, target_component, mode, shutter_speed, aperture, iso, exposure_type, command_id, engine_cut_off, extra_param, extra_value): ''' Configure on-board Camera Control System. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mode : Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore) (uint8_t) shutter_speed : Divisor number //e.g. 1000 means 1/1000 (0 means ignore) (uint16_t) aperture : F stop number x 10 //e.g. 28 means 2.8 (0 means ignore) (uint8_t) iso : ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore) (uint8_t) exposure_type : Exposure type enumeration from 1 to N (0 means ignore) (uint8_t) command_id : Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once (uint8_t) engine_cut_off : Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off) (uint8_t) extra_param : Extra parameters enumeration (0 means ignore) (uint8_t) extra_value : Correspondent value to given extra_param (float) ''' return MAVLink_digicam_configure_message(target_system, target_component, mode, shutter_speed, aperture, iso, exposure_type, command_id, engine_cut_off, extra_param, extra_value)
Configure on-board Camera Control System. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mode : Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore) (uint8_t) shutter_speed : Divisor number //e.g. 1000 means 1/1000 (0 means ignore) (uint16_t) aperture : F stop number x 10 //e.g. 28 means 2.8 (0 means ignore) (uint8_t) iso : ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore) (uint8_t) exposure_type : Exposure type enumeration from 1 to N (0 means ignore) (uint8_t) command_id : Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once (uint8_t) engine_cut_off : Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off) (uint8_t) extra_param : Extra parameters enumeration (0 means ignore) (uint8_t) extra_value : Correspondent value to given extra_param (float)
def digicam_configure_send(self, target_system, target_component, mode, shutter_speed, aperture, iso, exposure_type, command_id, engine_cut_off, extra_param, extra_value, force_mavlink1=False): ''' Configure on-board Camera Control System. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mode : Mode enumeration from 1 to N //P, TV, AV, M, Etc (0 means ignore) (uint8_t) shutter_speed : Divisor number //e.g. 1000 means 1/1000 (0 means ignore) (uint16_t) aperture : F stop number x 10 //e.g. 28 means 2.8 (0 means ignore) (uint8_t) iso : ISO enumeration from 1 to N //e.g. 80, 100, 200, Etc (0 means ignore) (uint8_t) exposure_type : Exposure type enumeration from 1 to N (0 means ignore) (uint8_t) command_id : Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once (uint8_t) engine_cut_off : Main engine cut-off time before camera trigger in seconds/10 (0 means no cut-off) (uint8_t) extra_param : Extra parameters enumeration (0 means ignore) (uint8_t) extra_value : Correspondent value to given extra_param (float) ''' return self.send(self.digicam_configure_encode(target_system, target_component, mode, shutter_speed, aperture, iso, exposure_type, command_id, engine_cut_off, extra_param, extra_value), force_mavlink1=force_mavlink1)
Control on-board Camera Control System to take shots. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) session : 0: stop, 1: start or keep it up //Session control e.g. show/hide lens (uint8_t) zoom_pos : 1 to N //Zoom's absolute position (0 means ignore) (uint8_t) zoom_step : -100 to 100 //Zooming step value to offset zoom from the current position (int8_t) focus_lock : 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus (uint8_t) shot : 0: ignore, 1: shot or start filming (uint8_t) command_id : Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once (uint8_t) extra_param : Extra parameters enumeration (0 means ignore) (uint8_t) extra_value : Correspondent value to given extra_param (float)
def digicam_control_encode(self, target_system, target_component, session, zoom_pos, zoom_step, focus_lock, shot, command_id, extra_param, extra_value): ''' Control on-board Camera Control System to take shots. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) session : 0: stop, 1: start or keep it up //Session control e.g. show/hide lens (uint8_t) zoom_pos : 1 to N //Zoom's absolute position (0 means ignore) (uint8_t) zoom_step : -100 to 100 //Zooming step value to offset zoom from the current position (int8_t) focus_lock : 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus (uint8_t) shot : 0: ignore, 1: shot or start filming (uint8_t) command_id : Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once (uint8_t) extra_param : Extra parameters enumeration (0 means ignore) (uint8_t) extra_value : Correspondent value to given extra_param (float) ''' return MAVLink_digicam_control_message(target_system, target_component, session, zoom_pos, zoom_step, focus_lock, shot, command_id, extra_param, extra_value)
Control on-board Camera Control System to take shots. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) session : 0: stop, 1: start or keep it up //Session control e.g. show/hide lens (uint8_t) zoom_pos : 1 to N //Zoom's absolute position (0 means ignore) (uint8_t) zoom_step : -100 to 100 //Zooming step value to offset zoom from the current position (int8_t) focus_lock : 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus (uint8_t) shot : 0: ignore, 1: shot or start filming (uint8_t) command_id : Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once (uint8_t) extra_param : Extra parameters enumeration (0 means ignore) (uint8_t) extra_value : Correspondent value to given extra_param (float)
def digicam_control_send(self, target_system, target_component, session, zoom_pos, zoom_step, focus_lock, shot, command_id, extra_param, extra_value, force_mavlink1=False): ''' Control on-board Camera Control System to take shots. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) session : 0: stop, 1: start or keep it up //Session control e.g. show/hide lens (uint8_t) zoom_pos : 1 to N //Zoom's absolute position (0 means ignore) (uint8_t) zoom_step : -100 to 100 //Zooming step value to offset zoom from the current position (int8_t) focus_lock : 0: unlock focus or keep unlocked, 1: lock focus or keep locked, 3: re-lock focus (uint8_t) shot : 0: ignore, 1: shot or start filming (uint8_t) command_id : Command Identity (incremental loop: 0 to 255)//A command sent multiple times will be executed or pooled just once (uint8_t) extra_param : Extra parameters enumeration (0 means ignore) (uint8_t) extra_value : Correspondent value to given extra_param (float) ''' return self.send(self.digicam_control_encode(target_system, target_component, session, zoom_pos, zoom_step, focus_lock, shot, command_id, extra_param, extra_value), force_mavlink1=force_mavlink1)
Message to configure a camera mount, directional antenna, etc. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mount_mode : mount operating mode (see MAV_MOUNT_MODE enum) (uint8_t) stab_roll : (1 = yes, 0 = no) (uint8_t) stab_pitch : (1 = yes, 0 = no) (uint8_t) stab_yaw : (1 = yes, 0 = no) (uint8_t)
def mount_configure_encode(self, target_system, target_component, mount_mode, stab_roll, stab_pitch, stab_yaw): ''' Message to configure a camera mount, directional antenna, etc. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mount_mode : mount operating mode (see MAV_MOUNT_MODE enum) (uint8_t) stab_roll : (1 = yes, 0 = no) (uint8_t) stab_pitch : (1 = yes, 0 = no) (uint8_t) stab_yaw : (1 = yes, 0 = no) (uint8_t) ''' return MAVLink_mount_configure_message(target_system, target_component, mount_mode, stab_roll, stab_pitch, stab_yaw)
Message to configure a camera mount, directional antenna, etc. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mount_mode : mount operating mode (see MAV_MOUNT_MODE enum) (uint8_t) stab_roll : (1 = yes, 0 = no) (uint8_t) stab_pitch : (1 = yes, 0 = no) (uint8_t) stab_yaw : (1 = yes, 0 = no) (uint8_t)
def mount_configure_send(self, target_system, target_component, mount_mode, stab_roll, stab_pitch, stab_yaw, force_mavlink1=False): ''' Message to configure a camera mount, directional antenna, etc. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) mount_mode : mount operating mode (see MAV_MOUNT_MODE enum) (uint8_t) stab_roll : (1 = yes, 0 = no) (uint8_t) stab_pitch : (1 = yes, 0 = no) (uint8_t) stab_yaw : (1 = yes, 0 = no) (uint8_t) ''' return self.send(self.mount_configure_encode(target_system, target_component, mount_mode, stab_roll, stab_pitch, stab_yaw), force_mavlink1=force_mavlink1)
Message to control a camera mount, directional antenna, etc. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) input_a : pitch(deg*100) or lat, depending on mount mode (int32_t) input_b : roll(deg*100) or lon depending on mount mode (int32_t) input_c : yaw(deg*100) or alt (in cm) depending on mount mode (int32_t) save_position : if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) (uint8_t)
def mount_control_encode(self, target_system, target_component, input_a, input_b, input_c, save_position): ''' Message to control a camera mount, directional antenna, etc. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) input_a : pitch(deg*100) or lat, depending on mount mode (int32_t) input_b : roll(deg*100) or lon depending on mount mode (int32_t) input_c : yaw(deg*100) or alt (in cm) depending on mount mode (int32_t) save_position : if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) (uint8_t) ''' return MAVLink_mount_control_message(target_system, target_component, input_a, input_b, input_c, save_position)
Message to control a camera mount, directional antenna, etc. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) input_a : pitch(deg*100) or lat, depending on mount mode (int32_t) input_b : roll(deg*100) or lon depending on mount mode (int32_t) input_c : yaw(deg*100) or alt (in cm) depending on mount mode (int32_t) save_position : if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) (uint8_t)
def mount_control_send(self, target_system, target_component, input_a, input_b, input_c, save_position, force_mavlink1=False): ''' Message to control a camera mount, directional antenna, etc. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) input_a : pitch(deg*100) or lat, depending on mount mode (int32_t) input_b : roll(deg*100) or lon depending on mount mode (int32_t) input_c : yaw(deg*100) or alt (in cm) depending on mount mode (int32_t) save_position : if "1" it will save current trimmed position on EEPROM (just valid for NEUTRAL and LANDING) (uint8_t) ''' return self.send(self.mount_control_encode(target_system, target_component, input_a, input_b, input_c, save_position), force_mavlink1=force_mavlink1)
Message with some status from APM to GCS about camera or antenna mount target_system : System ID (uint8_t) target_component : Component ID (uint8_t) pointing_a : pitch(deg*100) (int32_t) pointing_b : roll(deg*100) (int32_t) pointing_c : yaw(deg*100) (int32_t)
def mount_status_encode(self, target_system, target_component, pointing_a, pointing_b, pointing_c): ''' Message with some status from APM to GCS about camera or antenna mount target_system : System ID (uint8_t) target_component : Component ID (uint8_t) pointing_a : pitch(deg*100) (int32_t) pointing_b : roll(deg*100) (int32_t) pointing_c : yaw(deg*100) (int32_t) ''' return MAVLink_mount_status_message(target_system, target_component, pointing_a, pointing_b, pointing_c)
Message with some status from APM to GCS about camera or antenna mount target_system : System ID (uint8_t) target_component : Component ID (uint8_t) pointing_a : pitch(deg*100) (int32_t) pointing_b : roll(deg*100) (int32_t) pointing_c : yaw(deg*100) (int32_t)
def mount_status_send(self, target_system, target_component, pointing_a, pointing_b, pointing_c, force_mavlink1=False): ''' Message with some status from APM to GCS about camera or antenna mount target_system : System ID (uint8_t) target_component : Component ID (uint8_t) pointing_a : pitch(deg*100) (int32_t) pointing_b : roll(deg*100) (int32_t) pointing_c : yaw(deg*100) (int32_t) ''' return self.send(self.mount_status_encode(target_system, target_component, pointing_a, pointing_b, pointing_c), force_mavlink1=force_mavlink1)
A fence point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 1, 0 is for return point) (uint8_t) count : total number of points (for sanity checking) (uint8_t) lat : Latitude of point (float) lng : Longitude of point (float)
def fence_point_encode(self, target_system, target_component, idx, count, lat, lng): ''' A fence point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 1, 0 is for return point) (uint8_t) count : total number of points (for sanity checking) (uint8_t) lat : Latitude of point (float) lng : Longitude of point (float) ''' return MAVLink_fence_point_message(target_system, target_component, idx, count, lat, lng)
A fence point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 1, 0 is for return point) (uint8_t) count : total number of points (for sanity checking) (uint8_t) lat : Latitude of point (float) lng : Longitude of point (float)
def fence_point_send(self, target_system, target_component, idx, count, lat, lng, force_mavlink1=False): ''' A fence point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 1, 0 is for return point) (uint8_t) count : total number of points (for sanity checking) (uint8_t) lat : Latitude of point (float) lng : Longitude of point (float) ''' return self.send(self.fence_point_encode(target_system, target_component, idx, count, lat, lng), force_mavlink1=force_mavlink1)
Request a current fence point from MAV target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 1, 0 is for return point) (uint8_t)
def fence_fetch_point_send(self, target_system, target_component, idx, force_mavlink1=False): ''' Request a current fence point from MAV target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 1, 0 is for return point) (uint8_t) ''' return self.send(self.fence_fetch_point_encode(target_system, target_component, idx), force_mavlink1=force_mavlink1)
Status of geo-fencing. Sent in extended status stream when fencing enabled breach_status : 0 if currently inside fence, 1 if outside (uint8_t) breach_count : number of fence breaches (uint16_t) breach_type : last breach type (see FENCE_BREACH_* enum) (uint8_t) breach_time : time of last breach in milliseconds since boot (uint32_t)
def fence_status_encode(self, breach_status, breach_count, breach_type, breach_time): ''' Status of geo-fencing. Sent in extended status stream when fencing enabled breach_status : 0 if currently inside fence, 1 if outside (uint8_t) breach_count : number of fence breaches (uint16_t) breach_type : last breach type (see FENCE_BREACH_* enum) (uint8_t) breach_time : time of last breach in milliseconds since boot (uint32_t) ''' return MAVLink_fence_status_message(breach_status, breach_count, breach_type, breach_time)
Status of geo-fencing. Sent in extended status stream when fencing enabled breach_status : 0 if currently inside fence, 1 if outside (uint8_t) breach_count : number of fence breaches (uint16_t) breach_type : last breach type (see FENCE_BREACH_* enum) (uint8_t) breach_time : time of last breach in milliseconds since boot (uint32_t)
def fence_status_send(self, breach_status, breach_count, breach_type, breach_time, force_mavlink1=False): ''' Status of geo-fencing. Sent in extended status stream when fencing enabled breach_status : 0 if currently inside fence, 1 if outside (uint8_t) breach_count : number of fence breaches (uint16_t) breach_type : last breach type (see FENCE_BREACH_* enum) (uint8_t) breach_time : time of last breach in milliseconds since boot (uint32_t) ''' return self.send(self.fence_status_encode(breach_status, breach_count, breach_type, breach_time), force_mavlink1=force_mavlink1)
Status of DCM attitude estimator omegaIx : X gyro drift estimate rad/s (float) omegaIy : Y gyro drift estimate rad/s (float) omegaIz : Z gyro drift estimate rad/s (float) accel_weight : average accel_weight (float) renorm_val : average renormalisation value (float) error_rp : average error_roll_pitch value (float) error_yaw : average error_yaw value (float)
def ahrs_encode(self, omegaIx, omegaIy, omegaIz, accel_weight, renorm_val, error_rp, error_yaw): ''' Status of DCM attitude estimator omegaIx : X gyro drift estimate rad/s (float) omegaIy : Y gyro drift estimate rad/s (float) omegaIz : Z gyro drift estimate rad/s (float) accel_weight : average accel_weight (float) renorm_val : average renormalisation value (float) error_rp : average error_roll_pitch value (float) error_yaw : average error_yaw value (float) ''' return MAVLink_ahrs_message(omegaIx, omegaIy, omegaIz, accel_weight, renorm_val, error_rp, error_yaw)
Status of DCM attitude estimator omegaIx : X gyro drift estimate rad/s (float) omegaIy : Y gyro drift estimate rad/s (float) omegaIz : Z gyro drift estimate rad/s (float) accel_weight : average accel_weight (float) renorm_val : average renormalisation value (float) error_rp : average error_roll_pitch value (float) error_yaw : average error_yaw value (float)
def ahrs_send(self, omegaIx, omegaIy, omegaIz, accel_weight, renorm_val, error_rp, error_yaw, force_mavlink1=False): ''' Status of DCM attitude estimator omegaIx : X gyro drift estimate rad/s (float) omegaIy : Y gyro drift estimate rad/s (float) omegaIz : Z gyro drift estimate rad/s (float) accel_weight : average accel_weight (float) renorm_val : average renormalisation value (float) error_rp : average error_roll_pitch value (float) error_yaw : average error_yaw value (float) ''' return self.send(self.ahrs_encode(omegaIx, omegaIy, omegaIz, accel_weight, renorm_val, error_rp, error_yaw), force_mavlink1=force_mavlink1)
Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) xacc : X acceleration m/s/s (float) yacc : Y acceleration m/s/s (float) zacc : Z acceleration m/s/s (float) xgyro : Angular speed around X axis rad/s (float) ygyro : Angular speed around Y axis rad/s (float) zgyro : Angular speed around Z axis rad/s (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t)
def simstate_encode(self, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lng): ''' Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) xacc : X acceleration m/s/s (float) yacc : Y acceleration m/s/s (float) zacc : Z acceleration m/s/s (float) xgyro : Angular speed around X axis rad/s (float) ygyro : Angular speed around Y axis rad/s (float) zgyro : Angular speed around Z axis rad/s (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t) ''' return MAVLink_simstate_message(roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lng)
Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) xacc : X acceleration m/s/s (float) yacc : Y acceleration m/s/s (float) zacc : Z acceleration m/s/s (float) xgyro : Angular speed around X axis rad/s (float) ygyro : Angular speed around Y axis rad/s (float) zgyro : Angular speed around Z axis rad/s (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t)
def simstate_send(self, roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lng, force_mavlink1=False): ''' Status of simulation environment, if used roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) xacc : X acceleration m/s/s (float) yacc : Y acceleration m/s/s (float) zacc : Z acceleration m/s/s (float) xgyro : Angular speed around X axis rad/s (float) ygyro : Angular speed around Y axis rad/s (float) zgyro : Angular speed around Z axis rad/s (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t) ''' return self.send(self.simstate_encode(roll, pitch, yaw, xacc, yacc, zacc, xgyro, ygyro, zgyro, lat, lng), force_mavlink1=force_mavlink1)
Status of key hardware Vcc : board voltage (mV) (uint16_t) I2Cerr : I2C error count (uint8_t)
def hwstatus_send(self, Vcc, I2Cerr, force_mavlink1=False): ''' Status of key hardware Vcc : board voltage (mV) (uint16_t) I2Cerr : I2C error count (uint8_t) ''' return self.send(self.hwstatus_encode(Vcc, I2Cerr), force_mavlink1=force_mavlink1)
Status generated by radio rssi : local signal strength (uint8_t) remrssi : remote signal strength (uint8_t) txbuf : how full the tx buffer is as a percentage (uint8_t) noise : background noise level (uint8_t) remnoise : remote background noise level (uint8_t) rxerrors : receive errors (uint16_t) fixed : count of error corrected packets (uint16_t)
def radio_encode(self, rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed): ''' Status generated by radio rssi : local signal strength (uint8_t) remrssi : remote signal strength (uint8_t) txbuf : how full the tx buffer is as a percentage (uint8_t) noise : background noise level (uint8_t) remnoise : remote background noise level (uint8_t) rxerrors : receive errors (uint16_t) fixed : count of error corrected packets (uint16_t) ''' return MAVLink_radio_message(rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed)
Status generated by radio rssi : local signal strength (uint8_t) remrssi : remote signal strength (uint8_t) txbuf : how full the tx buffer is as a percentage (uint8_t) noise : background noise level (uint8_t) remnoise : remote background noise level (uint8_t) rxerrors : receive errors (uint16_t) fixed : count of error corrected packets (uint16_t)
def radio_send(self, rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed, force_mavlink1=False): ''' Status generated by radio rssi : local signal strength (uint8_t) remrssi : remote signal strength (uint8_t) txbuf : how full the tx buffer is as a percentage (uint8_t) noise : background noise level (uint8_t) remnoise : remote background noise level (uint8_t) rxerrors : receive errors (uint16_t) fixed : count of error corrected packets (uint16_t) ''' return self.send(self.radio_encode(rssi, remrssi, txbuf, noise, remnoise, rxerrors, fixed), force_mavlink1=force_mavlink1)
Status of AP_Limits. Sent in extended status stream when AP_Limits is enabled limits_state : state of AP_Limits, (see enum LimitState, LIMITS_STATE) (uint8_t) last_trigger : time of last breach in milliseconds since boot (uint32_t) last_action : time of last recovery action in milliseconds since boot (uint32_t) last_recovery : time of last successful recovery in milliseconds since boot (uint32_t) last_clear : time of last all-clear in milliseconds since boot (uint32_t) breach_count : number of fence breaches (uint16_t) mods_enabled : AP_Limit_Module bitfield of enabled modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) mods_required : AP_Limit_Module bitfield of required modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) mods_triggered : AP_Limit_Module bitfield of triggered modules, (see enum moduleid or LIMIT_MODULE) (uint8_t)
def limits_status_encode(self, limits_state, last_trigger, last_action, last_recovery, last_clear, breach_count, mods_enabled, mods_required, mods_triggered): ''' Status of AP_Limits. Sent in extended status stream when AP_Limits is enabled limits_state : state of AP_Limits, (see enum LimitState, LIMITS_STATE) (uint8_t) last_trigger : time of last breach in milliseconds since boot (uint32_t) last_action : time of last recovery action in milliseconds since boot (uint32_t) last_recovery : time of last successful recovery in milliseconds since boot (uint32_t) last_clear : time of last all-clear in milliseconds since boot (uint32_t) breach_count : number of fence breaches (uint16_t) mods_enabled : AP_Limit_Module bitfield of enabled modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) mods_required : AP_Limit_Module bitfield of required modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) mods_triggered : AP_Limit_Module bitfield of triggered modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) ''' return MAVLink_limits_status_message(limits_state, last_trigger, last_action, last_recovery, last_clear, breach_count, mods_enabled, mods_required, mods_triggered)
Status of AP_Limits. Sent in extended status stream when AP_Limits is enabled limits_state : state of AP_Limits, (see enum LimitState, LIMITS_STATE) (uint8_t) last_trigger : time of last breach in milliseconds since boot (uint32_t) last_action : time of last recovery action in milliseconds since boot (uint32_t) last_recovery : time of last successful recovery in milliseconds since boot (uint32_t) last_clear : time of last all-clear in milliseconds since boot (uint32_t) breach_count : number of fence breaches (uint16_t) mods_enabled : AP_Limit_Module bitfield of enabled modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) mods_required : AP_Limit_Module bitfield of required modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) mods_triggered : AP_Limit_Module bitfield of triggered modules, (see enum moduleid or LIMIT_MODULE) (uint8_t)
def limits_status_send(self, limits_state, last_trigger, last_action, last_recovery, last_clear, breach_count, mods_enabled, mods_required, mods_triggered, force_mavlink1=False): ''' Status of AP_Limits. Sent in extended status stream when AP_Limits is enabled limits_state : state of AP_Limits, (see enum LimitState, LIMITS_STATE) (uint8_t) last_trigger : time of last breach in milliseconds since boot (uint32_t) last_action : time of last recovery action in milliseconds since boot (uint32_t) last_recovery : time of last successful recovery in milliseconds since boot (uint32_t) last_clear : time of last all-clear in milliseconds since boot (uint32_t) breach_count : number of fence breaches (uint16_t) mods_enabled : AP_Limit_Module bitfield of enabled modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) mods_required : AP_Limit_Module bitfield of required modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) mods_triggered : AP_Limit_Module bitfield of triggered modules, (see enum moduleid or LIMIT_MODULE) (uint8_t) ''' return self.send(self.limits_status_encode(limits_state, last_trigger, last_action, last_recovery, last_clear, breach_count, mods_enabled, mods_required, mods_triggered), force_mavlink1=force_mavlink1)
Wind estimation direction : wind direction that wind is coming from (degrees) (float) speed : wind speed in ground plane (m/s) (float) speed_z : vertical wind speed (m/s) (float)
def wind_send(self, direction, speed, speed_z, force_mavlink1=False): ''' Wind estimation direction : wind direction that wind is coming from (degrees) (float) speed : wind speed in ground plane (m/s) (float) speed_z : vertical wind speed (m/s) (float) ''' return self.send(self.wind_encode(direction, speed, speed_z), force_mavlink1=force_mavlink1)
Data packet, size 16 type : data type (uint8_t) len : data length (uint8_t) data : raw data (uint8_t)
def data16_send(self, type, len, data, force_mavlink1=False): ''' Data packet, size 16 type : data type (uint8_t) len : data length (uint8_t) data : raw data (uint8_t) ''' return self.send(self.data16_encode(type, len, data), force_mavlink1=force_mavlink1)
Data packet, size 32 type : data type (uint8_t) len : data length (uint8_t) data : raw data (uint8_t)
def data32_send(self, type, len, data, force_mavlink1=False): ''' Data packet, size 32 type : data type (uint8_t) len : data length (uint8_t) data : raw data (uint8_t) ''' return self.send(self.data32_encode(type, len, data), force_mavlink1=force_mavlink1)
Data packet, size 64 type : data type (uint8_t) len : data length (uint8_t) data : raw data (uint8_t)
def data64_send(self, type, len, data, force_mavlink1=False): ''' Data packet, size 64 type : data type (uint8_t) len : data length (uint8_t) data : raw data (uint8_t) ''' return self.send(self.data64_encode(type, len, data), force_mavlink1=force_mavlink1)
Data packet, size 96 type : data type (uint8_t) len : data length (uint8_t) data : raw data (uint8_t)
def data96_send(self, type, len, data, force_mavlink1=False): ''' Data packet, size 96 type : data type (uint8_t) len : data length (uint8_t) data : raw data (uint8_t) ''' return self.send(self.data96_encode(type, len, data), force_mavlink1=force_mavlink1)
Rangefinder reporting distance : distance in meters (float) voltage : raw voltage if available, zero otherwise (float)
def rangefinder_send(self, distance, voltage, force_mavlink1=False): ''' Rangefinder reporting distance : distance in meters (float) voltage : raw voltage if available, zero otherwise (float) ''' return self.send(self.rangefinder_encode(distance, voltage), force_mavlink1=force_mavlink1)
Airspeed auto-calibration vx : GPS velocity north m/s (float) vy : GPS velocity east m/s (float) vz : GPS velocity down m/s (float) diff_pressure : Differential pressure pascals (float) EAS2TAS : Estimated to true airspeed ratio (float) ratio : Airspeed ratio (float) state_x : EKF state x (float) state_y : EKF state y (float) state_z : EKF state z (float) Pax : EKF Pax (float) Pby : EKF Pby (float) Pcz : EKF Pcz (float)
def airspeed_autocal_encode(self, vx, vy, vz, diff_pressure, EAS2TAS, ratio, state_x, state_y, state_z, Pax, Pby, Pcz): ''' Airspeed auto-calibration vx : GPS velocity north m/s (float) vy : GPS velocity east m/s (float) vz : GPS velocity down m/s (float) diff_pressure : Differential pressure pascals (float) EAS2TAS : Estimated to true airspeed ratio (float) ratio : Airspeed ratio (float) state_x : EKF state x (float) state_y : EKF state y (float) state_z : EKF state z (float) Pax : EKF Pax (float) Pby : EKF Pby (float) Pcz : EKF Pcz (float) ''' return MAVLink_airspeed_autocal_message(vx, vy, vz, diff_pressure, EAS2TAS, ratio, state_x, state_y, state_z, Pax, Pby, Pcz)
Airspeed auto-calibration vx : GPS velocity north m/s (float) vy : GPS velocity east m/s (float) vz : GPS velocity down m/s (float) diff_pressure : Differential pressure pascals (float) EAS2TAS : Estimated to true airspeed ratio (float) ratio : Airspeed ratio (float) state_x : EKF state x (float) state_y : EKF state y (float) state_z : EKF state z (float) Pax : EKF Pax (float) Pby : EKF Pby (float) Pcz : EKF Pcz (float)
def airspeed_autocal_send(self, vx, vy, vz, diff_pressure, EAS2TAS, ratio, state_x, state_y, state_z, Pax, Pby, Pcz, force_mavlink1=False): ''' Airspeed auto-calibration vx : GPS velocity north m/s (float) vy : GPS velocity east m/s (float) vz : GPS velocity down m/s (float) diff_pressure : Differential pressure pascals (float) EAS2TAS : Estimated to true airspeed ratio (float) ratio : Airspeed ratio (float) state_x : EKF state x (float) state_y : EKF state y (float) state_z : EKF state z (float) Pax : EKF Pax (float) Pby : EKF Pby (float) Pcz : EKF Pcz (float) ''' return self.send(self.airspeed_autocal_encode(vx, vy, vz, diff_pressure, EAS2TAS, ratio, state_x, state_y, state_z, Pax, Pby, Pcz), force_mavlink1=force_mavlink1)
A rally point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 0) (uint8_t) count : total number of points (for sanity checking) (uint8_t) lat : Latitude of point in degrees * 1E7 (int32_t) lng : Longitude of point in degrees * 1E7 (int32_t) alt : Transit / loiter altitude in meters relative to home (int16_t) break_alt : Break altitude in meters relative to home (int16_t) land_dir : Heading to aim for when landing. In centi-degrees. (uint16_t) flags : See RALLY_FLAGS enum for definition of the bitmask. (uint8_t)
def rally_point_encode(self, target_system, target_component, idx, count, lat, lng, alt, break_alt, land_dir, flags): ''' A rally point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 0) (uint8_t) count : total number of points (for sanity checking) (uint8_t) lat : Latitude of point in degrees * 1E7 (int32_t) lng : Longitude of point in degrees * 1E7 (int32_t) alt : Transit / loiter altitude in meters relative to home (int16_t) break_alt : Break altitude in meters relative to home (int16_t) land_dir : Heading to aim for when landing. In centi-degrees. (uint16_t) flags : See RALLY_FLAGS enum for definition of the bitmask. (uint8_t) ''' return MAVLink_rally_point_message(target_system, target_component, idx, count, lat, lng, alt, break_alt, land_dir, flags)
A rally point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 0) (uint8_t) count : total number of points (for sanity checking) (uint8_t) lat : Latitude of point in degrees * 1E7 (int32_t) lng : Longitude of point in degrees * 1E7 (int32_t) alt : Transit / loiter altitude in meters relative to home (int16_t) break_alt : Break altitude in meters relative to home (int16_t) land_dir : Heading to aim for when landing. In centi-degrees. (uint16_t) flags : See RALLY_FLAGS enum for definition of the bitmask. (uint8_t)
def rally_point_send(self, target_system, target_component, idx, count, lat, lng, alt, break_alt, land_dir, flags, force_mavlink1=False): ''' A rally point. Used to set a point when from GCS -> MAV. Also used to return a point from MAV -> GCS target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 0) (uint8_t) count : total number of points (for sanity checking) (uint8_t) lat : Latitude of point in degrees * 1E7 (int32_t) lng : Longitude of point in degrees * 1E7 (int32_t) alt : Transit / loiter altitude in meters relative to home (int16_t) break_alt : Break altitude in meters relative to home (int16_t) land_dir : Heading to aim for when landing. In centi-degrees. (uint16_t) flags : See RALLY_FLAGS enum for definition of the bitmask. (uint8_t) ''' return self.send(self.rally_point_encode(target_system, target_component, idx, count, lat, lng, alt, break_alt, land_dir, flags), force_mavlink1=force_mavlink1)
Request a current rally point from MAV. MAV should respond with a RALLY_POINT message. MAV should not respond if the request is invalid. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 0) (uint8_t)
def rally_fetch_point_send(self, target_system, target_component, idx, force_mavlink1=False): ''' Request a current rally point from MAV. MAV should respond with a RALLY_POINT message. MAV should not respond if the request is invalid. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) idx : point index (first point is 0) (uint8_t) ''' return self.send(self.rally_fetch_point_encode(target_system, target_component, idx), force_mavlink1=force_mavlink1)
Status of compassmot calibration throttle : throttle (percent*10) (uint16_t) current : current (amps) (float) interference : interference (percent) (uint16_t) CompensationX : Motor Compensation X (float) CompensationY : Motor Compensation Y (float) CompensationZ : Motor Compensation Z (float)
def compassmot_status_encode(self, throttle, current, interference, CompensationX, CompensationY, CompensationZ): ''' Status of compassmot calibration throttle : throttle (percent*10) (uint16_t) current : current (amps) (float) interference : interference (percent) (uint16_t) CompensationX : Motor Compensation X (float) CompensationY : Motor Compensation Y (float) CompensationZ : Motor Compensation Z (float) ''' return MAVLink_compassmot_status_message(throttle, current, interference, CompensationX, CompensationY, CompensationZ)
Status of compassmot calibration throttle : throttle (percent*10) (uint16_t) current : current (amps) (float) interference : interference (percent) (uint16_t) CompensationX : Motor Compensation X (float) CompensationY : Motor Compensation Y (float) CompensationZ : Motor Compensation Z (float)
def compassmot_status_send(self, throttle, current, interference, CompensationX, CompensationY, CompensationZ, force_mavlink1=False): ''' Status of compassmot calibration throttle : throttle (percent*10) (uint16_t) current : current (amps) (float) interference : interference (percent) (uint16_t) CompensationX : Motor Compensation X (float) CompensationY : Motor Compensation Y (float) CompensationZ : Motor Compensation Z (float) ''' return self.send(self.compassmot_status_encode(throttle, current, interference, CompensationX, CompensationY, CompensationZ), force_mavlink1=force_mavlink1)
Status of secondary AHRS filter if available roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) altitude : Altitude (MSL) (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t)
def ahrs2_encode(self, roll, pitch, yaw, altitude, lat, lng): ''' Status of secondary AHRS filter if available roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) altitude : Altitude (MSL) (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t) ''' return MAVLink_ahrs2_message(roll, pitch, yaw, altitude, lat, lng)
Status of secondary AHRS filter if available roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) altitude : Altitude (MSL) (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t)
def ahrs2_send(self, roll, pitch, yaw, altitude, lat, lng, force_mavlink1=False): ''' Status of secondary AHRS filter if available roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) altitude : Altitude (MSL) (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t) ''' return self.send(self.ahrs2_encode(roll, pitch, yaw, altitude, lat, lng), force_mavlink1=force_mavlink1)
Camera Event time_usec : Image timestamp (microseconds since UNIX epoch, according to camera clock) (uint64_t) target_system : System ID (uint8_t) cam_idx : Camera ID (uint8_t) img_idx : Image index (uint16_t) event_id : See CAMERA_STATUS_TYPES enum for definition of the bitmask (uint8_t) p1 : Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p2 : Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p3 : Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p4 : Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float)
def camera_status_encode(self, time_usec, target_system, cam_idx, img_idx, event_id, p1, p2, p3, p4): ''' Camera Event time_usec : Image timestamp (microseconds since UNIX epoch, according to camera clock) (uint64_t) target_system : System ID (uint8_t) cam_idx : Camera ID (uint8_t) img_idx : Image index (uint16_t) event_id : See CAMERA_STATUS_TYPES enum for definition of the bitmask (uint8_t) p1 : Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p2 : Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p3 : Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p4 : Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) ''' return MAVLink_camera_status_message(time_usec, target_system, cam_idx, img_idx, event_id, p1, p2, p3, p4)
Camera Event time_usec : Image timestamp (microseconds since UNIX epoch, according to camera clock) (uint64_t) target_system : System ID (uint8_t) cam_idx : Camera ID (uint8_t) img_idx : Image index (uint16_t) event_id : See CAMERA_STATUS_TYPES enum for definition of the bitmask (uint8_t) p1 : Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p2 : Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p3 : Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p4 : Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float)
def camera_status_send(self, time_usec, target_system, cam_idx, img_idx, event_id, p1, p2, p3, p4, force_mavlink1=False): ''' Camera Event time_usec : Image timestamp (microseconds since UNIX epoch, according to camera clock) (uint64_t) target_system : System ID (uint8_t) cam_idx : Camera ID (uint8_t) img_idx : Image index (uint16_t) event_id : See CAMERA_STATUS_TYPES enum for definition of the bitmask (uint8_t) p1 : Parameter 1 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p2 : Parameter 2 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p3 : Parameter 3 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) p4 : Parameter 4 (meaning depends on event, see CAMERA_STATUS_TYPES enum) (float) ''' return self.send(self.camera_status_encode(time_usec, target_system, cam_idx, img_idx, event_id, p1, p2, p3, p4), force_mavlink1=force_mavlink1)
Camera Capture Feedback time_usec : Image timestamp (microseconds since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB) (uint64_t) target_system : System ID (uint8_t) cam_idx : Camera ID (uint8_t) img_idx : Image index (uint16_t) lat : Latitude in (deg * 1E7) (int32_t) lng : Longitude in (deg * 1E7) (int32_t) alt_msl : Altitude Absolute (meters AMSL) (float) alt_rel : Altitude Relative (meters above HOME location) (float) roll : Camera Roll angle (earth frame, degrees, +-180) (float) pitch : Camera Pitch angle (earth frame, degrees, +-180) (float) yaw : Camera Yaw (earth frame, degrees, 0-360, true) (float) foc_len : Focal Length (mm) (float) flags : See CAMERA_FEEDBACK_FLAGS enum for definition of the bitmask (uint8_t)
def camera_feedback_encode(self, time_usec, target_system, cam_idx, img_idx, lat, lng, alt_msl, alt_rel, roll, pitch, yaw, foc_len, flags): ''' Camera Capture Feedback time_usec : Image timestamp (microseconds since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB) (uint64_t) target_system : System ID (uint8_t) cam_idx : Camera ID (uint8_t) img_idx : Image index (uint16_t) lat : Latitude in (deg * 1E7) (int32_t) lng : Longitude in (deg * 1E7) (int32_t) alt_msl : Altitude Absolute (meters AMSL) (float) alt_rel : Altitude Relative (meters above HOME location) (float) roll : Camera Roll angle (earth frame, degrees, +-180) (float) pitch : Camera Pitch angle (earth frame, degrees, +-180) (float) yaw : Camera Yaw (earth frame, degrees, 0-360, true) (float) foc_len : Focal Length (mm) (float) flags : See CAMERA_FEEDBACK_FLAGS enum for definition of the bitmask (uint8_t) ''' return MAVLink_camera_feedback_message(time_usec, target_system, cam_idx, img_idx, lat, lng, alt_msl, alt_rel, roll, pitch, yaw, foc_len, flags)
Camera Capture Feedback time_usec : Image timestamp (microseconds since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB) (uint64_t) target_system : System ID (uint8_t) cam_idx : Camera ID (uint8_t) img_idx : Image index (uint16_t) lat : Latitude in (deg * 1E7) (int32_t) lng : Longitude in (deg * 1E7) (int32_t) alt_msl : Altitude Absolute (meters AMSL) (float) alt_rel : Altitude Relative (meters above HOME location) (float) roll : Camera Roll angle (earth frame, degrees, +-180) (float) pitch : Camera Pitch angle (earth frame, degrees, +-180) (float) yaw : Camera Yaw (earth frame, degrees, 0-360, true) (float) foc_len : Focal Length (mm) (float) flags : See CAMERA_FEEDBACK_FLAGS enum for definition of the bitmask (uint8_t)
def camera_feedback_send(self, time_usec, target_system, cam_idx, img_idx, lat, lng, alt_msl, alt_rel, roll, pitch, yaw, foc_len, flags, force_mavlink1=False): ''' Camera Capture Feedback time_usec : Image timestamp (microseconds since UNIX epoch), as passed in by CAMERA_STATUS message (or autopilot if no CCB) (uint64_t) target_system : System ID (uint8_t) cam_idx : Camera ID (uint8_t) img_idx : Image index (uint16_t) lat : Latitude in (deg * 1E7) (int32_t) lng : Longitude in (deg * 1E7) (int32_t) alt_msl : Altitude Absolute (meters AMSL) (float) alt_rel : Altitude Relative (meters above HOME location) (float) roll : Camera Roll angle (earth frame, degrees, +-180) (float) pitch : Camera Pitch angle (earth frame, degrees, +-180) (float) yaw : Camera Yaw (earth frame, degrees, 0-360, true) (float) foc_len : Focal Length (mm) (float) flags : See CAMERA_FEEDBACK_FLAGS enum for definition of the bitmask (uint8_t) ''' return self.send(self.camera_feedback_encode(time_usec, target_system, cam_idx, img_idx, lat, lng, alt_msl, alt_rel, roll, pitch, yaw, foc_len, flags), force_mavlink1=force_mavlink1)
2nd Battery status voltage : voltage in millivolts (uint16_t) current_battery : Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current (int16_t)
def battery2_send(self, voltage, current_battery, force_mavlink1=False): ''' 2nd Battery status voltage : voltage in millivolts (uint16_t) current_battery : Battery current, in 10*milliamperes (1 = 10 milliampere), -1: autopilot does not measure the current (int16_t) ''' return self.send(self.battery2_encode(voltage, current_battery), force_mavlink1=force_mavlink1)
Status of third AHRS filter if available. This is for ANU research group (Ali and Sean) roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) altitude : Altitude (MSL) (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t) v1 : test variable1 (float) v2 : test variable2 (float) v3 : test variable3 (float) v4 : test variable4 (float)
def ahrs3_encode(self, roll, pitch, yaw, altitude, lat, lng, v1, v2, v3, v4): ''' Status of third AHRS filter if available. This is for ANU research group (Ali and Sean) roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) altitude : Altitude (MSL) (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t) v1 : test variable1 (float) v2 : test variable2 (float) v3 : test variable3 (float) v4 : test variable4 (float) ''' return MAVLink_ahrs3_message(roll, pitch, yaw, altitude, lat, lng, v1, v2, v3, v4)
Status of third AHRS filter if available. This is for ANU research group (Ali and Sean) roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) altitude : Altitude (MSL) (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t) v1 : test variable1 (float) v2 : test variable2 (float) v3 : test variable3 (float) v4 : test variable4 (float)
def ahrs3_send(self, roll, pitch, yaw, altitude, lat, lng, v1, v2, v3, v4, force_mavlink1=False): ''' Status of third AHRS filter if available. This is for ANU research group (Ali and Sean) roll : Roll angle (rad) (float) pitch : Pitch angle (rad) (float) yaw : Yaw angle (rad) (float) altitude : Altitude (MSL) (float) lat : Latitude in degrees * 1E7 (int32_t) lng : Longitude in degrees * 1E7 (int32_t) v1 : test variable1 (float) v2 : test variable2 (float) v3 : test variable3 (float) v4 : test variable4 (float) ''' return self.send(self.ahrs3_encode(roll, pitch, yaw, altitude, lat, lng, v1, v2, v3, v4), force_mavlink1=force_mavlink1)
Request the autopilot version from the system/component. target_system : System ID (uint8_t) target_component : Component ID (uint8_t)
def autopilot_version_request_send(self, target_system, target_component, force_mavlink1=False): ''' Request the autopilot version from the system/component. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) ''' return self.send(self.autopilot_version_request_encode(target_system, target_component), force_mavlink1=force_mavlink1)