Open sandman opened 4 years ago
run input_example.py test
The gamepad is not detected:
Traceback (most recent call last):
File "input_example.py", line 24, in <module>
main()
File "input_example.py", line 13, in main
gamepad = devices.gamepads[0]
IndexError: list index out of range
Sony updated their company name, hence difference description strings of their controllers.
My fix:
in joystick_ros2.py
FROM:
JOYSTICK_CODE_VALUE_MAP = { 'Microsoft X-Box 360 pad': (XINPUT_CODE_MAP, XINPUT_VALUE_MAP), 'Sony Computer Entertainment Wireless Controller': (PS4_CODE_MAP, PS4_VALUE_MAP), 'Logitech Gamepad F710': (F710_CODE_MAP, F710_VALUE_MAP), 'Microsoft X-Box One pad': (XONE_CODE_MAP, XONE_VALUE_MAP) }
TO:
JOYSTICK_CODE_VALUE_MAP = { 'Microsoft X-Box 360 pad': (XINPUT_CODE_MAP, XINPUT_VALUE_MAP), 'Sony Computer Entertainment Wireless Controller': (PS4_CODE_MAP, PS4_VALUE_MAP), 'Sony Interactive Entertainment Wireless Controller': (PS4_CODE_MAP, PS4_VALUE_MAP), 'Logitech Gamepad F710': (F710_CODE_MAP, F710_VALUE_MAP), 'Microsoft X-Box One pad': (XONE_CODE_MAP, XONE_VALUE_MAP) }
Hi, I am able to view the PS4 gamepad under /dev/input/js0 (and /dev/input/eventX) using the
ds4drv --hidraw
(connected via USB). However when I run the joystick_ros2 node, it does not detect the device:This is because the
inputs
Python package is not detecting the device. This could be becauseds4drv
uses theevdev
interface. Probably there is an incompatibility there with the Python inputs module not supporting my platform (I'm using NVIDIA Jetson). So I tried using the evdev module injoystick_ros2.py
but then that changes the whole way of accessing the input events. I'd appreciate if you have any tips on getting this to work.Thanks.