Esempio n. 1
0
    def __init__(self, dead_zone=0.05, hot_zone=0.05):
        """
        Discover and initialise a PiHut controller connected to this computer.

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` in the controller.
        """
        super(PiHut, self).__init__(controls=[
            Button("Select", 314, sname='select'),
            Button("Left Stick", 317, sname='ls'),
            Button("Right Stick", 318, sname='rs'),
            Button("Start", 315, sname='start'),
            Button("L1", 310, sname='l1'),
            Button("L2", 312, sname='l2'),
            Button("R1", 311, sname='r1'),
            Button("R2", 313, sname='r2'),
            Button("Triangle", 308, sname='triangle'),
            Button("Circle", 305, sname='circle'),
            Button("Cross", 304, sname='cross'),
            Button("Square", 307, sname='square'),
            Button("Analog", 316, sname='home'),
            CentredAxis("Left Vertical", 255, 0, 1, sname='ly'),
            CentredAxis("Right Vertical", 255, 0, 5, sname='ry'),
            CentredAxis("Left Horizontal", 0, 255, 0, sname='lx'),
            CentredAxis("Right Horizontal", 0, 255, 2, sname='rx'),
            TriggerAxis("Left Trigger", 0, 255, 9, sname='lt'),
            TriggerAxis("Right Trigger", 0, 255, 10, sname='rt'),
            BinaryAxis("D-pad Horizontal", 16, b1name='dleft',
                       b2name='dright'),
            BinaryAxis("D-pad Vertical", 17, b1name='dup', b2name='ddown')
        ],
                                    dead_zone=dead_zone,
                                    hot_zone=hot_zone)
Esempio n. 2
0
    def __init__(self, dead_zone=0.05, hot_zone=0.05):
        """
        Create a new Nintendo Switch Joycon controller instance

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        """
        super(SwitchJoyConRight, self).__init__(controls=[
            Button("X", 305, sname="circle"),
            Button("Y", 307, sname="triangle"),
            Button("B", 306, sname="square"),
            Button("A", 304, sname="cross"),
            Button("Left Stick", 315, sname="ls"),
            Button("Home", 316, sname="home"),
            Button("Plus", 313, sname="start"),
            Button("SL", 308, sname="l1"),
            Button("SR", 309, sname="r1"),
            CentredAxis("Left Horizontal", -1, 1, 16, sname="lx"),
            CentredAxis("Left Vertical", 1, -1, 17, sname="ly")
        ],
                                                dead_zone=dead_zone,
                                                hot_zone=hot_zone)
Esempio n. 3
0
    def __init__(self, dead_zone=0.05, hot_zone=0.05):
        """
        Create a new SF30 Pro driver

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` in the controller.
        """
        super(SF30Pro, self).__init__(
            controls=[
                TriggerAxis("Right Trigger", 0, 255, 9, sname='rt'),
                TriggerAxis("Left Trigger", 0, 255, 10, sname='lt'),
                CentredAxis("Right Vertical", 255, 0, 5, sname='ry'),
                CentredAxis("Left Horizontal", 0, 255, 0, sname='lx'),
                CentredAxis("Left Vertical", 255, 0, 1, sname='ly'),
                CentredAxis("Right Horizontal", 0, 255, 2, sname='rx'),
                BinaryAxis("D-pad Horizontal", 16, b1name='dleft', b2name='dright'),
                BinaryAxis("D-pad Vertical", 17, b1name='ddown', b2name='dup'),
                Button("B", 304, sname='circle'),
                Button("A", 305, sname='cross'),
                Button("Mode", 306, sname='home'),
                Button("X", 307, sname='triangle'),
                Button("Y", 308, sname='square'),
                Button("L1", 310, sname='l1'),
                Button("R1", 311, sname='r1'),
                Button("L2", 312, sname='l2'),
                Button("R2", 313, sname='r2'),
                Button("Select", 314, sname='select'),
                Button("Start", 315, sname='start'),
                Button("Left Stick", 317, sname='ls'),
                Button("Right Stick", 318, sname='rs')
            ],
            dead_zone=dead_zone,
            hot_zone=hot_zone)
