openpilot0/tools
Kacper Rączy d062a97a26 webrtcd: webrtc streaming server (audio/video/cereal) (#30186)
* WebRTCClient and WebRTCServer abstractions

* webrtc client implementation

* Interactive test scripts

* Send localDescriptions as offer/asnwer, as they are different

* Tracks need to be added after setting remote description for multi-cam streaming to work

* Remove WebRTCStreamingMetadata

* Wait for tracks

* Move stuff to separate files, rename some things

* Refactor everything, create WebRTCStreamBuilder for both offer and answers

* ta flight done time to grind

* wait for incoming tracks and channels

* Dummy track and frame reader track. Fix timing.

* dt based on camera type

* first trial of the new api

* Fix audio track

* methods for checking for incoming tracks

* Web migration part 2

* Fixes for stream api

* use rtc description for web.py

* experimental cereal proxy

* remove old code from bodyav

* fix is_started

* serialize session description

* fix audio

* messaging channel wrapper

* fix audiotrack

* h264 codec preference

* Add codec preference to tracks

* override sdp codecs

* add logging

* Move cli stuff to separate file

* slight cleanup

* Fix audio track

* create codec_mime inside force_codec function

* fix incoming media estimation

* move builders to __init__

* stream updates following builders

* Update example script

* web.py support for new builder

* web speaker fixes

* StreamingMediaInfo API

* Move things around

* should_add_data_channel rename

* is_connected_and_ready

* fix linter errors

* make cli executable

* remove dumb comments

* logging support

* fix parse_info_from_offer

* improve type annotations

* satisfy linters

* Support for waiting for disconnection

* Split device tracks into video/audio files. Move audio speaker to audio.py

* default dt for dummy video track

* Fix cli

* new speaker fixes

* Remove almost all functionality from web.py

* webrtcd

* continue refactoring web.py

* after handling joystick reset in controlsd with #30409, controls are not necessary anymore

* ping endpoint

* Update js files to at least support what worked previously

* Fixes after some tests on the body

* Streaming fixes

* Remove the use of WebRTCStreamBuilder. Subclass use is now required

* Add todo

* delete all streams on shutdown

* Replace lastPing with lastChannelMessageTime

* Update ping text only if rtc is still on

* That should affect the chart too

* Fix paths in web

* use protocol in SSLContext

* remove warnings since aiortc is not used directly anymore

* check if task is done in stop

* remove channel handler wrapper, since theres only one channel

* Move things around

* Moved webrtc abstractions to separate repository

* Moved webrtcd to tools/webrtc

* Update imports

* Add bodyrtc as dependency

* Add webrtcd to process_config

* Remove usage of DummyVideoStreamTrack

* Add main to webrtcd

* Move webrtcd to system

* Fix imports

* Move cereal proxy logic outside of runner

* Incoming proxy abstractions

* Add some tests

* Make it executable

* Fix process config

* Fix imports

* Additional tests. Add tests to pyproject.toml

* Update poetry lock

* New line

* Bump aiortc to 1.6.0

* Added teleoprtc_repo as submodule, and linked its source dir

* Add init file to webrtc module

* Handle aiortc warnings

* Ignore deprecation warnings

* Ignore resource warning too

* Ignore the warnings

* find free port for test_webrtcd

* Start process inside the test case

* random sleep test

* test 2

* Test endpoint function instead

* Update comment

* Add system/webrtc to release

* default arguments for body fields

* Add teleoprtc to release

* Bump teleoprtc

* Exclude teleoprtc from static analysis

* Use separate event loop for stream session tests
old-commit-hash: f058b5d64e
2023-12-01 21:13:37 -08:00
..
bodyteleop webrtcd: webrtc streaming server (audio/video/cereal) (#30186) 2023-12-01 21:13:37 -08:00
cabana cabana: fix missing opendbc files (#30555) 2023-11-30 20:46:31 -08:00
camerastream compressed_vipc: fix issues with VisionIpcServer in ZMQ mode (#30115) 2023-09-30 18:45:45 -07:00
joystick remove big gif file (#30029) 2023-09-23 21:16:45 -07:00
latencylogger add openpilot prefix to imports (#29498) 2023-08-20 20:49:55 -07:00
lib Pytest: more post-test path cleanup (#30556) 2023-11-30 09:55:48 -08:00
plotjuggler C3: add gps_vs_llk plotjuggler layout (#30448) 2023-11-13 09:19:23 -08:00
replay replay: get api url from env var (#30562) 2023-11-30 10:42:18 -08:00
scripts improved script for fetching images from routes (#30089) 2023-09-29 23:55:41 -07:00
serial
sim locationd: remove models unused in openpilot (#30481) 2023-11-22 13:25:29 -08:00
ssh Update SSH README 2023-06-08 21:05:38 -07:00
tuning add openpilot prefix to imports (#29498) 2023-08-20 20:49:55 -07:00
webcam Linter: remove pylint (#29611) 2023-08-24 16:30:54 -07:00
zookeeper Precommit: ensure executable bit is set (#29784) 2023-09-05 16:33:26 -07:00
CTF.md
README.md add lfs pull to setup instructions 2023-11-02 22:36:53 -07:00
__init__.py
install_python_dependencies.sh Update Python packages and pre-commit hooks (#30269) 2023-10-18 20:18:08 -07:00
install_ubuntu_dependencies.sh cabana: socketcan support (#27952) 2023-08-23 10:50:11 -07:00
mac_setup.sh macOS: add prompt about support in setup script (#29939) 2023-09-15 19:05:32 -07:00
ubuntu_setup.sh macOS: generate .pyenvrc during setup (#29698) 2023-08-29 16:01:04 -07:00

README.md

openpilot tools

System Requirements

openpilot is developed and tested on Ubuntu 20.04, which is the primary development target aside from the supported embedded hardware.

Running natively on any other system is not recommended and will require modifications. On Windows you can use WSL, and on macOS or incompatible Linux systems, it is recommended to use the dev containers.

Native setup on Ubuntu 20.04

1. Clone openpilot

NOTE: This repository uses Git LFS for large files. Ensure you have Git LFS installed and set up before cloning or working with it.

Either do a partial clone for faster download:

git clone --filter=blob:none --recurse-submodules --also-filter-submodules https://github.com/commaai/openpilot.git

or do a full clone:

git clone --recurse-submodules https://github.com/commaai/openpilot.git

2. Run the setup script

cd openpilot
git lfs pull
tools/ubuntu_setup.sh

Activate a shell with the Python dependencies installed:

poetry shell

3. Build openpilot

scons -u -j$(nproc)

Dev Container on any Linux or macOS

openpilot supports Dev Containers. Dev containers provide customizable and consistent development environment wrapped inside a container. This means you can develop in a designated environment matching our primary development target, regardless of your local setup.

Dev containers are supported in multiple editors and IDEs, including Visual Studio Code. Use the following guide to start using them with VSCode.

X11 forwarding on macOS

GUI apps like ui or cabana can also run inside the container by leveraging X11 forwarding. To make use of it on macOS, additional configuration steps must be taken. Follow these steps to setup X11 forwarding on macOS.

WSL on Windows

Windows Subsystem for Linux (WSL) should provide a similar experience to native Ubuntu. WSL 2 specifically has been reported by several users to be a seamless experience.

Follow these instructions to setup the WSL and install the Ubuntu-20.04 distribution. Once your Ubuntu WSL environment is setup, follow the Linux setup instructions to finish setting up your environment. See these instructions for running GUI apps.

NOTE: If you are running WSL and any GUIs are failing (segfaulting or other strange issues) even after following the steps above, you may need to enable software rendering with LIBGL_ALWAYS_SOFTWARE=1, e.g. LIBGL_ALWAYS_SOFTWARE=1 selfdrive/ui/ui.

CTF

Learn about the openpilot ecosystem and tools by playing our CTF.

Directory Structure

├── ubuntu_setup.sh     # Setup script for Ubuntu
├── mac_setup.sh        # Setup script for macOS
├── cabana/             # View and plot CAN messages from drives or in realtime
├── joystick/           # Control your car with a joystick
├── lib/                # Libraries to support the tools and reading openpilot logs
├── plotjuggler/        # A tool to plot openpilot logs
├── replay/             # Replay drives and mock openpilot services
├── scripts/            # Miscellaneous scripts
├── serial/             # Tools for using the comma serial
├── sim/                # Run openpilot in a simulator
├── ssh/                # SSH into a comma device
└── webcam/             # Run openpilot on a PC with webcams