Experiment 4C: Analyzing Data with PlotJuggler

Learn to capture, visualize, and analyze robotic data using PlotJuggler and ROS Bag for data-driven debugging and validation.

Objectives

  • Capture and replay robot operations using ROS Bag
  • Visualize and interpret time-series data from robot operations
  • Develop data-driven debugging and validation skills
  • Analyze relationships between commanded and actual values

Key Concepts

  • Data Capture & Replay: Recording and playing back robot operations using ROS Bag
  • Data Analysis Skills: Identifying and interpreting key information in data streams
  • Data-Driven Debugging: Using visualization to diagnose issues and validate performance
  • Time-Series Visualization: Plotting and comparing multiple data streams simultaneously
  • Multi-Topic Analysis: Examining relationships between different robot parameters
  • Real-time vs Offline Analysis: Working with both live and recorded data

Theory

Why Data Analysis is Important in Robotics

Robotic systems generate vast amounts of data during operation. Analyzing this data is crucial for understanding robot behavior, diagnosing issues, and improving performance. Without proper data analysis tools and techniques, it's difficult to:

  • Verify that the robot is behaving as expected
  • Identify sources of error or unexpected behavior
  • Optimize control parameters and trajectories
  • Validate theoretical models against real-world performance
  • Debug complex multi-component systems

PlotJuggler Overview

PlotJuggler is an advanced visualization and analysis tool for time-series data, primarily used in ROS-based environments. It supports both live and offline data plotting, filtering, annotation, and export capabilities.

Key Features:

  • Real-time and offline data visualization
  • Multi-topic plotting and comparison
  • Data filtering and transformation
  • Layout saving and loading for consistent analysis
  • Data export for further processing
  • Event annotation and marking

ROS Bag Overview

ROS Bag is a tool for recording and playing back ROS message data. It allows you to capture all the information published on ROS topics during a robot operation and replay it later for analysis. This is invaluable for:

  • Debugging without needing the physical robot
  • Sharing experiment data with colleagues
  • Comparing performance across multiple runs
  • Developing and testing analysis algorithms offline

What Can Be Analyzed?

Common data streams from the Cobot-C1 include:

  • Joint positions: Actual and commanded joint angles over time
  • Joint velocities: Speed of joint movement
  • Joint efforts (torques): Forces applied at each joint
  • End-effector paths: Cartesian position and orientation trajectories
  • Control gains: PID parameters and their effects
  • Sensor data: Force/torque sensors, encoders, etc.

Prerequisites

  • Installation and verification of PlotJuggler, ROS Bag, and all required utilities
  • Access to recorded or live ROS data streams
  • Knowledge of ROS topology and topic structure
  • A compatible workstation with necessary software installed
  • Familiarity with PlotJuggler's layout, topic selection, and basic operation

Procedure

Step 1: Configure Network

Set up and export ROS_MASTER_URI and ROS_IP environment variables as needed on all devices and terminals.

Step 2: Launch PlotJuggler

plotjuggler-ros

Step 3: (Optional) Open Layout

Load saved layout files as needed for consistent visualization setup.

Step 4: Run Experiment

Execute your path planning experiment (task space or joint space) while PlotJuggler is running.

Step 5: Record Data

In a separate terminal, record the relevant ROS topics:

rosbag record -O experiment_session.bag /cobo/joint_state_act /cobo/joint_command /ee_path

Important Topics to Record:

  • /cobo/joint_state_act - Actual joint states (position, velocity, effort)
  • /cobo/joint_command - Commanded joint states
  • /ee_path - End-effector path trajectory

Step 6: Analyze Data in PlotJuggler

Loading Bag Files:

  1. In PlotJuggler, click "Data" → "Load data from ROS bag"
  2. Select your experiment_session.bag file
  3. Choose which topics to load

Plotting Data:

  1. Drag topics from the left panel to the plotting area
  2. Create multiple plots to compare different signals
  3. Use the timeline to synchronize views across plots

What to Analyze:

  • Commanded vs Actual Values: Compare joint commands to actual positions to see tracking error
  • Joint Coordination: Plot all joint positions together to see how they coordinate
  • Velocity Profiles: Examine joint velocities for smoothness and acceleration limits
  • Effort/Torque: Identify when joints are working hard or reaching limits
  • End-Effector Path: Visualize the actual path followed vs. intended path

Step 7: Repeat and Compare

Run analysis for multiple experiments to compare behaviors across different scenarios (e.g., task space vs. joint space planning).

Analysis Techniques

Identifying Significant Events

Look for and annotate:

  • Spikes: Sudden changes in velocity or effort
  • Deviations: Differences between commanded and actual values
  • Lags: Time delays between command and response
  • Oscillations: Repeated over/undershooting of targets
  • Saturation: Values hitting limits (max velocity, max torque, etc.)

Comparing Experiments

When comparing task space vs. joint space planning:

  • Which produces smoother joint velocities?
  • Which has better path tracking accuracy?
  • Which requires more effort (torque)?
  • Which completes the task faster?

Linking Observations to Causes

Observed discrepancies or delays may be due to:

  • Software delays: Communication lag, processing time
  • Hardware limitations: Motor response time, mechanical compliance
  • Kinematic challenges: Singularities, workspace limits, IK solving time
  • Control tuning: Sub-optimal PID gains

Sources of Error and Precautions

Common Issues

  • Missing topics: Verify all required topics are being recorded before starting
  • Clock/timestamp issues: Ensure network and timestamps are properly configured
  • Wrong bag file: Confirm correct bag files are loaded for each analysis session
  • Topic name mismatches: Check that topic names match between recording and playback

Best Practices

  • Always verify recording is active before starting the experiment
  • Name bag files descriptively (e.g., task_space_trial_1.bag)
  • Save PlotJuggler layouts for consistent analysis
  • Take notes during recording about what should appear in the data
  • Record longer than the experiment (start before, stop after)

Learning Outcomes

  • Attain an overview of concepts in robotic data recording and visualization
  • Recognize the value of time-series and multi-topic analysis for monitoring, validation, and debugging
  • Develop practical skills using PlotJuggler and ROS Bag for experiment review
  • Understand how to correlate different data streams to diagnose robot behavior
  • Gain experience in data-driven debugging methodologies
Pro Tip: Save your PlotJuggler layouts for different types of analysis (e.g., "kinematics_analysis.xml", "control_tuning.xml") so you can quickly load the right visualization setup for each experiment type.

Example Analysis Workflow

  1. Record a task space experiment to task_space.bag
  2. Record a joint space experiment to joint_space.bag
  3. Load both bags into PlotJuggler
  4. Plot joint velocities from both experiments side-by-side
  5. Compare smoothness, peak velocities, and acceleration patterns
  6. Plot end-effector paths to see the difference in Cartesian trajectories
  7. Analyze which method is better for your specific application