Esempio n. 4
0
    def __init__(self, dead_zone=0.05, hot_zone=0.05):
        """
        Create a new Rock Candy driver

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` in the controller.
        """
        super(RockCandy, self).__init__(
            controls=[
                Button("6 Dot", 306, sname='circle'),
                Button("5 Dot", 305, sname='cross'),
                Button("4 Dot", 304, sname='square'),
                Button("3 Dot", 307, sname='triangle'),
                Button("Home", 316, sname='home'),
                Button("Select", 312, sname='select'),
                Button("Start", 313, sname='start'),
                Button("L1", 308, sname='l1'),
                Button("R1", 309, sname='r1'),
                Button("L2", 310, sname='l2'),
                Button("R2", 311, sname='r2'),
                Button("Left Stick", 314, sname='ls'),
                Button("Right Stick", 315, sname='rs'),
                CentredAxis("Left Horizontal", 0, 255, 0, sname='lx'),
                CentredAxis("Left Vertical", 0, 255, 1, invert=True, sname='ly'),
                CentredAxis("Right Horizontal", 0, 255, 2, sname='rx'),
                CentredAxis("Right Vertical", 0, 255, 5, invert=True, sname='ry'),
                BinaryAxis("D-pad Horizontal", 16, b1name='dleft', b2name='dright'),
                BinaryAxis("D-pad Vertical", 17, b1name='dup', b2name='ddown')
            ],
            dead_zone=dead_zone,
            hot_zone=hot_zone)
Esempio n. 5
0
    def __init__(self, dead_zone=0.1, hot_zone=0.05):
        """
        Create a new xbox one s controller instance

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        """
        super(WiredXBoxOneSPad, self).__init__(controls=[
            Button("X", 307, sname='square'),
            Button("Y", 308, sname='triangle'),
            Button("B", 305, sname='circle'),
            Button("A", 304, sname='cross'),
            Button("Right Stick", 318, sname='rs'),
            Button("Left Stick", 317, sname='ls'),
            Button("View", 314, sname='select'),
            Button("Menu", 315, sname='start'),
            Button("XBox", 316, sname='home'),
            Button("LB", 310, sname='l1'),
            Button("RB", 311, sname='r1'),
            CentredAxis("Left Horizontal", -32768, 32768, 0, sname='lx'),
            CentredAxis("Left Vertical",
                        -32768,
                        32768,
                        1,
                        invert=True,
                        sname='ly'),
            CentredAxis("Right Horizontal", -32768, 32768, 3, sname='rx'),
            CentredAxis("Right Vertical",
                        -32768,
                        32768,
                        4,
                        invert=True,
                        sname='ry'),
            TriggerAxis("Left Trigger",
                        0,
                        1023,
                        2,
                        sname='lt',
                        button_sname='l2',
                        button_trigger_value=0.2),
            TriggerAxis("Right Trigger",
                        0,
                        1023,
                        5,
                        sname='rt',
                        button_sname='r2',
                        button_trigger_value=0.2),
            BinaryAxis("D-pad Horizontal", 16, b1name='dleft',
                       b2name='dright'),
            BinaryAxis("D-pad Vertical", 17, b1name='dup', b2name='ddown')
        ],
                                               dead_zone=dead_zone,
                                               hot_zone=hot_zone)
Esempio n. 6
0
    def __init__(self, dead_zone=0.1, hot_zone=0.05):
        """
        Create a new steam controller

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        """
        super(WiiRemotePro,
              self).__init__(vendor_id=WII_REMOTE_PRO_VENDOR,
                             product_id=WII_REMOTE_PRO_PRODUCT,
                             controls=[
                                 Button("X", 307, sname='triangle'),
                                 Button("Y", 308, sname='square'),
                                 Button("A", 305, sname='circle'),
                                 Button("B", 304, sname='cross'),
                                 Button("Right Stick", 318, sname='rs'),
                                 Button("Left Stick", 317, sname='ls'),
                                 Button("Select", 314, sname='select'),
                                 Button("Start", 315, sname='start'),
                                 Button("Home", 316, sname='home'),
                                 Button("L", 310, sname='l1'),
                                 Button("R", 311, sname='r1'),
                                 Button("LZ", 312, sname='l2'),
                                 Button("RZ", 313, sname='r2'),
                                 Button("D Up", 544, sname='dup'),
                                 Button("D Right", 547, sname='dright'),
                                 Button("D Down", 545, sname='ddown'),
                                 Button("D Left", 546, sname='dleft'),
                                 CentredAxis("Left Horizontal",
                                             -1000,
                                             1000,
                                             0,
                                             sname='lx'),
                                 CentredAxis("Left Vertical",
                                             -1000,
                                             1000,
                                             1,
                                             invert=True,
                                             sname='ly'),
                                 CentredAxis("Right Horizontal",
                                             -1000,
                                             1000,
                                             3,
                                             sname='rx'),
                                 CentredAxis("Right Vertical",
                                             -1000,
                                             1000,
                                             4,
                                             invert=True,
                                             sname='ry'),
                             ],
                             dead_zone=dead_zone,
                             hot_zone=hot_zone)
