A comprehensive ROS 2 variable logging and visualization system for RoboMaster projects. This system allows you to log variables from ROS 2 nodes and visualize/modify them in real-time through a modern web interface.
Before setting up, ensure you have:
-
ROS 2 Humble (or later) installed and configured
- macOS: Install via Homebrew or follow ROS 2 installation guide
- Windows: Install via ROS 2 Windows installer
-
Node.js 18+ and npm
- macOS:
brew install node - Windows: Download from nodejs.org
- macOS:
-
Python 3.8+ (usually pre-installed)
- Install
websocketslibrary:pip3 install websockets
- Install
macOS:
brew install nodeWindows: Download and install from nodejs.org
Verify installation:
node --version
npm --versionNavigate to the RTelemetry project directory and run the automated setup:
cd /path/to/RTelemetry
npm run setupThis will:
- Install Node.js dependencies
- Create a ROS workspace
- Build ROS packages
- Generate an environment setup script
You need 3 terminal windows running simultaneously:
Terminal 1 - Bridge Node:
cd /path/to/RTelemetry
source rossimulator_env.sh
ros2 run ros_introspection_bridge bridge_node.pyTerminal 2 - Publisher Node:
cd /path/to/RTelemetry
source rossimulator_env.sh
ros2 run robomaster_logger publisher_nodeTerminal 3 - Web Interface:
cd /path/to/RTelemetry
npm run devThen open your browser to http://localhost:3000
- Start all three services (see above)
- Open
http://localhost:3000in your browser - Verify the connection status indicator is green
- View Variables: All logged variables appear in the left sidebar
- Expand/Collapse: Click node names to expand/collapse
- Edit Variables: Click on variable values to edit them
- Add Variables: Drag variables from the sidebar onto graph axis boxes (Left Axis, Right Axis, or Discrete)
- Toggle Visibility: Click the eye icon to show/hide variables
- Change Line Style: Click the line style icon to cycle through styles
- Remove Variables: Hover and click the X button
- Real-time log messages from ROS nodes
- Use the search box to filter logs
- Logs are color-coded by severity level
If you have ROS nodes that log variables, run them in additional terminals:
# Source your main workspace (if different from RTelemetry)
cd /path/to/your/ros/workspace
source install/setup.bash
# Run your nodes
ros2 run your_package your_nodeExample - Running Autonav Node:
cd /path/to/your/ros/workspace
source install/setup.bash
ros2 run autonav autonav_nodeInclude the logger header and use the ROBOMASTER_LOG macro:
#include <robomaster_logger/logger.hpp>
// In your node:
float health_threshold = 67.0;
ROBOMASTER_LOG("/autonav/capture/health_threshold", health_threshold);
int max_retries = 5;
ROBOMASTER_LOG("/autonav/capture/max_retries", max_retries);
bool enable_debug = false;
ROBOMASTER_LOG("/autonav/debug/enable", enable_debug);
std::string current_state = "idle";
ROBOMASTER_LOG("/autonav/state/current", current_state);Supported Types:
float,doubleint,int32_t,int64_tbool,booleanstd::stringstd::vector<T>(arrays)
Symptoms: Connection status shows red, no variables appear
Solutions:
- Verify bridge node is running (Terminal 1)
- Check if port 9090 is in use:
lsof -i :9090(macOS) ornetstat -ano | findstr :9090(Windows) - Check browser console (F12) for WebSocket errors
- Verify firewall isn't blocking port 9090
Symptoms: Dashboard loads but no variables in sidebar
Solutions:
- Verify publisher node is running (Terminal 2)
- Check ROS topics:
ros2 topic list | grep variable_snapshots - Monitor the topic:
ros2 topic echo /robomaster_logger/variable_snapshots - Verify your ROS nodes are calling
ROBOMASTER_LOGand variables are being updated
Solutions:
- Verify ROS 2 is installed:
ros2 --version - Ensure ROS 2 environment is sourced. The setup script will auto-detect your ROS installation, or you can set
ROSSIMULATOR_ROS_SETUPenvironment variable to point to your ROS setup.bash file - Install Python websockets:
pip3 install websockets - Check that
rosdepis initialized:sudo rosdep init && rosdep update(if needed)
Solutions:
- Find process using port 9090:
lsof -i :9090(macOS) ornetstat -ano | findstr :9090(Windows) - Kill the process or use different ports:
export ROSSIMULATOR_BRIDGE_PORT=9091 ros2 run ros_introspection_bridge bridge_node.py
Solutions:
- Source the environment:
source rossimulator_env.sh - Verify packages are built:
ros2 pkg list | grep robomaster_logger - Rebuild if needed:
cd .ros_ws colcon build --packages-select robomaster_logger ros_introspection_bridge source install/setup.bash
RTelemetry/
├── app/ # Next.js app directory
├── components/ # React components
├── hooks/ # React hooks
├── lib/ # Utilities
├── scripts/ # Setup scripts
├── src/ # ROS 2 packages
│ ├── robomaster_logger/
│ └── ros_introspection_bridge/
├── .ros_ws/ # ROS workspace (generated)
├── package.json # Node.js dependencies
└── rossimulator_env.sh # Environment script (generated)
cd .ros_ws
colcon build --packages-select robomaster_logger ros_introspection_bridge
source install/setup.bashThe development server (npm run dev) automatically reloads on changes. For production:
npm run build
npm startROS Setup (for scripts and setup):
ROSSIMULATOR_ROS_SETUP: Absolute path to ROS setup.bash file (e.g.,/opt/ros/humble/setup.bash). If not set, scripts will auto-detect common ROS installations.ROSSIMULATOR_ROS_WORKSPACE: Custom path for ROS workspace (default:.ros_wsin project root)ROS_DISTRO: ROS distribution name (e.g.,humble,iron). Used for auto-detection ifROSSIMULATOR_ROS_SETUPis not set.ROS_ROOT: ROS root directory. Used for auto-detection if other methods fail.
Bridge Node:
ROSSIMULATOR_BRIDGE_HOST: Host to bind (default:0.0.0.0)ROSSIMULATOR_BRIDGE_PORT: Port number (default:9090)
Web Interface:
NEXT_PUBLIC_ROS_BRIDGE_HOST: Hostname to connect to (default: browser hostname)NEXT_PUBLIC_ROS_BRIDGE_PORT: Port number (default:9090)NEXT_PUBLIC_ROS_BRIDGE_URL: Full WebSocket URL (overrides other options)
If your ROS installation is in a non-standard location, you can set the ROSSIMULATOR_ROS_SETUP environment variable before running setup:
export ROSSIMULATOR_ROS_SETUP="/custom/path/to/ros/setup.bash"
npm run setupOr source it manually before running any ROS commands:
export ROSSIMULATOR_ROS_SETUP="/custom/path/to/ros/setup.bash"
source rossimulator_env.shMIT License - see LICENSE file for details
Last updated: 2025