6 from ds4drv.backends
import BluetoothBackend, HidrawBackend
7 from ds4drv.exceptions
import BackendError
20 rospy.loginfo(
'Shutting down...')
21 self.controller.exit()
26 rospy.init_node(
'ds4_driver_node')
28 device_addr = rospy.get_param(
'~device_addr',
None)
29 backend_type = rospy.get_param(
'~backend',
'hidraw')
38 signal.signal(signal.SIGINT, sigint_handler)
40 if backend_type ==
'bluetooth':
41 backend = BluetoothBackend(
Logger(
'backend'))
43 backend = HidrawBackend(
Logger(
'backend'))
47 except BackendError
as err:
49 rospy.signal_shutdown(str(err))
52 for device
in backend.devices:
53 rospy.loginfo(
'Connected to {0}'.format(device.name))
54 if device_addr
in (
None,
'', device.device_addr):
55 controller.setup_device(device)
56 if not controller.is_alive():
58 controller.loop.register_event(
'device-report', controller.cb_report)
60 rospy.loginfo(
"...but it's not the one we're looking for :(")
63 if __name__ ==
'__main__':
def __init__(self, controller)
def __call__(self, signum, frame)