Esempio n. 7
0
    def __init__(self, dead_zone=0.1, hot_zone=0.05):
        """
        Create a new xbox one controller instance
        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        """
        super(WirelessXBoxOnePad, self).__init__(controls=[
            Button("BTN_NORTH", 307, sname='square'),
            Button("BTN_WEST", 308, sname='triangle'),
            Button("BTN_B", 305, sname='circle'),
            Button("BTN_A", 304, sname='cross'),
            Button("BTN_THUMBR", 318, sname='rs'),
            Button("BTN_THUMBL", 317, sname='ls'),
            Button("BTN_SELECT", 314, sname='select'),
            Button("BTN_START", 315, sname='start'),
            Button("BTN_MODE", 316, sname='home'),
            Button("BTN_TL", 310, sname='l1'),
            Button("BTN_TR", 311, sname='r1'),
            CentredAxis("ABS_X", -32768, 32767, 0, sname='lx'),
            CentredAxis("ABS_Y", -32768, 32767, 1, invert=True, sname='ly'),
            CentredAxis("ABS_RX", -32768, 32767, 3, sname='rx'),
            CentredAxis("ABS_RY", -32768, 32767, 4, invert=True, sname='ry'),
            TriggerAxis("ABS_Z",
                        0,
                        1023,
                        2,
                        sname='lt',
                        button_sname='l2',
                        button_trigger_value=0.2),
            TriggerAxis("ABS_RZ",
                        0,
                        1023,
                        5,
                        sname='rt',
                        button_sname='r2',
                        button_trigger_value=0.2),
            BinaryAxis("ABS_HAT0X", 16, b1name='dleft', b2name='dright'),
            BinaryAxis("ABS_HAT0Y", 17, b1name='dup', b2name='ddown')
        ],
                                                 dead_zone=dead_zone,
                                                 hot_zone=hot_zone)

        @staticmethod
        def registration_ids():
            """
            :return: list of (vendor_id, product_id) for this controller
            """
            return [(0x45e, 0x2d1)]

        def __repr__(self):
            return 'Microsoft X-Box One pad'
Esempio n. 8
0
    def __init__(self, dead_zone=0.05, hot_zone=0.05):
        """
        Create a new DualShock4 driver

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` in the controller.
        """
        super(DualShock4, self).__init__(vendor_id=DS4_VENDOR_ID,
                                         product_id=DS4_PRODUCT_ID,
                                         controls=[
                                             Button("Circle", 305, sname='circle'),
                                             Button("Cross", 304, sname='cross'),
                                             Button("Square", 308, sname='square'),
                                             Button("Triangle", 307, sname='triangle'),
                                             Button("Home (PS)", 316, sname='home'),
                                             Button("Share", 314, sname='select'),
                                             Button("Options", 315, sname='start'),
                                             Button("Trackpad", 'touch272', sname='ps4_pad'),
                                             Button("L1", 310, sname='l1'),
                                             Button("R1", 311, sname='r1'),
                                             Button("L2", 312, sname='l2'),
                                             Button("R2", 313, sname='r2'),
                                             Button("Left Stick", 317, sname='ls'),
                                             Button("Right Stick", 318, sname='rs'),
                                             CentredAxis("Left Horizontal", 0, 255, 0, sname='lx'),
                                             CentredAxis("Left Vertical", 0, 255, 1, invert=True, sname='ly'),
                                             CentredAxis("Right Horizontal", 0, 255, 2, sname='rx'),
                                             CentredAxis("Right Vertical", 0, 255, 5, invert=True, sname='ry'),
                                             TriggerAxis("Left Trigger", 0, 255, 3, sname='lt'),
                                             TriggerAxis("Right Trigger", 0, 255, 4, sname='rt'),
                                             BinaryAxis("D-pad Horizontal", 16, b1name='dleft', b2name='dright'),
                                             BinaryAxis("D-pad Vertical", 17, b1name='dup', b2name='ddown'),
                                             # CentredAxis("Motion 3", -1, 1, 'motion3', sname='zm3'),
                                             CentredAxis("Yaw rate", -2097152, 2097152, 'motion4', sname='yaw_rate',
                                                         invert=True),
                                             # CentredAxis("Motion 5", -1, 1, 'motion5', sname='zm5'),
                                             CentredAxis("Roll", -8500, 8500, 'motion0', sname='roll', invert=True),
                                             # CentredAxis("Motion 1", -1, 1, 'motion1', sname='zm1'),
                                             CentredAxis("Pitch", -8500, 8500, 'motion2', sname='pitch',
                                                         invert=True),
                                             CentredAxis("Touch X", 0, 1920, 'touch53', sname='tx'),
                                             CentredAxis("Touch Y", 0, 942, 'touch54', sname='ty', invert=True)

                                         ],
                                         node_mappings={
                                             'Sony Interactive Entertainment Wireless Controller Touchpad':
                                                 'touch',
                                             'Sony Interactive Entertainment Wireless Controller Motion Sensors':
                                                 'motion',
                                             'Wireless Controller Touchpad': 'touch',
                                             'Wireless Controller Motion Sensors': 'motion'},
                                         dead_zone=dead_zone,
                                         hot_zone=hot_zone)
        self.axes['roll'].hot_zone = 0.2
        self.axes['pitch'].hot_zone = 0.2
