INSTRUCTION
stringlengths
1
46.3k
RESPONSE
stringlengths
75
80.2k
Create DCM from euler angles :param dcm: Matrix3 :returns: array [roll, pitch, yaw] in rad
def _dcm_to_euler(self, dcm): """ Create DCM from euler angles :param dcm: Matrix3 :returns: array [roll, pitch, yaw] in rad """ assert(isinstance(dcm, Matrix3)) return np.array(dcm.to_euler())
work out gps lock times for a log file
def lock_time(logfile): '''work out gps lock times for a log file''' print("Processing log %s" % filename) mlog = mavutil.mavlink_connection(filename) locked = False start_time = 0.0 total_time = 0.0 t = None m = mlog.recv_match(type=['GPS_RAW_INT','GPS_RAW'], condition=args.condition) ...
handle menu selection
def on_menu(self, event): '''handle menu selection''' state = self.state # see if it is a popup menu if state.popup_object is not None: obj = state.popup_object ret = obj.popup_menu.find_selected(event) if ret is not None: ret.call_hand...
follow an object on the map
def follow(self, object): '''follow an object on the map''' state = self.state (px,py) = state.panel.pixmapper(object.latlon) ratio = 0.25 if (px > ratio*state.width and px < (1.0-ratio)*state.width and py > ratio*state.height and py < (1.0-rat...
add an object to a later
def add_object(self, obj): '''add an object to a later''' state = self.state if not obj.layer in state.layers: # its a new layer state.layers[obj.layer] = {} state.layers[obj.layer][obj.key] = obj state.need_redraw = True
remove an object by key from all layers
def remove_object(self, key): '''remove an object by key from all layers''' state = self.state for layer in state.layers: state.layers[layer].pop(key, None) state.need_redraw = True
prevent the main loop spinning too fast
def on_idle(self, event): '''prevent the main loop spinning too fast''' state = self.state if state.close_window.acquire(False): self.state.app.ExitMainLoop() # receive any display objects from the parent obj = None while not state.object_queue.empty(): ...
return a tuple representing the current view
def current_view(self): '''return a tuple representing the current view''' state = self.state return (state.lat, state.lon, state.width, state.height, state.ground_width, state.mt.tiles_pending())
return coordinates of a pixel in the map
def coordinates(self, x, y): '''return coordinates of a pixel in the map''' state = self.state return state.mt.coord_from_area(x, y, state.lat, state.lon, state.width, state.ground_width)
re-center view for pixel x,y
def re_center(self, x, y, lat, lon): '''re-center view for pixel x,y''' state = self.state if lat is None or lon is None: return (lat2,lon2) = self.coordinates(x, y) distance = mp_util.gps_distance(lat2, lon2, lat, lon) bearing = mp_util.gps_bearing(lat2, lon...
zoom in or out by zoom factor, keeping centered
def change_zoom(self, zoom): '''zoom in or out by zoom factor, keeping centered''' state = self.state if self.mouse_pos: (x,y) = (self.mouse_pos.x, self.mouse_pos.y) else: (x,y) = (state.width/2, state.height/2) (lat,lon) = self.coordinates(x, y) s...
enter new position
def enter_position(self): '''enter new position''' state = self.state dlg = wx.TextEntryDialog(self, 'Enter new position', 'Position') dlg.SetValue("%f %f" % (state.lat, state.lon)) if dlg.ShowModal() == wx.ID_OK: latlon = dlg.GetValue().split() dlg.Destro...
update position text
def update_position(self): '''update position text''' state = self.state pos = self.mouse_pos newtext = '' alt = 0 if pos is not None: (lat,lon) = self.coordinates(pos.x, pos.y) newtext += 'Cursor: %f %f (%s)' % (lat, lon, mp_util.latlon_to_grid((l...
return pixel coordinates in the map image for a (lat,lon) if reverse is set, then return lat/lon for a pixel coordinate
def pixel_coords(self, latlon, reverse=False): '''return pixel coordinates in the map image for a (lat,lon) if reverse is set, then return lat/lon for a pixel coordinate ''' state = self.state if reverse: (x,y) = latlon return self.coordinates(x,y) ...
draw objects on the image
def draw_objects(self, objects, bounds, img): '''draw objects on the image''' keys = objects.keys() keys.sort() for k in keys: obj = objects[k] bounds2 = obj.bounds() if bounds2 is None or mp_util.bounds_overlap(bounds, bounds2): obj.dr...
redraw the map with current settings
def redraw_map(self): '''redraw the map with current settings''' state = self.state view_same = (self.last_view and self.map_img and self.last_view == self.current_view()) if view_same and not state.need_redraw: return # get the new map self.map_img = state...
handle window size changes
def on_size(self, event): '''handle window size changes''' state = self.state size = event.GetSize() state.width = size.width state.height = size.height self.redraw_map()
return a list of matching objects for a position
def selected_objects(self, pos): '''return a list of matching objects for a position''' state = self.state selected = [] (px, py) = pos for layer in state.layers: for key in state.layers[layer]: obj = state.layers[layer][key] distance =...
show default popup menu
def show_default_popup(self, pos): '''show default popup menu''' state = self.state if state.default_popup.popup is not None: wx_menu = state.default_popup.popup.wx_menu() state.frame.PopupMenu(wx_menu, pos)
clear all thumbnails from the map
def clear_thumbnails(self): '''clear all thumbnails from the map''' state = self.state for l in state.layers: keys = state.layers[l].keys()[:] for key in keys: if (isinstance(state.layers[l][key], SlipThumbnail) and not isinstance(state...
handle keyboard input
def on_key_down(self, event): '''handle keyboard input''' state = self.state # send all key events to the parent if self.mouse_pos: latlon = self.coordinates(self.mouse_pos.x, self.mouse_pos.y) selected = self.selected_objects(self.mouse_pos) state.ev...
evaluation an expression
def evaluate_expression(expression, vars): '''evaluation an expression''' try: v = eval(expression, globals(), vars) except NameError: return None except ZeroDivisionError: return None return v
Compile style.qrc using rcc, pyside-rcc and pyrcc4
def compile_all(): """ Compile style.qrc using rcc, pyside-rcc and pyrcc4 """ # print("Compiling for Qt: style.qrc -> style.rcc") # os.system("rcc style.qrc -o style.rcc") print("Compiling for PyQt4: style.qrc -> pyqt_style_rc.py") os.system("pyrcc4 -py3 style.qrc -o pyqt_style_rc.py") p...
plot a set of graphs using date for x axis
def plotit(self, x, y, fields, colors=[]): '''plot a set of graphs using date for x axis''' pylab.ion() fig = pylab.figure(num=1, figsize=(12,6)) ax1 = fig.gca() ax2 = None xrange = 0.0 for i in range(0, len(fields)): if len(x[i]) == 0: continue ...
add some data
def add_data(self, t, msg, vars, flightmode): '''add some data''' mtype = msg.get_type() if self.flightmode is not None and (len(self.modes) == 0 or self.modes[-1][1] != flightmode): self.modes.append((t, flightmode)) for i in range(0, len(self.fields)): if mtype ...
process one file
def process_mav(self, mlog, timeshift): '''process one file''' self.vars = {} while True: msg = mlog.recv_msg() if msg is None: break if msg.get_type() not in self.msg_types: continue if self.condition: ...
process and display graph
def process(self, block=True): '''process and display graph''' self.msg_types = set() self.multiplier = [] self.field_types = [] # work out msg types we are interested in self.x = [] self.y = [] self.modes = [] self.axes = [] self.first_on...
null terminate a string
def null_term(str): '''null terminate a string''' idx = str.find("\0") if idx != -1: str = str[:idx] return str
return True if a file appears to be a valid text log
def DFReader_is_text_log(filename): '''return True if a file appears to be a valid text log''' f = open(filename) ret = (f.read(8000).find('FMT, ') != -1) f.close() return ret
create a binary message buffer for a message
def get_msgbuf(self): '''create a binary message buffer for a message''' values = [] for i in range(len(self.fmt.columns)): if i >= len(self.fmt.msg_mults): continue mul = self.fmt.msg_mults[i] name = self.fmt.columns[i] if name == ...
work out time basis for the log - even newer style
def find_time_base(self, gps, first_us_stamp): '''work out time basis for the log - even newer style''' t = self._gpsTimeToTime(gps.GWk, gps.GMS) self.set_timebase(t - gps.TimeUS*0.000001) # this ensures FMT messages get appropriate timestamp: self.timestamp = self.timebase + fir...
The TimeMS in some messages is not from *our* clock!
def type_has_good_TimeMS(self, type): '''The TimeMS in some messages is not from *our* clock!''' if type.startswith('ACC'): return False; if type.startswith('GYR'): return False; return True
work out time basis for the log - new style
def find_time_base(self, gps, first_ms_stamp): '''work out time basis for the log - new style''' t = self._gpsTimeToTime(gps.Week, gps.TimeMS) self.set_timebase(t - gps.T*0.001) self.timestamp = self.timebase + first_ms_stamp*0.001
work out time basis for the log - PX4 native
def find_time_base(self, gps): '''work out time basis for the log - PX4 native''' t = gps.GPSTime * 1.0e-6 self.timebase = t - self.px4_timebase
adjust time base from GPS message
def gps_message_arrived(self, m): '''adjust time base from GPS message''' # msec-style GPS message? gps_week = getattr(m, 'Week', None) gps_timems = getattr(m, 'TimeMS', None) if gps_week is None: # usec-style GPS message? gps_week = getattr(m, 'GWk', None...
reset state on rewind
def _rewind(self): '''reset state on rewind''' self.messages = { 'MAV' : self } self.flightmode = "UNKNOWN" self.percent = 0 if self.clock: self.clock.rewind_event()
work out time basis for the log
def init_clock(self): '''work out time basis for the log''' self._rewind() # speculatively create a gps clock in case we don't find anything # better gps_clock = DFReaderClock_gps_interpolated() self.clock = gps_clock px4_msg_time = None px4_msg_gps = N...
set time for a message
def _set_time(self, m): '''set time for a message''' # really just left here for profiling m._timestamp = self.timestamp if len(m._fieldnames) > 0 and self.clock is not None: self.clock.set_message_timestamp(m)
add a new message
def _add_msg(self, m): '''add a new message''' type = m.get_type() self.messages[type] = m if self.clock: self.clock.message_arrived(m) if type == 'MSG': if m.Message.find("Rover") != -1: self.mav_type = mavutil.mavlink.MAV_TYPE_GROUND_RO...
recv the next message that matches the given condition type can be a string or a list of strings
def recv_match(self, condition=None, type=None, blocking=False): '''recv the next message that matches the given condition type can be a string or a list of strings''' if type is not None and not isinstance(type, list): type = [type] while True: m = self.recv_msg(...
convenient function for returning an arbitrary MAVLink parameter with a default
def param(self, name, default=None): '''convenient function for returning an arbitrary MAVLink parameter with a default''' if not name in self.params: return default return self.params[name]
rewind to start of log
def _rewind(self): '''rewind to start of log''' DFReader._rewind(self) self.offset = 0 self.remaining = self.data_len
read one message, returning it as an object
def _parse_next(self): '''read one message, returning it as an object''' if self.data_len - self.offset < 3: return None hdr = self.data[self.offset:self.offset+3] skip_bytes = 0 skip_type = None # skip over bad messages while (ord(hdr[0])...
rewind to start of log
def _rewind(self): '''rewind to start of log''' DFReader._rewind(self) self.line = 0 # find the first valid line while self.line < len(self.lines): if self.lines[self.line].startswith("FMT, "): break self.line += 1
read one message, returning it as an object
def _parse_next(self): '''read one message, returning it as an object''' this_line = self.line while self.line < len(self.lines): s = self.lines[self.line].rstrip() elements = s.split(", ") this_line = self.line # move to next line sel...
Translates from JderobotTypes CMDVel to ROS Twist. @param vel: JderobotTypes CMDVel to translate @type img: JdeRobotTypes.CMDVel @return a Twist translated from vel
def cmdvel2PosTarget(vel): ''' Translates from JderobotTypes CMDVel to ROS Twist. @param vel: JderobotTypes CMDVel to translate @type img: JdeRobotTypes.CMDVel @return a Twist translated from vel ''' msg=PositionTarget( header=Header( stamp=rospy.Time.now(), ...
Function to publish cmdvel.
def publish (self): ''' Function to publish cmdvel. ''' #print(self) #self.using_event.wait() self.lock.acquire() msg = cmdvel2PosTarget(self.vel) self.lock.release() self.pub.publish(msg)
Sends CMDVel. @param vel: CMDVel to publish @type vel: CMDVel
def sendCMD (self, vel): ''' Sends CMDVel. @param vel: CMDVel to publish @type vel: CMDVel ''' self.lock.acquire() self.vel = vel self.lock.release()
work out signal loss times for a log file
def mavloss(logfile): '''work out signal loss times for a log file''' print("Processing log %s" % filename) mlog = mavutil.mavlink_connection(filename, planner_format=args.planner, notimestamps=args.notimestamps, ...
Sensor and DSC control loads. sensLoad : Sensor DSC Load (uint8_t) ctrlLoad : Control DSC Load (uint8_t) batVolt : Battery Voltage in millivolts (uint16_t)
def cpu_load_send(self, sensLoad, ctrlLoad, batVolt, force_mavlink1=False): ''' Sensor and DSC control loads. sensLoad : Sensor DSC Load (uint8_t) ctrlLoad : Control DSC Load (uint8_t) batVolt ...
Accelerometer and gyro biases. axBias : Accelerometer X bias (m/s) (float) ayBias : Accelerometer Y bias (m/s) (float) azBias : Accelerometer Z bias (m/s) (float) gxBias : Gyro X ...
def sensor_bias_encode(self, axBias, ayBias, azBias, gxBias, gyBias, gzBias): ''' Accelerometer and gyro biases. axBias : Accelerometer X bias (m/s) (float) ayBias : Accelerometer Y bias (m/s) (float) ...
Accelerometer and gyro biases. axBias : Accelerometer X bias (m/s) (float) ayBias : Accelerometer Y bias (m/s) (float) azBias : Accelerometer Z bias (m/s) (float) gxBias : Gyro X ...
def sensor_bias_send(self, axBias, ayBias, azBias, gxBias, gyBias, gzBias, force_mavlink1=False): ''' Accelerometer and gyro biases. axBias : Accelerometer X bias (m/s) (float) ayBias : Accelerometer Y bias (m/s) (flo...
Configurable diagnostic messages. diagFl1 : Diagnostic float 1 (float) diagFl2 : Diagnostic float 2 (float) diagFl3 : Diagnostic float 3 (float) diagSh1 : Diagnostic short 1 (int16_t)...
def diagnostic_encode(self, diagFl1, diagFl2, diagFl3, diagSh1, diagSh2, diagSh3): ''' Configurable diagnostic messages. diagFl1 : Diagnostic float 1 (float) diagFl2 : Diagnostic float 2 (float) diagFl3 ...
Configurable diagnostic messages. diagFl1 : Diagnostic float 1 (float) diagFl2 : Diagnostic float 2 (float) diagFl3 : Diagnostic float 3 (float) diagSh1 : Diagnostic short 1 (int16_t)...
def diagnostic_send(self, diagFl1, diagFl2, diagFl3, diagSh1, diagSh2, diagSh3, force_mavlink1=False): ''' Configurable diagnostic messages. diagFl1 : Diagnostic float 1 (float) diagFl2 : Diagnostic float 2 (float) ...
Data used in the navigation algorithm. u_m : Measured Airspeed prior to the nav filter in m/s (float) phi_c : Commanded Roll (float) theta_c : Commanded Pitch (float) psiDot_c : ...
def slugs_navigation_encode(self, u_m, phi_c, theta_c, psiDot_c, ay_body, totalDist, dist2Go, fromWP, toWP, h_c): ''' Data used in the navigation algorithm. u_m : Measured Airspeed prior to the nav filter in m/s (float) phi_c ...
Data used in the navigation algorithm. u_m : Measured Airspeed prior to the nav filter in m/s (float) phi_c : Commanded Roll (float) theta_c : Commanded Pitch (float) psiDot_c : ...
def slugs_navigation_send(self, u_m, phi_c, theta_c, psiDot_c, ay_body, totalDist, dist2Go, fromWP, toWP, h_c, force_mavlink1=False): ''' Data used in the navigation algorithm. u_m : Measured Airspeed prior to the nav filter in m/s (float) ...
Configurable data log probes to be used inside Simulink fl_1 : Log value 1 (float) fl_2 : Log value 2 (float) fl_3 : Log value 3 (float) fl_4 : Log value 4 (float) ...
def data_log_encode(self, fl_1, fl_2, fl_3, fl_4, fl_5, fl_6): ''' Configurable data log probes to be used inside Simulink fl_1 : Log value 1 (float) fl_2 : Log value 2 (float) fl_3 ...
Configurable data log probes to be used inside Simulink fl_1 : Log value 1 (float) fl_2 : Log value 2 (float) fl_3 : Log value 3 (float) fl_4 : Log value 4 (float) ...
def data_log_send(self, fl_1, fl_2, fl_3, fl_4, fl_5, fl_6, force_mavlink1=False): ''' Configurable data log probes to be used inside Simulink fl_1 : Log value 1 (float) fl_2 : Log value 2 (float) ...
Pilot console PWM messges. year : Year reported by Gps (uint8_t) month : Month reported by Gps (uint8_t) day : Day reported by Gps (uint8_t) hour : Hour reported by Gps (u...
def gps_date_time_encode(self, year, month, day, hour, min, sec, clockStat, visSat, useSat, GppGl, sigUsedMask, percentUsed): ''' Pilot console PWM messges. year : Year reported by Gps (uint8_t) month : Month repor...
Pilot console PWM messges. year : Year reported by Gps (uint8_t) month : Month reported by Gps (uint8_t) day : Day reported by Gps (uint8_t) hour : Hour reported by Gps (u...
def gps_date_time_send(self, year, month, day, hour, min, sec, clockStat, visSat, useSat, GppGl, sigUsedMask, percentUsed, force_mavlink1=False): ''' Pilot console PWM messges. year : Year reported by Gps (uint8_t) month ...
Mid Level commands sent from the GS to the autopilot. These are only sent when being operated in mid-level commands mode from the ground. target : The system setting the commands (uint8_t) hCommand : Commanded Altitude ...
def mid_lvl_cmds_encode(self, target, hCommand, uCommand, rCommand): ''' Mid Level commands sent from the GS to the autopilot. These are only sent when being operated in mid-level commands mode from the ground. target : ...
Mid Level commands sent from the GS to the autopilot. These are only sent when being operated in mid-level commands mode from the ground. target : The system setting the commands (uint8_t) hCommand : Commanded Altitude ...
def mid_lvl_cmds_send(self, target, hCommand, uCommand, rCommand, force_mavlink1=False): ''' Mid Level commands sent from the GS to the autopilot. These are only sent when being operated in mid-level commands mode from the ground. target ...
This message sets the control surfaces for selective passthrough mode. target : The system setting the commands (uint8_t) bitfieldPt : Bitfield containing the passthrough configuration, see CONTROL_SURFACE_FLAG ENUM. (uint16_t)
def ctrl_srfc_pt_send(self, target, bitfieldPt, force_mavlink1=False): ''' This message sets the control surfaces for selective passthrough mode. target : The system setting the commands (uint8_t) bitfieldPt : Bitfield co...
Orders generated to the SLUGS camera mount. target : The system reporting the action (uint8_t) pan : Order the mount to pan: -1 left, 0 No pan motion, +1 right (int8_t) tilt : Order the mount to tilt: -1 down,...
def slugs_camera_order_encode(self, target, pan, tilt, zoom, moveHome): ''' Orders generated to the SLUGS camera mount. target : The system reporting the action (uint8_t) pan : Order the mount to pan: -1 left, 0 No...
Orders generated to the SLUGS camera mount. target : The system reporting the action (uint8_t) pan : Order the mount to pan: -1 left, 0 No pan motion, +1 right (int8_t) tilt : Order the mount to tilt: -1 down,...
def slugs_camera_order_send(self, target, pan, tilt, zoom, moveHome, force_mavlink1=False): ''' Orders generated to the SLUGS camera mount. target : The system reporting the action (uint8_t) pan : Order the mount t...
Control for surface; pending and order to origin. target : The system setting the commands (uint8_t) idSurface : ID control surface send 0: throttle 1: aileron 2: elevator 3: rudder (uint8_t) mControl : Pending (float) ...
def control_surface_encode(self, target, idSurface, mControl, bControl): ''' Control for surface; pending and order to origin. target : The system setting the commands (uint8_t) idSurface : ID control surface send 0: thr...
Control for surface; pending and order to origin. target : The system setting the commands (uint8_t) idSurface : ID control surface send 0: throttle 1: aileron 2: elevator 3: rudder (uint8_t) mControl : Pending (float) ...
def control_surface_send(self, target, idSurface, mControl, bControl, force_mavlink1=False): ''' Control for surface; pending and order to origin. target : The system setting the commands (uint8_t) idSurface : ID control...
Transmits the last known position of the mobile GS to the UAV. Very relevant when Track Mobile is enabled target : The system reporting the action (uint8_t) latitude : Mobile Latitude (float) longitude :...
def slugs_mobile_location_send(self, target, latitude, longitude, force_mavlink1=False): ''' Transmits the last known position of the mobile GS to the UAV. Very relevant when Track Mobile is enabled target : The system reporting the act...
Control for camara. target : The system setting the commands (uint8_t) idOrder : ID 0: brightness 1: aperture 2: iris 3: ICR 4: backlight (uint8_t) order : 1: up/on 2: down/off 3: auto/reset/no action (uint8_t)
def slugs_configuration_camera_send(self, target, idOrder, order, force_mavlink1=False): ''' Control for camara. target : The system setting the commands (uint8_t) idOrder : ID 0: brightness 1: aperture 2: iris 3: ICR ...
Transmits the position of watch target : The system reporting the action (uint8_t) latitude : ISR Latitude (float) longitude : ISR Longitude (float) height : ISR Height (float) ...
def isr_location_encode(self, target, latitude, longitude, height, option1, option2, option3): ''' Transmits the position of watch target : The system reporting the action (uint8_t) latitude : ISR Latitude (float) ...
Transmits the position of watch target : The system reporting the action (uint8_t) latitude : ISR Latitude (float) longitude : ISR Longitude (float) height : ISR Height (float) ...
def isr_location_send(self, target, latitude, longitude, height, option1, option2, option3, force_mavlink1=False): ''' Transmits the position of watch target : The system reporting the action (uint8_t) latitude : ISR La...
Transmits the readings from the voltage and current sensors r2Type : It is the value of reading 2: 0 - Current, 1 - Foreward Sonar, 2 - Back Sonar, 3 - RPM (uint8_t) voltage : Voltage in uS of PWM. 0 uS = 0V, 20 uS = 21.5V (uint16_t) ...
def volt_sensor_send(self, r2Type, voltage, reading2, force_mavlink1=False): ''' Transmits the readings from the voltage and current sensors r2Type : It is the value of reading 2: 0 - Current, 1 - Foreward Sonar, 2 - Back Sonar, 3 - RPM (uint8_t) ...
Transmits the actual Pan, Tilt and Zoom values of the camera unit zoom : The actual Zoom Value (uint8_t) pan : The Pan value in 10ths of degree (int16_t) tilt : The Tilt value in 10ths of degree (int16_t)
def ptz_status_send(self, zoom, pan, tilt, force_mavlink1=False): ''' Transmits the actual Pan, Tilt and Zoom values of the camera unit zoom : The actual Zoom Value (uint8_t) pan : The Pan value in 10ths of degre...
Transmits the actual status values UAV in flight target : The ID system reporting the action (uint8_t) latitude : Latitude UAV (float) longitude : Longitude UAV (float) altitude : Altitu...
def uav_status_encode(self, target, latitude, longitude, altitude, speed, course): ''' Transmits the actual status values UAV in flight target : The ID system reporting the action (uint8_t) latitude : Latitude UAV (floa...
Transmits the actual status values UAV in flight target : The ID system reporting the action (uint8_t) latitude : Latitude UAV (float) longitude : Longitude UAV (float) altitude : Altitu...
def uav_status_send(self, target, latitude, longitude, altitude, speed, course, force_mavlink1=False): ''' Transmits the actual status values UAV in flight target : The ID system reporting the action (uint8_t) latitude ...
This contains the status of the GPS readings csFails : Number of times checksum has failed (uint16_t) gpsQuality : The quality indicator, 0=fix not available or invalid, 1=GPS fix, 2=C/A differential GPS, 6=Dead reckoning mode, 7=Manual input mode (fixed...
def status_gps_encode(self, csFails, gpsQuality, msgsType, posStatus, magVar, magDir, modeInd): ''' This contains the status of the GPS readings csFails : Number of times checksum has failed (uint16_t) gpsQuality : The qua...
This contains the status of the GPS readings csFails : Number of times checksum has failed (uint16_t) gpsQuality : The quality indicator, 0=fix not available or invalid, 1=GPS fix, 2=C/A differential GPS, 6=Dead reckoning mode, 7=Manual input mode (fixed...
def status_gps_send(self, csFails, gpsQuality, msgsType, posStatus, magVar, magDir, modeInd, force_mavlink1=False): ''' This contains the status of the GPS readings csFails : Number of times checksum has failed (uint16_t) gpsQuality ...
Transmits the diagnostics data from the Novatel OEMStar GPS timeStatus : The Time Status. See Table 8 page 27 Novatel OEMStar Manual (uint8_t) receiverStatus : Status Bitfield. See table 69 page 350 Novatel OEMstar Manual (uint32_t) solStatus ...
def novatel_diag_encode(self, timeStatus, receiverStatus, solStatus, posType, velType, posSolAge, csFails): ''' Transmits the diagnostics data from the Novatel OEMStar GPS timeStatus : The Time Status. See Table 8 page 27 Novatel OEMStar Manual (uint8_t) ...
Transmits the diagnostics data from the Novatel OEMStar GPS timeStatus : The Time Status. See Table 8 page 27 Novatel OEMStar Manual (uint8_t) receiverStatus : Status Bitfield. See table 69 page 350 Novatel OEMstar Manual (uint32_t) solStatus ...
def novatel_diag_send(self, timeStatus, receiverStatus, solStatus, posType, velType, posSolAge, csFails, force_mavlink1=False): ''' Transmits the diagnostics data from the Novatel OEMStar GPS timeStatus : The Time Status. See Table 8 page 27 Novatel OEMSta...
Diagnostic data Sensor MCU float1 : Float field 1 (float) float2 : Float field 2 (float) int1 : Int 16 field 1 (int16_t) char1 : Int 8 field 1 (int8_t)
def sensor_diag_encode(self, float1, float2, int1, char1): ''' Diagnostic data Sensor MCU float1 : Float field 1 (float) float2 : Float field 2 (float) int1 : Int 16 field 1 (int16...
Diagnostic data Sensor MCU float1 : Float field 1 (float) float2 : Float field 2 (float) int1 : Int 16 field 1 (int16_t) char1 : Int 8 field 1 (int8_t)
def sensor_diag_send(self, float1, float2, int1, char1, force_mavlink1=False): ''' Diagnostic data Sensor MCU float1 : Float field 1 (float) float2 : Float field 2 (float) int1 : I...
The boot message indicates that a system is starting. The onboard software version allows to keep track of onboard soft/firmware revisions. This message allows the sensor and control MCUs to communicate version numbers on startup. version ...
def boot_send(self, version, force_mavlink1=False): ''' The boot message indicates that a system is starting. The onboard software version allows to keep track of onboard soft/firmware revisions. This message allows the sensor and control M...
Message encoding a mission script item. This message is emitted upon a request for the next script item. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) seq : Sequence (uint16_t) ...
def script_item_encode(self, target_system, target_component, seq, name): ''' Message encoding a mission script item. This message is emitted upon a request for the next script item. target_system : System ID (uint8_t) target_c...
Message encoding a mission script item. This message is emitted upon a request for the next script item. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) seq : Sequence (uint16_t) ...
def script_item_send(self, target_system, target_component, seq, name, force_mavlink1=False): ''' Message encoding a mission script item. This message is emitted upon a request for the next script item. target_system : System ID (uint8_t) ...
Request script item with the sequence number seq. The response of the system to this message should be a SCRIPT_ITEM message. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) seq ...
def script_request_send(self, target_system, target_component, seq, force_mavlink1=False): ''' Request script item with the sequence number seq. The response of the system to this message should be a SCRIPT_ITEM message. target_system ...
Request the overall list of mission items from the system/component. target_system : System ID (uint8_t) target_component : Component ID (uint8_t)
def script_request_list_send(self, target_system, target_component, force_mavlink1=False): ''' Request the overall list of mission items from the system/component. target_system : System ID (uint8_t) target_component : Component ID (u...
This message is emitted as response to SCRIPT_REQUEST_LIST by the MAV to get the number of mission scripts. target_system : System ID (uint8_t) target_component : Component ID (uint8_t) count : Number of script ite...
def script_count_send(self, target_system, target_component, count, force_mavlink1=False): ''' This message is emitted as response to SCRIPT_REQUEST_LIST by the MAV to get the number of mission scripts. target_system : System ID (uint8_t) ...
This message informs about the currently active SCRIPT. seq : Active Sequence (uint16_t)
def script_current_send(self, seq, force_mavlink1=False): ''' This message informs about the currently active SCRIPT. seq : Active Sequence (uint16_t) ''' return self.send(self.script_current_encode(seq), force_mavli...
generate version.h
def generate_version_h(directory, xml): '''generate version.h''' f = open(os.path.join(directory, "version.h"), mode='w') t.write(f,''' /** @file * @brief MAVLink comm protocol built from ${basename}.xml * @see http://mavlink.org */ #pragma once #ifndef MAVLINK_VERSION_H #define MAVLINK_VERSION_H #def...
generate main header per XML file
def generate_main_h(directory, xml): '''generate main header per XML file''' f = open(os.path.join(directory, xml.basename + ".h"), mode='w') t.write(f, ''' /** @file * @brief MAVLink comm protocol generated from ${basename}.xml * @see http://mavlink.org */ #pragma once #ifndef MAVLINK_${basename_upper}_...
generate per-message header for a XML file
def generate_message_h(directory, m): '''generate per-message header for a XML file''' f = open(os.path.join(directory, 'mavlink_msg_%s.h' % m.name_lower), mode='w') t.write(f, ''' #pragma once // MESSAGE ${name} PACKING #define MAVLINK_MSG_ID_${name} ${id} MAVPACKED( typedef struct __mavlink_${name_lower...
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, filecmp hlist = { "0.9": [ 'protocol.h', 'mavlink_helpers.h', 'mavlink_types.h', 'checksum.h' ], "1.0": [ 'protocol.h', 'mavlink_helpers.h', 'mavlink_types.h', 'checksum.h', '...
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 C implementation in directory %s" % directory) mavparse.mkdir_p(directory) if xml.little_endian: xml.mavlink_endian = "MAVLINK_LITTLE_ENDIAN" els...
generate complete MAVLink C implemenation
def generate(basename, xml_list): '''generate complete MAVLink C implemenation''' for idx in range(len(xml_list)): xml = xml_list[idx] xml.xml_idx = idx generate_one(basename, xml) copy_fixed_headers(basename, xml_list[0])
Updates Pose3d.
def update(self): ''' Updates Pose3d. ''' pos = Pose3d() if self.hasproxy(): pose = self.proxy.getPose3DData() pos.yaw = self.quat2Yaw(pose.q0, pose.q1, pose.q2, pose.q3) pos.pitch = self.quat2Pitch(pose.q0, pose.q1, pose.q2, pose.q3) ...
Returns last Pose3d. @return last JdeRobotTypes Pose3d saved
def getPose3d(self): ''' Returns last Pose3d. @return last JdeRobotTypes Pose3d saved ''' self.lock.acquire() pose = self.pose self.lock.release() return pose
Translates from Quaternion to Roll. @param qw,qx,qy,qz: Quaternion values @type qw,qx,qy,qz: float @return Roll value translated from Quaternion
def quat2Roll (self, qw, qx, qy, qz): ''' Translates from Quaternion to Roll. @param qw,qx,qy,qz: Quaternion values @type qw,qx,qy,qz: float @return Roll value translated from Quaternion ''' rotateXa0=2.0*(qy*qz + qw*qx) rotateXa1=qw*qw - qx*qx - qy*q...
kill speech dispatcher processs
def kill_speech_dispatcher(self): '''kill speech dispatcher processs''' if not 'HOME' in os.environ: return pidpath = os.path.join(os.environ['HOME'], '.speech-dispatcher', 'pid', 'speech-dispatcher.pid') if os.path.exists(pidpath): ...
unload module
def unload(self): '''unload module''' self.settings.set('speech', 0) if self.mpstate.functions.say == self.mpstate.functions.say: self.mpstate.functions.say = self.old_mpstate_say_function self.kill_speech_dispatcher()
speak some text
def say_speechd(self, text, priority='important'): '''speak some text''' ''' http://cvs.freebsoft.org/doc/speechd/ssip.html see 4.3.1 for priorities''' import speechd self.speech = speechd.SSIPClient('MAVProxy%u' % os.getpid()) self.speech.set_output_module('festival') se...