Пример #1
0
    def __init__(self, conf, source, messages_file, settings_file, groundstation_window):

        if not joystick.list_devices():
            raise plugin.PluginNotSupported("No Joystick (/dev/input/js) devices found")

        config.ConfigurableIface.__init__(self, conf)
        self.autobind_config(
                "device",
                "axis_roll", "axis_pitch", "axis_heading", "axis_thrust",
                "reverse_roll", "reverse_pitch", "reverse_heading", "reverse_thrust",
                "button_motor_start", "button_motor_stop",
                update_state_cb=self._on_joystick_device_set)

        self.joystick = None
        self.joystick_axis_id = None

        self.ui = gtk.VBox()
        self.jsw = joystickui.JoystickWidget(num_axis=4, axis_labels=("R","P","Y","T"), show_range=False)
        self.ui.pack_start(self.jsw, True, True)

        groundstation_window.add_control_widget(
                "Joystick Control",
                self)

        self.source = source
        self.start_motors_message = messages_file.get_message_by_name("MOTORS_START")
        self.stop_motors_message = messages_file.get_message_by_name("MOTORS_STOP")

        self._attitude_vals = [0.0] * self.MAX_AXIS_ID
Пример #2
0
    def get_preference_widgets(self):
        #all following items configuration is saved
        ar = self.build_radio_group("axis_roll", "0", "1", "2", "3", "4", "5",
                                    "6", "7")
        rr = self.build_checkbutton("reverse_roll", label="R")
        ap = self.build_radio_group("axis_pitch", "0", "1", "2", "3", "4", "5",
                                    "6", "7")
        rp = self.build_checkbutton("reverse_pitch", label="R")
        ah = self.build_radio_group("axis_heading", "0", "1", "2", "3", "4",
                                    "5", "6", "7")
        rh = self.build_checkbutton("reverse_heading", label="R")
        at = self.build_radio_group("axis_thrust", "0", "1", "2", "3", "4",
                                    "5", "6", "7")
        rt = self.build_checkbutton("reverse_thrust", label="R")
        bi = self.build_radio_group("button_motor_start", "0", "1", "2", "3",
                                    "4", "5", "6", "7")
        bo = self.build_radio_group("button_motor_stop", "0", "1", "2", "3",
                                    "4", "5", "6", "7")
        es = self.build_combo("device", *joystick.list_devices())

        items = ar + ap + ah + at + [es, rr, rp, rh, rt] + bi + bo

        #the gui looks like
        sg = self.build_sizegroup()
        frame = self.build_frame(None, [
            self.build_label("Joystick Device", es, sg=sg),
            self.build_label("Roll Axis", self.build_hbox(rr, *ar), sg=sg),
            self.build_label("Pitch Axis", self.build_hbox(rp, *ap), sg=sg),
            self.build_label("Heading Axis", self.build_hbox(rh, *ah), sg=sg),
            self.build_label("Thrust Axis", self.build_hbox(rt, *at), sg=sg),
            self.build_label("Motor Start Button", self.build_hbox(*bi),
                             sg=sg),
            self.build_label("Motor Stop Button", self.build_hbox(*bo), sg=sg)
        ])

        hb = gtk.HBox(spacing=5)
        hb.pack_start(frame, True, True)

        jsw = joystickui.JoystickWidget(num_axis=8,
                                        show_uncalibrated=True,
                                        show_buttons=True,
                                        show_range=False)
        jsw.set_joystick(self.joystick)
        hb.pack_start(jsw, False, False)

        #Now add an infobar to show some usage instructions
        info = msgarea.InfoBar(
            primary_text="Match Joystick Channels to Control Axis",
            secondary_text="""\
For each axis on the left, select the corresponding joystick axis on the right.
You should move the selected joystick to see which axis it supports. You
can also reverse the axis be selecting the 'R' check-box.""")
        vb = gtk.VBox(spacing=5)
        vb.pack_start(hb, True, True)
        vb.pack_start(info, False, False)

        return "Joystick", vb, items
