Skip to content

Add a doctor view camera feed with delay monitoring - #36

Merged
yassinsolim merged 10 commits into
mainfrom
feature/camera-feed
Oct 10, 2026
Merged

yassinsolim merged 10 commits into
mainfrom
feature/camera-feed

Conversation

@yassinsolim

Copy link
Copy Markdown
Member

Covers item 9 from the Oct 3 list: a camera feed in the ground station with measured delay, ready for whatever camera Gianna's research (#33) settles on. A USB webcam stands in for the doctor's camera until then. Stacked on #28, because RViz's Doctor View display goes after #28's teleop display.

What changes

  • New package waybionic_camera:
    • camera_bridge: plain Python plus OpenCV, run on the computer the camera is plugged into. It captures with MJPG at 1080p30 by default, stamps each frame with its capture time, and sends JPEG frames over TCP (port 47310). This also covers Windows, where Docker can't reach USB cameras. A video file or stream URL can stand in for a camera.
    • camera_receiver: publishes the frames still compressed on /doctor_view/left/image_raw/compressed, with /doctor_view/left/camera_info. Frames carry their capture stamp and doctor_view_left_optical_frame, following Camera and Controller Research/Recommendation #33's topic and frame names.
    • latency_monitor: reports camera.doctor_view on /diagnostics with the frame rate and the capture-to-arrival delay (mean, min, max, jitter) over 5 s. It warns below 25 fps or above 100 ms. With log_csv, it logs every frame (number, capture time, arrival time, delay, size), the fields Camera and Controller Research/Recommendation #33 lists for the benchtop test. It takes any image topic, compressed or raw, so it can measure the chosen camera's ROS driver later.
  • Ground station launch:
    • camera:=true includes the camera launch. Related arguments: camera_bind, which must be 0.0.0.0 in Docker, and camera_log.
    • The diagnostics panel switches to live data when the camera is on.
  • RViz: a Doctor View image display, off by default, that uses the compressed transport. compressed_image_transport is now a dependency.
  • BuildInstructions: a "Doctor View Camera" section covering Windows and Linux, and how to measure the full delay with a stopwatch on screen.

How I tested it

  • Unit tests:
    • frame stream round trip through a socket, a truncated frame, and bad headers;
    • frame rate, delay and jitter statistics;
    • receiver and monitor nodes: 40 frames over TCP become stamped CompressedImage messages and a camera.doctor_view report.
  • Windows to Docker, end to end: I ran the real bridge on Windows (Store Python 3.13 with opencv-python 5.0) and played a 1280×720 test video into the containerised ground station through the published port.
    • Diagnostics: 30.0 fps, delay 2 ms (min 2, max 5, jitter 0.3) at 1280x720.
    • ros2 topic hz: 29.99 Hz.
    • The CSV log held all 397 frames.
  • docker compose --progress plain build test: all 329 tests pass.
  • Not tested with a physical webcam, because this PC has none, or with RViz's image panel on screen.

The reported delay covers bridge to ROS. Time spent inside the camera and on the display needs the stopwatch method in the docs.

Reviewed in #24, which was merged into its stacked base after #23 had
already been squash-merged into main, so it never reached main. This is
the same change, applied to main.

Drive the five joints with an Xbox controller through placeholder MKS
SERVO42D/57D CAN drives, simulated until the real drives are connected.
On Windows, a Python-only XInput bridge sends the controller state to
the new wslg-teleop Compose service over UDP. The RViz camera follows
the tool so the end of the arm stays in view; follow_camera:=false keeps
a fixed view.

teleop and joy_source use And/Or/Equals substitutions, so teleop:=True
works like IfCondition. The new nodes receive use_sim_time, and the UDP
receiver reads at most 100 packets per poll so a flood cannot starve its
other callbacks.
A USB webcam stands in for the doctor's camera. camera_bridge captures
it with OpenCV on the computer it is plugged into, which works on
Windows as well, where Docker can't reach USB. It sends JPEG frames
stamped with their capture time over TCP.

