tools/joystick/README.md
Hardware needed: device running openpilot, laptop, joystick (optional)
With joystick_control, you can connect your laptop to your comma device over the network and debug controls using a joystick or keyboard. joystick_control uses inputs which supports many common gamepads and joysticks.
The car must be off, and openpilot must be offroad before starting joystick_control.
SSH into your comma device and start joystick_control with the following command:
tools/joystick/joystick_control.py --keyboard
The available buttons and axes will print showing their key mappings. In general, the WASD keys control gas and brakes and steering torque in 5% increments.
Plug the joystick into your comma three aux USB-C port. Then, SSH into the device and start joystick_control.py.
In order to use a joystick over the network, we need to run joystick_control locally from your laptop and have it send testJoystick packets over the network to the comma device.
# on your comma device
echo -n "1" > /data/params/d/JoystickDebugMode
testJoystick packets sent from your laptop so that openpilot can receive them:
# on your comma device
cereal/messaging/bridge {LAPTOP_IP} testJoystick
# on your laptop
export ZMQ=1
tools/joystick/joystick_control.py
Now start your car and openpilot should go into joystick mode with an alert on startup! The status of the axes will display on the alert, while button statuses print in the shell.
Make sure the conditions are met in the panda to allow controls (e.g. cruise control engaged). You can also make a modification to the panda code to always allow controls.