Esempio n. 9
0
    def __init__(self, dead_zone=0.05, hot_zone=0.05):
        """
        Create a new Nintendo Switch Joycon controller instance
		Left hand contorller only

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` and
            :class:`approxeng.input.TriggerAxis` in the controller.
        """
        super(SwitchJoyCon_L, self).__init__(vendor_id=SWITCH_VENDOR_ID,
                                             product_id=SWITCH_L_PRODUCT_ID,
                                             controls=[
                                                 Button("Right",
                                                        305,
                                                        sname="circle"),
                                                 Button("Up",
                                                        307,
                                                        sname="triangle"),
                                                 Button("Left",
                                                        306,
                                                        sname="square"),
                                                 Button("Down",
                                                        304,
                                                        sname="cross"),
                                                 Button("Left Stick",
                                                        314,
                                                        sname="ls"),
                                                 Button("Home",
                                                        317,
                                                        sname="home"),
                                                 Button("Minus",
                                                        312,
                                                        sname="start"),
                                                 Button("SL", 308, sname="l1"),
                                                 Button("SR", 309, sname="r1"),
                                                 CentredAxis("Left Horizontal",
                                                             -1,
                                                             1,
                                                             16,
                                                             sname="lx"),
                                                 CentredAxis("Left Vertical",
                                                             1,
                                                             -1,
                                                             17,
                                                             sname="ly")
                                             ],
                                             dead_zone=dead_zone,
                                             hot_zone=hot_zone)
Esempio n. 10
0
 def _parse_centred_axis(axis_string: str) -> CentredAxis:
     name, min, max, code, sname = axis_string.split(SEPARATOR)
     return CentredAxis(name=name,
                        min_raw_value=min,
                        max_raw_value=max,
                        axis_event_code=code,
                        sname=sname)
Esempio n. 11
0
 def centred_axis(axis_name):
     if self.axes[axis_name]:
         axis = self.axes[axis_name]
         return CentredAxis(name=axis_name,
                            min_raw_value=axis.real_min,
                            max_raw_value=axis.real_max,
                            axis_event_code=axis.code,
                            sname=axis_name)
