def __init__(self): self.input_queue = multiproc.Queue() self.rl = None self.console = wxconsole.MessageConsole(title='MAVExplorer') self.exit = False self.status = MEStatus() self.settings = MPSettings([ MPSetting('marker', str, '+', 'data marker', tab='Graph'), MPSetting('condition', str, None, 'condition'), MPSetting('xaxis', str, None, 'xaxis'), MPSetting('linestyle', str, None, 'linestyle'), MPSetting('show_flightmode', bool, True, 'show flightmode'), MPSetting('sync_xzoom', bool, True, 'sync X-axis zoom'), MPSetting('sync_xmap', bool, True, 'sync X-axis zoom for map'), MPSetting('legend', str, 'upper left', 'legend position'), MPSetting('legend2', str, 'upper right', 'legend2 position'), MPSetting('title', str, None, 'Graph title'), MPSetting('debug', int, 0, 'debug level'), MPSetting('paramdocs', bool, True, 'show param docs'), ]) self.mlog = None self.mav_param = None self.filename = None self.command_map = command_map self.completions = { "set": ["(SETTING)"], "condition": ["(VARIABLE)"], "graph": [ '(VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE)' ], "map": ['(VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE) (VARIABLE)'], "param": ['download', 'check', 'help (PARAMETER)'], } self.aliases = {} self.graphs = [] self.flightmode_selections = [] self.last_graph = GraphDefinition(self.settings.title, '', '', [], None) #pipe to the wxconsole for any child threads (such as the save dialog box) self.parent_pipe_recv_console, self.child_pipe_send_console = multiproc.Pipe( duplex=False) #pipe for creating graphs (such as from the save dialog box) self.parent_pipe_recv_graph, self.child_pipe_send_graph = multiproc.Pipe( duplex=False) self.param_help = param_help.ParamHelp() tConsoleWrite = threading.Thread(target=self.pipeRecvConsole) tConsoleWrite.daemon = True tConsoleWrite.start() tGraphWrite = threading.Thread(target=self.pipeRecvGraph) tGraphWrite.daemon = True tGraphWrite.start()
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 __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)
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
def __init__(self, mpstate): super(CameraAirModule, self).__init__(mpstate, "camera_air", "cuav camera control (air)", public=True) self.running = False self.unload_event = threading.Event() self.unload_event.clear() self.capture_thread = None self.scan_thread = None self.transmit_thread = None self.airstart_triggered = False self.terrain_alt = None self.handled_timestamps = {} self.imagefilenamemapping = {} self.posmapping = {} self.is_armed = True self.lz = cuav_landingregion.LandingZone() from MAVProxy.modules.lib.mp_settings import MPSettings, MPSetting self.camera_settings = MPSettings([ MPSetting('roll_stabilised', bool, False, 'Roll Stabilised'), MPSetting('roll_limit', float, 0, 'Roll stabilisation limit'), MPSetting('minspeed', int, 20, 'For airstart, minimum speed for capture to start'), MPSetting('minalt', int, 30, 'MinAltitude of images', range=(0, 10000), increment=1), MPSetting('rotate180', bool, False, 'rotate images by 180', tab='Capture2'), MPSetting('ignoretimestamps', bool, False, 'Ignore image timestamps', tab='Capture2'), MPSetting('camparms', str, None, 'camera parameters file (json) in cuav package', tab='Imaging'), MPSetting( 'imagefile', str, None, 'latest captured image', tab='Imaging'), MPSetting('filter_type', str, 'simple', 'Filter Type', choice=['simple'], tab='Imaging'), MPSetting( 'blue_emphasis', bool, False, 'BlueEmphasis', tab='Imaging'), MPSetting('use_capture_time', bool, True, 'Use Capture Time (false for sim)', tab='Simulation'), MPSetting('target_latitude', float, 0, 'filter detected images to latitude', tab='Filter to Location'), MPSetting('target_longitude', float, 0, 'filter detected images to longitude', tab='Filter to Location'), MPSetting('target_radius', float, 0, 'filter detected images to radius', tab='Filter to Location'), MPSetting( 'gcs_address', str, "", 'GCS Addresses in RemIP:RemPort:LocalPort:Bandwidth format (127.0.0.1:1440:1234:45, ...)', tab='GCS'), MPSetting('qualitysend', int, 90, 'Compression Quality for send', range=(1, 100), increment=1, tab='GCS'), MPSetting('transmit', bool, True, 'Transmit Enable for thumbnails', tab='GCS'), MPSetting('maxqueue', int, 50, 'Maximum images queue', tab='GCS'), MPSetting('thumbsize', int, 60, 'Thumbnail Size', range=(10, 200), increment=1), MPSetting('minscore', int, 1000, 'Min Score to pass detection', range=(0, 100000), increment=1, tab='Imaging'), MPSetting('clock_sync', bool, False, 'GPS Clock Sync'), MPSetting('m_minscore', int, 20000, 'Min Score to pass detection on mavlink', range=(0, 100000), increment=1, tab='Imaging'), MPSetting('m_bandwidth', int, 500, 'max bandwidth on mavlink', increment=1, tab='GCS'), MPSetting('m_maxqueue', int, 5, 'Maximum images queue for mavlink', tab='GCS'), MPSetting('preview', bool, True, 'enable camera preview window', tab='Imaging'), MPSetting('previewquality', int, 40, 'Compression Quality for preview', range=(1, 100), increment=1, tab='Imaging'), MPSetting('previewscale', int, 5, 'preview downscaling', range=(1, 10), increment=1, tab='Imaging'), MPSetting('previewfreq', int, 4, 'preview image frequency', range=(1, 10), increment=1, tab='Imaging'), ], title='Camera Settings') self.image_settings = MPSettings([ MPSetting('MinRegionArea', float, 0.15, range=(0, 100), increment=0.05, digits=2, tab='Image Processing'), MPSetting('MaxRegionArea', float, 1.0, range=(0, 100), increment=0.1, digits=1, tab='Image Processing'), MPSetting('MinRegionSize', float, 0.2, range=(0, 100), increment=0.05, digits=2, tab='Image Processing'), MPSetting('MaxRegionSize', float, 1.0, range=(0, 100), increment=0.1, digits=1, tab='Image Processing'), MPSetting('MaxRarityPct', float, 0.02, range=(0, 100), increment=0.01, digits=2, tab='Image Processing'), MPSetting('RegionMergeSize', float, 1.0, range=(0, 100), increment=0.1, digits=1, tab='Image Processing'), ], title='Image Settings') self.capture_count = 0 self.scan_count = 0 self.error_count = 0 self.error_msg = None self.region_count = 0 self.scan_fps = 0 self.scan_queue = multiproc.Queue() self.transmit_queue = multiproc.Queue() self.have_set_gps_time = False self.c_params = None self.jpeg_size = 0 self.xmit_queue = [] self.efficiency = [] self.last_watch = 0 self.boundary = None self.boundary_polygon = None self.bandwidth_used = [] self.rtt_estimate = [] self.bsend = [] #note this is an array of bsends # msend is a BlockSender over MAVLink self.msocket = None self.msend = None self.last_heartbeat = time.time() self.mpos = mav_position.MavInterpolator(backlog=500, gps_lag=0.0) self.joelog = None #cuav_joe.JoeLog(os.path.join(self.settings.imagefile, '..', 'joe.log'), append=self.continue_mode) self.add_command( 'camera', self.cmd_camera, 'camera control', ['<start|stop|status|boundary|airstart>', 'set (CAMERASETTING)']) self.add_completion_function('(CAMERASETTING)', self.camera_settings.completion) # prevent loopback of messages for mtype in ['DATA16', 'DATA32', 'DATA64', 'DATA96']: self.module('link').no_fwd_types.add(mtype) print("camera initialised")