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)
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)
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)
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)
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
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'
def _parse_binary_axes(d: Dict) -> List: """ Extract binary axis definitions from the config. The corresponding YAML form is: .. code-block:: yaml binary_axes: - D-pad Horizontal:16:dleft:dright - D-pad Vertical:17:dup:ddown Each axis definition contains NAME:CODE:BUTTON_SNAME_LOW:BUTTON_SNAME_HIGH :param d: config dict built from the YAML source :return: list of :class:`~approxeng.input.BinaryAxis` """ if 'binary_axes' in d: axes = list([ BinaryAxis(*axis_string.split(SEPARATOR)) for axis_string in d['binary_axes'] ]) LOGGER.info(f'binary axes : {[axis.name for axis in axes]}') return axes LOGGER.info('binary axes : NONE') return []
def binary_axis(axis_name, b1name, b2name): if self.axes[axis_name] and self.buttons[ b1name] is None and self.buttons[b2name] is None: axis = self.axes[axis_name] return BinaryAxis(name=axis_name, axis_event_code=axis.code, b1name=b1name if not axis.invert else b2name, b2name=b2name if not axis.invert else b1name)
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)
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)