Esempio n. 12
0
    def __init__(self, dead_zone=0.1, hot_zone=0.05):
        """
        Create a new steam controller

        :param float dead_zone:
            Used to set the dead zone for each :class:`~approxeng.input.CentredAxis` and
            :class:`~approxeng.input.TriggerAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`~approxeng.input.CentredAxis` and
            :class:`~approxeng.input.TriggerAxis` in the controller.
        """
        super(SteamController, self).__init__(controls=[
            Button("X", 307, sname='square'),
            Button("Y", 308, sname='triangle'),
            Button("B", 305, sname='circle'),
            Button("A", 304, sname='cross'),
            Button("Right Stick", 318, sname='rs'),
            Button("Left Stick", 317, sname='ls'),
            Button("Left", 314, sname='select'),
            Button("Right", 315, sname='start'),
            Button("Steam", 316, sname='home'),
            Button("LB", 310, sname='l1'),
            Button("RB", 311, sname='r1'),
            CentredAxis("Left Horizontal", -32768, 32768, 0, sname='lx'),
            CentredAxis("Left Vertical",
                        -32768,
                        32768,
                        1,
                        invert=True,
                        sname='ly'),
            CentredAxis("Right Horizontal", -32768, 32768, 3, sname='rx'),
            CentredAxis("Right Vertical",
                        -32768,
                        32768,
                        4,
                        invert=True,
                        sname='ry'),
            TriggerAxis("Left Trigger", 0, 255, 2, sname='lt'),
            TriggerAxis("Right Trigger", 0, 255, 5, sname='rt'),
            BinaryAxis("D-pad Horizontal", 16, b1name='dleft',
                       b2name='dright'),
            BinaryAxis("D-pad Vertical", 17, b1name='dup', b2name='ddown')
        ],
                                              dead_zone=dead_zone,
                                              hot_zone=hot_zone)
Esempio n. 13
0
 def __init__(self, dead_zone=0.05, hot_zone=0.01):
     super(SpaceMousePro, self).__init__(controls=[
         CentredAxis('X', -350, 350, 0, sname='lx'),
         CentredAxis('Y', -350, 350, 1, sname='ly', invert=True),
         CentredAxis('Z', -350, 350, 2, sname='lz', invert=True),
         CentredAxis('Roll', -350, 350, 3, sname='pitch'),
         CentredAxis('Pitch', -350, 350, 4, sname='roll', invert=True),
         CentredAxis('Yaw', -350, 350, 5, sname='yaw'),
         Button('Menu', 256, sname='menu'),
         Button('Alt', 279, sname='alt'),
         Button('Ctrl', 281, sname='ctrl'),
         Button('Shift', 280, sname='shift'),
         Button('Esc', 278, sname='esc'),
         Button('1', 268, sname='1'),
         Button('2', 269, sname='2'),
         Button('3', 270, sname='3'),
         Button('4', 271, sname='4'),
         Button('Rotate', 264, sname='rotate'),
         Button('T', 258, sname='t'),
         Button('F', 261, sname='f'),
         Button('R', 260, sname='r'),
         Button('Lock', 282, sname='lock'),
         Button('Fit', 257, sname='fit')
     ],
                                         dead_zone=dead_zone,
                                         hot_zone=hot_zone)
Esempio n. 14
0
    def __init__(self, dead_zone=0.05, hot_zone=0.05):
        """
        Create a new DualShock4 driver

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` in the controller.
        """
        super(DualShock4, self).__init__(vendor_id=DS4_VENDOR_ID,
                                         product_id=DS4_PRODUCT_ID,
                                         controls=[
                                             Button("Circle", 306, sname='circle'),
                                             Button("Cross", 305, sname='cross'),
                                             Button("Square", 304, sname='square'),
                                             Button("Triangle", 307, sname='triangle'),
                                             Button("Home (PS)", 316, sname='home'),
                                             Button("Share", 312, sname='select'),
                                             Button("Options", 313, sname='start'),
                                             Button("Trackpad", 317, sname='ps4_pad'),
                                             Button("L1", 308, sname='l1'),
                                             Button("R1", 309, sname='r1'),
                                             Button("L2", 310, sname='l2'),
                                             Button("R2", 311, sname='r2'),
                                             Button("Left Stick", 314, sname='ls'),
                                             Button("Right Stick", 315, sname='rs'),
                                             CentredAxis("Left Horizontal", 0, 255, 0, sname='lx'),
                                             CentredAxis("Left Vertical", 0, 255, 1, invert=True, sname='ly'),
                                             CentredAxis("Right Horizontal", 0, 255, 2, sname='rx'),
                                             CentredAxis("Right Vertical", 0, 255, 5, invert=True, sname='ry'),
                                             TriggerAxis("Left Trigger", 0, 255, 3, sname='lt'),
                                             TriggerAxis("Right Trigger", 0, 255, 4, sname='rt'),
                                             BinaryAxis("D-pad Horizontal", 16, b1name='dleft', b2name='dright'),
                                             BinaryAxis("D-pad Vertical", 17, b1name='dup', b2name='ddown')
                                         ],
                                         dead_zone=dead_zone,
                                         hot_zone=hot_zone)
