Repo which contains tools to facilitate development and debugging of openpilot.
openpilot-tools and the following setup steps are developed and tested on Ubuntu 16.04, MacOS 10.14.2 and Python 2.7.
-
Install scripts for Ubuntu and Mac OS
Ubuntu script based installation
./install_ubuntu.sh
Mac OS script based installation
./install_mac.sh
-
Clone openpilot if you haven't already
git clone https://github.com/commaai/openpilot.git cd openpilot
For Mac users
Recompile longitudinal_mpc for mac
Navigate to:
cd selfdrive/controls/lib/longitudinal_mpc make clean make
-
Clone tools within openpilot, and install dependencies
git clone https://github.com/commaai/openpilot-tools.git tools cd tools # sudo pip install if not using a venv pip install -r requirements.txt pip install -r ../requirements_openpilot.txt
-
Add openpilot to your
PYTHONPATH
.For bash users:
echo 'export PYTHONPATH="$PYTHONPATH:<path-to-openpilot>"' >> ~/.bashrc source ~/.bashrc
-
Add some folders to root
sudo mkdir /data sudo mkdir /data/params sudo chown $USER /data/params
-
Try out some tools!
Hardware needed: none
unlogger.py
replays data collected with chffrplus or openpilot.
You'll need to download log and camera files into a local directory. Download these from the footer of the comma explorer,cabana or SCP from your device.
Usage:
python replay/unlogger.py <route-name> <path-to-data-directory>
#Example:
#python replay/unlogger.py '99c94dc769b5d96e|2018-11-14--13-31-42' /home/batman/unlogger_data
#Within /home/batman/unlogger_data:
# 99c94dc769b5d96e|2018-11-14--13-31-42--0--fcamera.hevc
# 99c94dc769b5d96e|2018-11-14--13-31-42--0--rlog.bz2
# ...
# In another terminal you can run a debug visualizer:
python replay/ui.py # Define the environmental variable HORIZONTAL is the ui layout is too tall
Hardware needed: panda, giraffe, joystick
Use the panda's OBD-II port to connect with your car and a usb cable to connect the panda to your pc. Also, connect a joystick to your pc. This can be used to test if there is support for steering and breaking "digitally"
joystickd.py
runs a deamon that reads inputs from a joystick and publishes them over zmq.
boardd.py
sends the CAN messages from your pc to the panda.
debug_controls
is a mocked version of controlsd.py
and uses input from a joystick to send controls to your car.
Usage:
python carcontrols/joystickd.py
# In another terminal:
selfdrive/boardd/boardd.py # Make sure the safety setting is hardcoded to ALL_OUTPUT
# In another terminal:
python carcontrols/debug_controls.py
Hardware needed: 2 x panda, debug board, EON.
It is possible to replay CAN messages as they were recorded and forward them to a EON. Connect 2 pandas to the debug board. A panda connects to the PC, the other panda connects to the EON.
Usage:
# With MOCK=1 boardd will read logged can messages from a replay and send them to the panda.
MOCK=1 tools/replay/boardd.py
# In another terminal:
python replay/unlogger.py <route-name> <path-to-data-directory>
Hardware needed: EON, comma Smays.
You can connect your EON to your pc using the Ethernet cable provided with the comma Smays and you'll be able to stream data from your EON, in real time, with low latency. A useful application is being able to stream the raw video frames at 20fps, as captured by the EON's camera.
Usage:
# ssh into the eon and run loggerd with the flag "--stream". In ../selfdrive/manager.py you can change:
# ...
# "loggerd": ("selfdrive/loggerd", ["./loggerd"]),
# ...
# with:
# ...
# "loggerd": ("selfdrive/loggerd", ["./loggerd", "--stream"]),
# ...
# On the PC:
# To receive frames from the EON and re-publish them. Set PYGAME env variable if you want to display the video stream
python streamer/streamerd.py
Workbench by jfrux The driving model by comma
- Documentation: code comments, better tutorials, etc..
- Support for other platforms other than Ubuntu 16.04.
- Performance improvements: the tools have been developed on high-performance workstations (12+ logical cores with 32+ GB of RAM), so they are not optimized for running efficiently. For example,
ui.py
might not be able to run real-time on most PCs. - More tools: anything that you think might be helpful to others.
- Support for native Windows without linux subsystem.