Hardware needed: comma two devkit, laptop, joystick (optional)
With joystickd, you can connect your laptop to your comma device over the network and debug controls using a joystick or keyboard, however a joystick is recommended for more precise control.
To get started, ssh into your comma device and start joystickd with the following command:
tools/joystick/joystickd.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.
In order to use a joystick over the network, we need to run joystickd locally from your laptop and have it send testJoystick
ZMQ packets over the network to the comma device. First connect a compatible joystick to your PC; joystickd uses inputs which supports many common gamepads and joysticks.
- Connect your laptop to your comma device's hotspot and open a new ssh shell. Since joystickd is being run on your laptop, we need to write a parameter to let controlsd know to start in joystick debug mode:
# on your comma device echo -n "1" > /data/params/d/JoystickDebugMode
- Run bridge with your laptop's IP address. This republishes the
testJoystick
packets sent from your laptop so that openpilot can receive them:# on your comma device cereal/messaging/bridge {LAPTOP_IP} testJoystick
- Finally, start joystickd on your laptop and tell it to publish ZMQ packets over the network:
# on your laptop export ZMQ=1 tools/joystick/joystickd.py
Now start your car and openpilot should go into debug 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.