In the ground station, camera_receiver publishes them still compressed
on /doctor_view/left/image_raw/compressed with camera_info, following
Gianna's proposed topic names. latency_monitor reports the frame rate
and the capture-to-arrival delay (mean, min, max, jitter) as
camera.doctor_view, and can log every frame to CSV. latency_monitor
works for any image topic, so it can measure the chosen camera's
driver too.

camera:=true starts both from the ground station launch, the panel then
uses live diagnostics, and RViz has a Doctor View image display that
is off by default.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 19:26
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 27 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1668303a-6bd7-41f6-8f95-43f19134ac82

📥 Commits

Reviewing files that changed from the base of the PR and between c69db98 and 6679bbe.


📒 Files selected for processing (20)
  • BuildInstructions.md
  • waybionic_bringup/launch/ground_station.launch.py
  • waybionic_bringup/package.xml
  • waybionic_bringup/rviz/waybionic_unified.rviz
  • waybionic_camera/launch/camera.launch.py
  • waybionic_camera/package.xml
  • waybionic_camera/resource/waybionic_camera
  • waybionic_camera/setup.cfg
  • waybionic_camera/setup.py
  • waybionic_camera/test/test_camera_nodes.py
  • waybionic_camera/test/test_flake8.py
  • waybionic_camera/test/test_frames.py
  • waybionic_camera/test/test_latency.py
  • waybionic_camera/test/test_pep257.py
  • waybionic_camera/waybionic_camera/__init__.py
  • waybionic_camera/waybionic_camera/camera_bridge.py
  • waybionic_camera/waybionic_camera/camera_receiver.py
  • waybionic_camera/waybionic_camera/frames.py
  • waybionic_camera/waybionic_camera/latency.py
  • waybionic_camera/waybionic_camera/latency_monitor.py

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The RViz transport configuration prevents display of the feed, and stream URL handling can stall or distort latency.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds a doctor-view camera pipeline with ROS publishing, latency diagnostics, RViz integration, and setup documentation.

Changes:

  • Adds TCP camera bridge, receiver, and latency monitoring.
  • Integrates camera launch and diagnostics into the ground station.
  • Adds tests and Windows/Linux usage guidance.
File Description
BuildInstructions.md Documents camera setup and latency measurement.
waybionic_bringup/​launch/​ground_station.launch.py Adds camera launch controls.
waybionic_bringup/​package.xml Adds camera package dependency.
waybionic_bringup/​rviz/​waybionic_unified.rviz Adds Doctor View display.
waybionic_camera/​launch/​camera.launch.py Launches receiver and monitor.
waybionic_camera/​package.xml Defines ROS dependencies.
waybionic_camera/​resource/​waybionic_camera Registers the package.
waybionic_camera/​setup.cfg Configures script installation.
waybionic_camera/​setup.py Defines package metadata and executables.
waybionic_camera/​test/​test_camera_nodes.py Tests end-to-end ROS behavior.
waybionic_camera/​test/​test_flake8.py Adds style checks.
waybionic_camera/​test/​test_frames.py Tests frame protocol handling.
waybionic_camera/​test/​test_latency.py Tests latency statistics.
waybionic_camera/​test/​test_pep257.py Adds docstring checks.
waybionic_camera/​waybionic_camera/​__init__.py Initializes the Python package.
waybionic_camera/​waybionic_camera/​camera_bridge.py Captures and streams camera frames.
waybionic_camera/​waybionic_camera/​camera_receiver.py Publishes received frames to ROS.
waybionic_camera/​waybionic_camera/​frames.py Implements TCP frame encoding.
waybionic_camera/​waybionic_camera/​latency.py Calculates sliding-window statistics.
waybionic_camera/​waybionic_camera/​latency_monitor.py Publishes diagnostics and CSV logs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

A camera, or a stream URL, that stops sending frames now ends the
bridge with an error instead of retrying a seek forever. Only a local
video file is rewound and paced at --fps.
@yassinsolim
yassinsolim changed the base branch from feature/xbox-teleop-main to main October 10, 2026 21:11
@yassinsolim
yassinsolim merged commit 8723ac8 into main Oct 10, 2026
14 of 16 checks passed
@yassinsolim
yassinsolim deleted the feature/camera-feed branch November 14, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants