ROS Package bob_av_tools
A collection of audio-visual utilities for the Bob ROS 2 ecosystem. This package provides high-fidelity web-based video rendering, interactive terminal overlays, and robust FIFO stream orchestration.
Key Features
webvideo: Offscreen browser renderer for overlays. Output: FIFO (raw BGRA) or ROS Image.webview: Interactive GUI terminal sibling with chat support (“Uplink Echo”).webscreen: Capture any URL (website/local) offscreen. Supports authentications & automation.write_fifo.sh: Helper script to pipe external streams (FFmpeg, etc.) into a managed FIFO.Robust FIFO Reconnect: Advanced producer/consumer handling (
O_NONBLOCK+fcntl) for seamless hot-swapping of readers.Nexus Aesthetic: Built-in “Nexus Style” UI: Cyberspace/Terminal design with typewriter effects.
Installation
1. Python Dependencies
pip install PySide6 numpy
2. System Requirements (QtWebEngine/Chromium)
The renderer requires several X11 and GL libraries for offscreen rendering:
sudo apt update && sudo apt install -y \
libxcb-cursor0 libgbm1 libnss3 libasound2 libxcomposite1 \
libxdamage1 libxrandr2 libxcb-icccm4 libxcb-image0 \
libxcb-keysyms1 libxcb-render-util0 libgl1 libegl1
Node Documentation
1. Web Video Renderer (webvideo)
Renders a localized HTML overlay for LLM text streams. Optimized for embedding in video mixers.
ROS API
Subscribed Topics:
llm_stream(std_msgs/msg/String): Incoming text chunks.
Published Topics:
web_image(sensor_msgs/msg/Image): Rendered frames (Requirescv_bridge).
Configuration (Parameters & Env Vars)
Parameter |
Env Var Equivalent |
Default |
Description |
|---|---|---|---|
|
|
|
Path to the base HTML template. |
|
|
|
Rendering width (px). |
|
|
|
Rendering height (px). |
|
|
|
Frames per second. |
|
|
|
Path to output raw BGRA pipe. |
|
|
|
Subscription queue size. |
|
|
|
Path to a custom .css file. |
2. Webview Terminal (webview)
Interactive window for human-in-the-loop interaction. Opens a GUI window on the primary display.
ROS API
Subscribed Topics:
llm_stream(std_msgs/msg/String): Feed for the terminal display.
Published Topics:
chat_out(std_msgs/msg/String): Published when a user sends a message in the UI.
Configuration (Parameters & Env Vars)
Parameter |
Env Var Equivalent |
Default |
Description |
|---|---|---|---|
|
|
|
Path to the base HTML template. |
|
|
|
Window width (px). |
|
|
|
Window height (px). |
|
|
|
Enable/Disable chat input area. |
|
|
|
Subscription queue size. |
|
|
|
Path to a custom .css file. |
3. URL Screen Capture (webscreen)
Renders any external URL or local file offscreen. Ideal for capturing Twitch chats, dashboards, or static web pages.
ROS API
Published Topics:
webscreen_image(sensor_msgs/msg/Image): Captures views as ROS messages.
Configuration (Parameters & Env Vars)
Parameter |
Env Var Equivalent |
Default |
Description |
|---|---|---|---|
|
|
|
Required. URL or |
|
|
|
Viewport width. |
|
|
|
Viewport height. |
|
|
|
Capture rate. |
|
|
|
Path to raw BGRA pipe. |
|
|
|
Path to JSON cookies for auth. |
|
|
|
Path to JS automation script. |
|
|
|
Initial horizontal scroll. |
|
|
|
Initial vertical scroll. |
Configuration Examples
Pre-Script JS (pre_script)
Automate page actions (dismiss banners, focus elements, click buttons) before capture begins.
// Hide persistent cookie banners or ads
const banner = document.querySelector('.cookie-consent');
if (banner) banner.style.display = 'none';
// Force dark mode if supported
document.documentElement.setAttribute('data-theme', 'dark');
console.log('Page automation complete.');
Custom Styling (override_css)
Override the default “Nexus” look for webvideo and webview.
Layout Variables
You can override these in your .css file for precise layout control without worrying about CSS specificity of IDs:
--root-padding: Padding of the outer container (default:40pxfor overlay,20pxfor webview).--content-padding: Padding inside the terminal/content area (default:20px).--content-bg: Background color/alpha of the content area.--content-border-left: Style of the left accent border.--line-height: Line height in the content area (default:1.4).--cursor-display: (Webview only) Toggle cursor visibility (default:inline-block, set tononeto hide).--chat-bg: (Webview only) Background of the chat input area.
Example:
:root {
--accent-color: #ff00ff; /* Cyberpink */
--root-padding: 0px; /* Full screen capture */
--content-bg: transparent;
--content-border-left: none;
}
Utility Scripts
write_fifo.sh
Orchestrates streams from external processes (like FFmpeg) into managed FIFOs.
# Capture webcam and pipe to FIFO for sdlviz
ffmpeg -i /dev/video0 -f rawvideo -pixel_format bgr24 - | \
ros2 run bob_av_tools write_fifo.sh --path /tmp/cam_fifo
Advanced Configuration (Chromium Flags)
The nodes automatically set QTWEBENGINE_CHROMIUM_FLAGS for headless compatibility. You can override these via the environment if needed:
export QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox --disable-setuid-sandbox --disable-gpu"
License
Apache-2.0