def param_help_download(self):
     '''download XML files for parameters'''
     files = []
     for vehicle in [
             'Rover', 'ArduCopter', 'ArduPlane', 'ArduSub', 'AntennaTracker'
     ]:
         url = 'http://autotest.ardupilot.org/Parameters/%s/apm.pdef.xml.gz' % vehicle
         path = mp_util.dot_mavproxy("%s.xml" % vehicle)
         files.append((url, path))
         url = 'http://autotest.ardupilot.org/%s-defaults.parm' % vehicle
         if vehicle != 'AntennaTracker':
             # defaults not generated for AntennaTracker ATM
             path = mp_util.dot_mavproxy("%s-defaults.parm" % vehicle)
             files.append((url, path))
     try:
         child = multiproc.Process(target=mp_util.download_files,
                                   args=(files, ))
         child.start()
     except Exception as e:
         print(e)
Example #2
0
    def __init__(self,
                 title='SlipMap',
                 lat=-35.362938,
                 lon=149.165085,
                 width=800,
                 height=600,
                 ground_width=1000,
                 tile_delay=0.3,
                 service="MicrosoftSat",
                 max_zoom=19,
                 debug=False,
                 brightness=0,
                 elevation=False,
                 download=True,
                 show_flightmode_legend=True):

        self.lat = lat
        self.lon = lon
        self.width = width
        self.height = height
        self.ground_width = ground_width
        self.download = download
        self.service = service
        self.tile_delay = tile_delay
        self.debug = debug
        self.max_zoom = max_zoom
        self.elevation = elevation
        self.oldtext = None
        self.brightness = brightness
        self.legend = show_flightmode_legend

        self.drag_step = 10

        self.title = title
        self.event_queue = multiproc.Queue()
        self.object_queue = multiproc.Queue()
        self.close_window = multiproc.Semaphore()
        self.close_window.acquire()
        self.child = multiproc.Process(target=self.child_task)
        self.child.start()
        self._callbacks = set()
    def download_firmware(self, firmware, filename=None):
        url = firmware["url"]

        print("fw: URL: %s" % (url, ))
        if filename is None:
            filename = os.path.basename(url)
        files = []
        files.append((url, filename))
        child = multiproc.Process(target=mp_util.download_files,
                                  args=(files, ))
        child.start()
        tstart = time.time()
        while True:
            if time.time() - tstart > 60:
                print("Download timeout")
            if not child.is_alive():
                break
            print("Waiting for download to compliete...")
            time.sleep(1)

        return filename
Example #4
0
    def display_graph(self, graphdef, flightmode_colourmap=None):
        '''display a graph'''
        if 'mestate' in globals():
            self.mestate.console.write("Expression: %s\n" %
                                       ' '.join(graphdef.expression.split()))
        else:
            self.mestate.child_pipe_send_console.send(
                "Expression: %s\n" % ' '.join(graphdef.expression.split()))
        #mestate.mlog.reduce_by_flightmodes(mestate.flightmode_selections)

        #setup the graph, then pass to a new process and display
        self.mg = grapher.MavGraph(flightmode_colourmap)
        if self.mestate.settings.title is not None:
            self.mg.set_title(self.mestate.settings.title)
        else:
            self.mg.set_title(graphdef.name)
        self.mg.set_marker(self.mestate.settings.marker)
        self.mg.set_condition(self.mestate.settings.condition)
        self.mg.set_xaxis(self.mestate.settings.xaxis)
        self.mg.set_linestyle(self.mestate.settings.linestyle)
        self.mg.set_show_flightmode(self.mestate.settings.show_flightmode)
        self.mg.set_legend(self.mestate.settings.legend)
        self.mg.add_mav(self.mestate.mlog)
        for f in graphdef.expression.split():
            self.mg.add_field(f)
        self.mg.process(self.mestate.flightmode_selections,
                        self.mestate.mlog._flightmodes)
        self.lenmavlist = len(self.mg.mav_list)
        #Important - mg.mav_list is the full logfile and can be very large in size
        #To avoid slowdowns in Windows (which copies the vars to the new process)
        #We need to empty this var when we're finished with it
        self.mg.mav_list = []
        child = multiproc.Process(target=self.mg.show,
                                  args=[
                                      self.lenmavlist,
                                  ],
                                  kwargs={"xlim_pipe": self.xlim_pipe})
        child.start()
        self.xlim_pipe[1].close()
        self.mestate.mlog.rewind()