Esempio n. 15
0
    def __init__(self, dead_zone=0.05, hot_zone=0.0):
        """
        Discover and initialise a PS3 SixAxis controller connected to this computer.

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` in the controller.
        """
        super(DualShock3, self).__init__(vendor_id=DS3_VENDOR_ID,
                                         product_id=DS3_PRODUCT_ID,
                                         controls=[
                                             Button("Select", 288, sname='select'),
                                             Button("Left Stick", 289, sname='ls'),
                                             Button("Right Stick", 290, sname='rs'),
                                             Button("Start", 291, sname='start'),
                                             Button("D Up", 292, sname='dup'),
                                             Button("D Right", 293, sname='dright'),
                                             Button("D Down", 294, sname='ddown'),
                                             Button("D Left", 295, sname='dleft'),
                                             Button("L2", 296, sname='l2'),
                                             Button("R2", 297, sname='r2'),
                                             Button("L1", 298, sname='l1'),
                                             Button("R1", 299, sname='r1'),
                                             Button("Triangle", 300, sname='triangle'),
                                             Button("Circle", 301, sname='circle'),
                                             Button("Cross", 302, sname='cross'),
                                             Button("Square", 303, sname='square'),
                                             Button("Home (PS)", 704, sname='home'),
                                             CentredAxis("Left Vertical", 0, 255, 1, invert=True, sname='ly'),
                                             CentredAxis("Right Vertical", 0, 255, 5, invert=True, sname='ry'),
                                             CentredAxis("Left Horizontal", 0, 255, 0, sname='lx'),
                                             CentredAxis("Right Horizontal", 0, 255, 2, sname='rx')
                                         ],
                                         dead_zone=dead_zone,
                                         hot_zone=hot_zone)
Esempio n. 16
0
    def __init__(self, dead_zone=0.05, hot_zone=0.05, **kwargs):
        """
        Create a new WiiMote driver

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` in the controller.
        """
        super(WiiMote, self).__init__(controls=[
            Button("Nunchuck Z", 309, sname="r1"),
            Button("Nunchuck C", 306, sname="r2"),
            Button("Wiimote A", 304, sname="cross"),
            Button("Wiimote B", 305, sname="circle"),
            Button("Wiimote DUp", 103, sname="dup"),
            Button("Wiimote DDown", 108, sname="ddown"),
            Button("Wiimote DLeft", 105, sname="dleft"),
            Button("Wiimote DRight", 106, sname="dright"),
            Button("Wiimote -", 412, sname="select"),
            Button("Wiimote +", 407, sname="start"),
            Button("Wiimote home", 316, sname="home"),
            Button("Wiimote 1", 257, sname="cross"),
            Button("Wiimote 2", 258, sname="circle"),
            CentredAxis("Wiimote Roll", -100, 100, 3, sname="roll"),
            CentredAxis("Wiimote Pitch", -90, 125, 4, sname="pitch"),
            CentredAxis("Wiimote ???", -90, 125, 5, sname="???"),
            CentredAxis("Nunchuck Y", -100, 100, 17, sname="ry"),
            CentredAxis("Nunchuck X", -100, 100, 16, sname="rx"),
            CentredAxis("Classic lx", -32, 32, 18, sname="lx"),
            CentredAxis("Classic ly", -32, 32, 19, sname="ly"),
            CentredAxis("Classic rx", -32, 32, 20, sname="rx"),
            CentredAxis("Classic ry", -32, 32, 21, sname="ly"),
            Button("Classic x", 307, sname="square"),
            Button("Classic y", 308, sname="triangle"),
            Button("Classic zr", 313, sname="r2"),
            Button("Classic zl", 312, sname="l2"),
        ],
                                      dead_zone=dead_zone,
                                      hot_zone=hot_zone,
                                      **kwargs)
