コード例 #1
0
        loop.quit()

if __name__ == "__main__":
    parser = gs.get_default_command_line_parser(True, False, True, preferences_name="console.ini")
    options, args = parser.parse_args()

    global led, led_cmd
    led = 4
    led_cmd = "ON"
    try:
        led = int(args[1])
        led_cmd = args[0].upper()
    except:
        pass

    m = messages.MessagesFile(path=options.messages, debug=options.debug)
    m.parse()

    c = config.Config(filename=options.preferences)

    global source
    global loop

    loop = gobject.MainLoop()
    source = source.UAVSource(c, m, options)
    cmd = fms.CommandManager(source.communication)
    source.connect("source-connected", uav_connected, m, cmd)
    source.connect_to_uav()
    loop.run()

コード例 #2
0
ファイル: statusbar.py プロジェクト: robotang/wasp
    def __init__(self, source):
        gtk.Statusbar.__init__(self)

        hb = gtk.HBox()

        #connected indicator
        self._c = indicators.ColorLabelBox("C:",
                                red_message="Communication not connected",
                                yellow_message="Communication connected, not receiving data",
                                green_message="Communication connected, receiving data")
        hb.pack_start(self._c)
        #status indicator
        #self._s = indicators.ColorLabelBox("S:",
        #                        red_message="UAV Error",
        #                        yellow_message="UAV Warning",
        #                        green_message="UAV OK")
        #hb.pack_start(self._s)
        #autopilot indicator
        self._a = indicators.ColorLabelBox("A:",
                                red_message="Autopilot disabled",
                                green_message="Autopilot enabled")
        hb.pack_start(self._a)
        #manual indicator
        self._m = indicators.ColorLabelBox("M:",
                                red_message="Manual control disabled",
                                green_message="Manual control enabled")
        hb.pack_start(self._m)

        #msgs/second        
        self._ms = gs.ui.make_label("MSG/S: ?", 10)
        hb.pack_start(self._ms, False, False)
        #ping time
        self._pt = gs.ui.make_label("PING: ?", 12)
        hb.pack_start(self._pt, False, False)
        #GPS LL
        self._gps_coords = gs.ui.make_label("GPS: +???.???? N, +???.???? E")
        hb.pack_start(self._gps_coords, False, False)
        #Altitude
        self._alt = gs.ui.make_label("ALT: ?????.? m")
        hb.pack_start(self._alt, False, False)
        #Distance from home
        self._dist = gs.ui.make_label("DIST: ?????.? m")
        hb.pack_start(self._dist, False, False)
        self._home_lat = None
        self._home_lon = None
        #debug
        self._debug = indicators.ColorLabelBox(text="", fade=True)
        self._debug.set_blank()

        hb.pack_start(self._debug, True, True)
       
        self.pack_start(hb, False, False)
        self.reorder_child(hb, 0)

        source.connect("source-connected", self._connected_update_icon)
        source.connect("source-link-status-change", self._connected_update_icon)

        source.register_interest(self._on_gps, 0, "GPS_LLH")
        source.register_interest(self._on_debug, 0, "DEBUG", "DEBUG_FLOAT")

        gobject.timeout_add(1000, self._check_messages_per_second, source)
コード例 #3
0
ファイル: statusbar.py プロジェクト: MorS25/wasp
    def __init__(self, source):
        gtk.Statusbar.__init__(self)

        hb = gtk.HBox()

        #connected indicator
        self._c = indicators.ColorLabelBox("C:",
                                red_message="Communication not connected",
                                yellow_message="Communication connected, not receiving data",
                                green_message="Communication connected, receiving data")
        hb.pack_start(self._c)
        #status indicator
        #self._s = indicators.ColorLabelBox("S:",
        #                        red_message="UAV Error",
        #                        yellow_message="UAV Warning",
        #                        green_message="UAV OK")
        #hb.pack_start(self._s)
        #autopilot indicator
        self._a = indicators.ColorLabelBox("A:",
                                red_message="Autopilot disabled",
                                green_message="Autopilot enabled")
        hb.pack_start(self._a)
        #manual indicator
        self._m = indicators.ColorLabelBox("M:",
                                red_message="Manual control disabled",
                                green_message="Manual control enabled")
        hb.pack_start(self._m)

        #msgs/second        
        self._ms = gs.ui.make_label("MSG/S: ?", 10)
        hb.pack_start(self._ms, False, False)
        #ping time
        self._pt = gs.ui.make_label("PING: ?", 12)
        hb.pack_start(self._pt, False, False)
        #GPS LL
        self._gps_coords = gs.ui.make_label("GPS: +???.???? N, +???.???? E")
        hb.pack_start(self._gps_coords, False, False)
        #Altitude
        self._alt = gs.ui.make_label("ALT: ?????.? m")
        hb.pack_start(self._alt, False, False)
        #Distance from home
        self._dist = gs.ui.make_label("DIST: ?????.? m")
        hb.pack_start(self._dist, False, False)
        self._home_lat = None
        self._home_lon = None
        #debug
        self._debug = indicators.ColorLabelBox(text="", fade=True)
        self._debug.set_blank()

        hb.pack_start(self._debug, True, True)
       
        self.pack_start(hb, False, False)
        self.reorder_child(hb, 0)

        source.connect("source-connected", self._connected_update_icon)
        source.connect("source-link-status-change", self._connected_update_icon)

        source.register_interest(self._on_gps, 0, "GPS_LLH")
        source.register_interest(self._on_debug, 0, *wasp.DEBUG_MESSAGES.keys())

        gobject.timeout_add(1000, self._check_messages_per_second, source)