Example #5
0
def cmd_map(args):
    '''map command'''
    import mavflightview
    #mestate.mlog.reduce_by_flightmodes(mestate.flightmode_selections)
    #setup and process the map
    options = mavflightview.mavflightview_options()
    options.condition = mestate.settings.condition
    options._flightmodes = mestate.mlog._flightmodes
    options.show_flightmode_legend = mestate.settings.show_flightmode
    options.colour_source = 'flightmode'
    if len(args) > 0:
        options.types = ','.join(args)
        if len(options.types) > 1:
            options.colour_source = 'type'
    [path, wp, fen, used_flightmodes, mav_type, instances
     ] = mavflightview.mavflightview_mav(mestate.mlog, options,
                                         mestate.flightmode_selections)
    child = multiproc.Process(
        target=mavflightview.mavflightview_show,
        args=[path, wp, fen, used_flightmodes, mav_type, options, instances])
    child.start()
    mestate.mlog.rewind()
    def __init__(self,
                 title='MPImage',
                 tabs=['TabOne'],
                 width=512,
                 height=512,
                 can_zoom=False,
                 can_drag=False,
                 mouse_events=False,
                 key_events=False,
                 auto_size=False,
                 report_size_changes=False):
        from MAVProxy.modules.lib import multiproc

        self.title = title
        self.tabs = tabs
        self.width = width
        self.height = height
        self.can_zoom = can_zoom
        self.can_drag = can_drag
        self.mouse_events = mouse_events
        self.key_events = key_events
        self.auto_size = auto_size
        self.report_size_changes = report_size_changes
        self.menu = None
        self.popup_menu = None

        self.in_queue = multiproc.Queue()
        self.out_queue = multiproc.Queue()

        self.default_menu = MPMenuSubMenu(
            'View',
            items=[
                MPMenuItem('Fit Window', 'Fit Window', 'fitWindow'),
                MPMenuItem('Full Zoom', 'Full Zoom', 'fullSize')
            ])

        self.child = multiproc.Process(target=self.child_task)
        self.child.start()
        self.set_popup_menu(self.default_menu)
Example #7
0
    def __init__(self, mpstate):
        self.num_wps_expected = 0  #helps me to know if all my waypoints I'm expecting have arrived
        self.wps_received = {}

        self.event_queue = multiproc.Queue()
        self.event_queue_lock = multiproc.Lock()
        self.gui_event_queue = multiproc.Queue()
        self.gui_event_queue_lock = multiproc.Lock()

        self.object_queue = multiproc.Queue()

        self.close_window = multiproc.Semaphore()
        self.close_window.acquire()

        self.child = multiproc.Process(
            target=self.child_task,
            args=(self.event_queue, self.event_queue_lock,
                  self.gui_event_queue, self.gui_event_queue_lock,
                  self.close_window))
        self.child.start()

        self.event_thread = MissionEditorEventThread(self, self.event_queue,
                                                     self.event_queue_lock)
        self.event_thread.start()

        self.mpstate = mpstate
        self.mpstate.miss_editor = self

        self.last_unload_check_time = time.time()
        self.unload_check_interval = 0.1  # seconds

        self.time_to_quit = False
        self.mavlink_message_queue = multiproc.Queue()
        self.mavlink_message_queue_handler = threading.Thread(
            target=self.mavlink_message_queue_handler)
        self.mavlink_message_queue_handler.start()
        self.needs_unloading = False
Example #8
0
def cmd_save(args):
    '''save a graph'''
    child = multiproc.Process(target=save_process, args=[mestate.last_graph, mestate.child_pipe_send_console, mestate.child_pipe_send_graph, mestate.status.msgs])
    child.start()
Example #9
0
def cmd_magfit(args):
    '''fit magnetic field'''
    from MAVProxy.modules.lib import magfit
    mfit = magfit.MagFitUI(mestate.mlog, timestamp_in_range)
    child = multiproc.Process(target=mfit.show)
    child.start()
Example #10
0
def cmd_stats(args):
    '''show status on log'''
    from MAVProxy.modules.lib import msgstats
    child = multiproc.Process(target=msgstats.show_stats, args=[mestate.mlog])
    child.start()
 def show(self):
     t = multiproc.Process(target=self.call)
     t.start()
Example #12
0
 def __init__(self):
     self.parent_pipe, self.child_pipe = multiproc.Pipe()
     self.close_event = multiproc.Event()
     self.close_event.clear()
     self.child = multiproc.Process(target=self.child_task)
     self.child.start()