This repository contains the ros2_web_viewer ROS2 package — a web-based 3D robot visualiser that bridges ROS2 topics to a browser via WebSocket using a Three.js frontend.
- Live URDF robot model rendering (box/cylinder/sphere geometries + STL meshes via
package://URIs) - Animated joint states from
/joint_states - TF2 frame transforms (
/tfand/tf_static) - Point cloud visualisation with viridis colourmap and GLSL glow shader
- Camera image stream (JPEG-compressed bridge)
- Modular widget architecture (
data-ros-widget) for multiple 3D canvases and HTML panels per page - HTML panel buttons can call ROS
std_srvs/Triggerservices viadata-trigger-service - Auto-reconnecting WebSocket client
- Chelsea Flower Show botanical theme (warm earth palette, Playfair Display serif font)
The web UI supports a web/assets/background.jpg botanical wallpaper overlay. To enable it:
- Download (or supply) your background image.
- Save it to
src/ros2_web_viewer/web/assets/background.jpg. - Rebuild the package (
colcon build --packages-select ros2_web_viewer).
If the file is absent the CSS gradient fallback renders a matching warm parchment texture.
- Use this repository as a template (top-right corner → Use this template) and specify your owner and package name.
- Open the cloned repository in VSCode — it will prompt you to Reopen in Container.
- The devcontainer will install all workspace dependencies and build the workspace automatically.
# Install Python dependencies
pip3 install fastapi "uvicorn[standard]" numpy opencv-python-headless
# Install ROS2 dependencies
sudo apt install ros-${ROS_DISTRO}-cv-bridge
rosdep install --from-paths src --ignore-src -r -y
# Build
colcon build --packages-select ros2_web_viewer
source install/setup.bash
# Run
ros2 launch ros2_web_viewer viewer.launch.pyThen open http://localhost:8080 in a browser.
- Add ROS2 packages to the
src/folder usingros2 pkg create ... - The devcontainer runs as
rootusingros:humbleas the base image - Dependencies listed in
package.xmlfiles are installed automatically viarosdep - See
src/ros2_web_viewer/README.mdfor full package documentation