From 05cfa6de9d4cdfea6b6b0dab028fe315cf9e4e98 Mon Sep 17 00:00:00 2001 From: dzid26 Date: Tue, 6 Feb 2024 21:19:01 +0000 Subject: [PATCH] camerastream instructions (#31326) * camerastream instructions * Update README.md * Update tools/README.md --------- Co-authored-by: Adeeb Shihadeh old-commit-hash: 0af62eb3b0027ae1081074cb486554a366dff6fc --- tools/README.md | 1 + tools/camerastream/README.md | 66 +++++++++++++++++++++++++++ tools/camerastream/compressed_vipc.py | 4 ++ 3 files changed, 71 insertions(+) create mode 100644 tools/camerastream/README.md diff --git a/tools/README.md b/tools/README.md index 315db3a75f..361a27deda 100644 --- a/tools/README.md +++ b/tools/README.md @@ -68,6 +68,7 @@ Learn about the openpilot ecosystem and tools by playing our [CTF](/tools/CTF.md ├── 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 +├── camerastream/ # Cameras stream over the network ├── joystick/ # Control your car with a joystick ├── lib/ # Libraries to support the tools and reading openpilot logs ├── plotjuggler/ # A tool to plot openpilot logs diff --git a/tools/camerastream/README.md b/tools/camerastream/README.md new file mode 100644 index 0000000000..76133f07cd --- /dev/null +++ b/tools/camerastream/README.md @@ -0,0 +1,66 @@ +# Camera stream + +`compressed_vipc.py` connects to a remote device running openpilot, decodes the video streams, and republishes them over VisionIPC. + +## Usage + +### On the device +SSH into the device and run following in separate terminals: + +`cd /data/openpilot/cereal/messaging && ./bridge` + +`cd /data/openpilot/system/loggerd && ./encoderd` + +`cd /data/openpilot/system/camerad && ./camerad` + +Note that both the device and your PC must be on the same openpilot commit. + +Alternatively paste this as a single command: +``` +( + cd /data/openpilot/cereal/messaging/ + ./bridge & + + cd /data/openpilot/system/camerad/ + ./camerad & + + cd /data/openpilot/system/loggerd/ + ./encoderd & + + wait +) ; trap 'kill $(jobs -p)' SIGINT +``` +Ctrl+C will stop all three processes. + +### On the PC +Decode the stream with `compressed_vipc.py`: + +```cd ~/openpilot/tools/camerastream && ./compressed_vipc.py ``` + +To actually display the stream, run `watch3` in separate terminal: + +```cd ~/openpilot/selfdrive/ui/ && ./watch3``` + +## compressed_vipc.py usage +``` +$ python compressed_vipc.py -h +usage: compressed_vipc.py [-h] [--nvidia] [--cams CAMS] [--silent] addr + +Decode video streams and broadcast on VisionIPC + +positional arguments: + addr Address of comma three + +options: + -h, --help show this help message and exit + --nvidia Use nvidia instead of ffmpeg + --cams CAMS Cameras to decode + --silent Suppress debug output +``` + + +## Example: +``` +cd ~/openpilot/tools/camerastream && ./compressed_vipc.py comma-ffffffff --cams 0 +cd ~/openpilot/selfdrive/ui/ && ./watch3 +``` diff --git a/tools/camerastream/compressed_vipc.py b/tools/camerastream/compressed_vipc.py index 6e4ad3866e..f1a6f230fa 100755 --- a/tools/camerastream/compressed_vipc.py +++ b/tools/camerastream/compressed_vipc.py @@ -12,6 +12,10 @@ from cereal.visionipc import VisionIpcServer, VisionStreamType V4L2_BUF_FLAG_KEYFRAME = 8 +# start encoderd +# also start cereal messaging bridge +# then run this "./compressed_vipc.py " + ENCODE_SOCKETS = { VisionStreamType.VISION_STREAM_ROAD: "roadEncodeData", VisionStreamType.VISION_STREAM_WIDE_ROAD: "wideRoadEncodeData",