Пример #3
0
    def get_preference_widgets(self):
        #all following items configuration is saved
        ar = self.build_radio_group("axis_roll", "0","1","2","3","4","5","6","7")
        rr = self.build_checkbutton("reverse_roll", label="R")
        ap = self.build_radio_group("axis_pitch", "0","1","2","3","4","5","6","7")
        rp = self.build_checkbutton("reverse_pitch", label="R")
        ah = self.build_radio_group("axis_heading", "0","1","2","3","4","5","6","7")
        rh = self.build_checkbutton("reverse_heading", label="R")
        at = self.build_radio_group("axis_thrust", "0","1","2","3","4","5","6","7")
        rt = self.build_checkbutton("reverse_thrust", label="R")
        bi = self.build_radio_group("button_motor_start", "0","1","2","3","4","5","6","7")
        bo = self.build_radio_group("button_motor_stop", "0","1","2","3","4","5","6","7")
        es = self.build_combo("device", *joystick.list_devices())

        items = ar + ap + ah + at + [es, rr, rp, rh, rt] + bi + bo

        #the gui looks like
        sg = self.build_sizegroup()
        frame = self.build_frame(None, [
            self.build_label("Joystick Device", es, sg=sg),
            self.build_label("Roll Axis", self.build_hbox(rr, *ar), sg=sg),
            self.build_label("Pitch Axis", self.build_hbox(rp, *ap), sg=sg),
            self.build_label("Heading Axis", self.build_hbox(rh, *ah), sg=sg),
            self.build_label("Thrust Axis", self.build_hbox(rt, *at), sg=sg),
            self.build_label("Motor Start Button", self.build_hbox(*bi), sg=sg),
            self.build_label("Motor Stop Button", self.build_hbox(*bo), sg=sg)
        ])

        hb = gtk.HBox(spacing=5)
        hb.pack_start(frame, True, True)

        jsw = joystickui.JoystickWidget(num_axis=8, show_uncalibrated=True, show_buttons=True, show_range=False)
        jsw.set_joystick(self.joystick)
        hb.pack_start(jsw, False, False)

        #Now add an infobar to show some usage instructions
        info = msgarea.InfoBar(
                    primary_text="Match Joystick Channels to Control Axis",
                    secondary_text="""\
For each axis on the left, select the corresponding joystick axis on the right.
You should move the selected joystick to see which axis it supports. You
can also reverse the axis be selecting the 'R' check-box.""")
        vb = gtk.VBox(spacing=5)
        vb.pack_start(hb, True, True)
        vb.pack_start(info, False, False)

        return "Joystick", vb, items
Пример #4
0
    def __init__(self, conf, source, messages_file, groundstation_window):

        if not joystick.list_devices():
            raise plugin.PluginNotSupported("No Joystick (/dev/input/js) devices found")

        config.ConfigurableIface.__init__(self, conf)
        self.autobind_config(
                "device",
                "axis_roll", "axis_pitch", "axis_heading", "axis_thrust",
                update_state_cb=self._on_joystick_device_set)
    
        self.control = fms.ControlManager(source, messages_file)

        self.joystick = None
        self.joystick_id = None

        groundstation_window.add_control_widget(
                "Joystick Control",
                self._build_ui())
Пример #5
0
    def __init__(self, conf, source, messages_file, settings_file,
                 groundstation_window):

        if not joystick.list_devices():
            raise plugin.PluginNotSupported(
                "No Joystick (/dev/input/js) devices found")

        config.ConfigurableIface.__init__(self, conf)
        self.autobind_config("device",
                             "axis_roll",
                             "axis_pitch",
                             "axis_heading",
                             "axis_thrust",
                             "reverse_roll",
                             "reverse_pitch",
                             "reverse_heading",
                             "reverse_thrust",
                             "button_motor_start",
                             "button_motor_stop",
                             update_state_cb=self._on_joystick_device_set)

        self.joystick = None
        self.joystick_axis_id = None

        self.ui = gtk.VBox()
        self.jsw = joystickui.JoystickWidget(num_axis=4,
                                             axis_labels=("R", "P", "Y", "T"),
                                             show_range=False)
        self.ui.pack_start(self.jsw, True, True)

        groundstation_window.add_control_widget("Joystick Control", self)

        self.source = source
        self.start_motors_message = messages_file.get_message_by_name(
            "MOTORS_START")
        self.stop_motors_message = messages_file.get_message_by_name(
            "MOTORS_STOP")

        self._attitude_vals = [0.0] * self.MAX_AXIS_ID