Esempio n. 17
0
 def __init__(self, dead_zone=0.1, hot_zone=0.05, **kwargs):
     super(SteamController, self).__init__(controls=[
         Button("X", 307, sname='square'),
         Button("Y", 308, sname='triangle'),
         Button("B", 305, sname='circle'),
         Button("A", 304, sname='cross'),
         Button("Left", 314, sname='select'),
         Button("Right", 315, sname='start'),
         Button("Steam", 316, sname='home'),
         Button("Left Stick Click", 317, sname='ls'),
         Button("Right Trackpad Click", 318, sname='rs'),
         Button("Right Trackpad Touch", 290, sname='rtouch'),
         Button("Left Trackpad Touch", 289, sname='dtouch'),
         Button('Top Left Trigger', 310, sname='l1'),
         Button('Mid Left Trigger', 312, sname='l2'),
         Button('Bottom Left Trigger', 336, sname='l3'),
         Button('Top Right Trigger', 311, sname='r1'),
         Button('Mid Right Trigger', 313, sname='r2'),
         Button('Bottom Right Trigger', 337, sname='r3'),
         Button('D-pad left', 546, sname='dleft'),
         Button('D-pad right', 547, sname='dright'),
         Button('D-pad up', 544, sname='dup'),
         Button('D-pad down', 545, sname='ddown'),
         CentredAxis("Left Stick Horizontal", -32768, 32768, 0, sname='lx'),
         CentredAxis("Left Stick Vertical", 32768, -32768, 1, sname='ly'),
         CentredAxis("Right Trackpad Horizontal",
                     -32768,
                     32768,
                     3,
                     sname='rx'),
         CentredAxis("Right Trackpad Vertical",
                     32768,
                     -32768,
                     4,
                     sname='ry'),
         CentredAxis("Left Trackpad Horizontal",
                     -32768,
                     32768,
                     16,
                     sname='dx'),
         CentredAxis("Left Trackpad Vertical",
                     32768,
                     -32768,
                     17,
                     sname='dy'),
         TriggerAxis("Left Trigger", 0, 255, 21, sname='lt'),
         TriggerAxis("Right Trigger", 0, 255, 20, sname='rt')
     ],
                                           dead_zone=dead_zone,
                                           hot_zone=hot_zone,
                                           **kwargs)
Esempio n. 18
0
    def __init__(self, dead_zone=0.05, hot_zone=0.0, **kwargs):
        """
        Discover and initialise a PS3 SixAxis controller connected to this computer.

        :param float dead_zone:
            Used to set the dead zone for each :class:`approxeng.input.CentredAxis` in the controller.
        :param float hot_zone:
            Used to set the hot zone for each :class:`approxeng.input.CentredAxis` in the controller.
        """
        super(DualShock3, self).__init__(
            controls=[
                Button("Select", 314, sname='select'),
                Button("Left Stick", 317, sname='ls'),
                Button("Right Stick", 318, sname='rs'),
                Button("Start", 315, sname='start'),
                Button("D Up", 544, sname='dup'),
                Button("D Right", 547, sname='dright'),
                Button("D Down", 545, sname='ddown'),
                Button("D Left", 546, sname='dleft'),
                Button("L2", 312, sname='l2'),
                Button("R2", 313, sname='r2'),
                Button("L1", 310, sname='l1'),
                Button("R1", 311, sname='r1'),
                Button("Triangle", 307, sname='triangle'),
                Button("Circle", 305, sname='circle'),
                Button("Cross", 304, sname='cross'),
                Button("Square", 308, sname='square'),
                Button("Home (PS)", 316, sname='home'),
                TriggerAxis("Left Trigger", 0, 255, 2, sname='lt'),
                TriggerAxis("Right Trigger", 0, 255, 5, sname='rt'),
                CentredAxis("Left Vertical", 255, 0, 1, sname='ly'),
                CentredAxis("Right Vertical", 255, 0, 4, sname='ry'),
                CentredAxis("Left Horizontal", 0, 255, 0, sname='lx'),
                CentredAxis("Right Horizontal", 0, 255, 3, sname='rx'),
                CentredAxis("Motion 0", 127, -128, 'motion0', sname='roll'),
                CentredAxis("Motion 2", 127, -128, 'motion2', sname='pitch'),
            ],
            node_mappings={
                'Sony PLAYSTATION(R)3 Controller Motion Sensors': 'motion'
            },
            dead_zone=dead_zone,
            hot_zone=hot_zone,
            **kwargs)
        self.axes['roll'].hot_zone = 0.2
        self.axes['pitch'].hot_zone = 0.2