Skip to main content

play_with_info

Module: GBC.gyms.isaaclab_45.workflows.rsl_rl.play_with_info

Overview 📖

An enhanced inference script that extends the basic play.py functionality with comprehensive debugging metrics and analysis tools. This script provides detailed performance analytics, contact analysis, action tracking, and visual debugging capabilities for trained RL/IL agents.

We recommend you to setup cloud configuration if you are running this script on a server without local display. Please refer to Running Isaac Lab in the Cloud.

Core Features 🎯

  • 🔍 Performance Analytics: Detailed metrics output for policy evaluation
  • 👣 Contact Analysis: Feet contact pattern analysis and timing statistics
  • 🎯 Action Tracking: Reference vs actual action comparison and error analysis
  • 💾 Data Logging: Complete robot state data saving for offline analysis
  • 🎬 Enhanced Video Recording: Video recording with custom naming and triggers
  • 📊 Real-time Visualization: Reference pose visualization with markers

Command Line Usage 🚀

Basic Debug Command

python play_with_info.py --task {TASK_NAME}

Full Debug Analysis

python play_with_info.py \
--task {TASK_NAME} \
--video \
--video_length 1000 \
--num_envs 16 \
--enable-feet-logger True \
--enable-ref-action-logger True \
--save-robot-data True

Command Line Arguments ⚙️

Core Arguments (inherited from play.py)

  • --task (str): Task name (must match registration in __init__.py)
  • --num_envs (int, default=64): Number of parallel environments
  • --video (flag, default=True): Enable video recording
  • --video_length (int, default=500): Length of recorded video in steps

Debug-Specific Arguments

  • --enable-feet-logger (bool, default=True): Enable feet contact analysis
  • --enable-ref-action-logger (bool, default=True): Enable action tracking analysis
  • --save-robot-data (bool, default=True): Save complete robot state data

Debug Components 🔧

1. FeetContactLogger 👣

Purpose: Analyzes feet contact patterns and timing statistics

Metrics Output:

Env: 0
Left:
air: 15.2, contact: 8.7
Right:
air: 12.8, contact: 11.1

Analysis:

  • Contact Duration: Average contact time per foot
  • Air Time: Average air time between contacts
  • Per-Environment: Individual statistics for each parallel environment
  • Bilateral Comparison: Left vs right foot contact patterns

2. RefActionLogger 🎯

Purpose: Compares actual joint positions with reference target actions

Metrics Output:

Mean Absolute Error:
Min error: 0.023
Max error: 1.234
Avg error: 0.156
Std: 0.5 reward: 0.892

Norm Error:
Min error: 0.045
Max error: 2.108
Avg error: 0.278
Std: 0.5 reward: 0.834

Analysis:

  • Error Statistics: Min, max, and average tracking errors
  • Reward Estimation: Exponential reward calculation based on error magnitude
  • Joint-wise Analysis: Individual joint tracking performance

3. SaveRobotDataLogger 💾

Purpose: Saves complete robot state data for offline analysis

Saved Data:

{
"step_dt": 0.02, # Simulation timestep
"joint_names": ["joint1", "joint2", ...], # Joint identifiers
"root_state_w": tensor, # Root state in world frame
"joint_pos": tensor, # Joint positions over time
"joint_vel": tensor, # Joint velocities over time
"joint_acc": tensor, # Joint accelerations over time
}

Output Metrics:

Joint pos diff2: 0.034  # Smoothness metric
Joint acc: 0.156 # Acceleration magnitude
Robot data will be saved to logs/.../video_name.pkl

4. ActionRateAccLogger ⚡

Purpose: Analyzes action smoothness and acceleration patterns

Metrics:

  • Action Rate: Second derivative of actions (acceleration)
  • Smoothness Index: Cumulative acceleration over episode
  • Multi-Environment Average: Statistics across parallel environments

5. RefBasePoseLogger 🎭

Purpose: Visualizes reference base poses with 3D markers

Features:

  • Real-time Visualization: Reference poses displayed as coordinate frames
  • Environment Origins: Poses adjusted for multi-environment setup
  • Interactive Markers: 3D visualization markers in simulation

Enhanced Video Features 🎥

Custom Video Naming

video_kwargs = {
"video_folder": os.path.join(log_dir, "videos", "play"),
"episode_trigger": lambda episode_id: episode_id == iter_id, # Custom trigger
"video_length": args_cli.video_length,
"disable_logger": True,
}
env.episode_id = iter_id - 1 # Custom video naming based on iteration

Video Output Structure

logs/rsl_rl/{experiment_name}/{run_directory}/videos/play/
├── rl-video-episode-{iter_id}.mp4 # Video file
└── rl-video-episode-{iter_id}.pkl # Robot data file

Usage Examples 💡

Quick Performance Analysis

# Basic debug run with all loggers enabled
python play_with_info.py --task Isaac-Humanoid-Amp-v0 --num_envs 8

Detailed Action Analysis

# Focus on action tracking with longer recording
python play_with_info.py \
--task Isaac-Humanoid-Amp-v0 \
--video_length 2000 \
--enable-ref-action-logger True \
--save-robot-data True

Contact Pattern Study

# Analyze gait patterns and contact timing
python play_with_info.py \
--task Isaac-Humanoid-Amp-v0 \
--enable-feet-logger True \
--num_envs 32 \
--video_length 1500

Data Collection Session

# Comprehensive data collection for offline analysis
python play_with_info.py \
--task Isaac-Humanoid-Amp-v0 \
--save-robot-data True \
--video \
--video_length 3000 \
--num_envs 1

Debug Output Interpretation 📊

Contact Analysis Interpretation

  • High Air/Contact Ratio: Indicates running or jumping gaits
  • Low Air/Contact Ratio: Indicates walking or cautious locomotion
  • Asymmetric Patterns: May indicate gait irregularities or preferred foot

Action Error Interpretation

  • Low Mean Absolute Error ($\leq$0.1): Excellent reference tracking
  • High Max Error ($>$1.0): Potential tracking failures or limits
  • High Reward Scores ($>$0.9): Good overall tracking performance

Smoothness Metrics

  • Low Joint Acceleration: Smooth, natural motion
  • High Action Rate: Jittery or unstable control
  • Consistent Diff2: Predictable motion patterns

Server Environment Setup 🌐

CloudXR Configuration for Remote Training

For users running training and inference on server environments without local displays, NVIDIA provides CloudXR technology for remote visualization:

📖 Official Documentation: IsaacLab CloudXR Setup Guide

Key Benefits:

  • 🌐 Remote Visualization: Stream high-quality rendering from server to client
  • ⚡ Low Latency: Real-time interaction with simulation environments
  • 🎮 Interactive Control: Full control capabilities over network
  • 🎥 Quality Recording: High-resolution video recording on server

Setup Overview:

  1. Server Setup: Configure CloudXR server on compute nodes
  2. Client Setup: Install CloudXR client on local workstation
  3. Network Configuration: Ensure proper bandwidth and latency
  4. IsaacLab Integration: Configure rendering pipeline for CloudXR

Recommended Usage:

# Run with CloudXR for remote visualization
python play_with_info.py \
--task Isaac-Humanoid-Amp-v0 \
--video \
--headless # Server mode

Performance Considerations ⚡

Environment Count Optimization

  • Debug Analysis: Use fewer environments (8-16) for detailed metrics
  • Video Recording: Single environment for high-quality videos
  • Batch Analysis: Many environments (32+) for statistical significance

Recording Length Guidelines

  • Quick Debug: 500-1000 steps for rapid feedback
  • Gait Analysis: 1500-2000 steps for complete gait cycles
  • Data Collection: 3000+ steps for comprehensive datasets

Troubleshooting 🔧

Common Debug Issues

Logger Initialization Errors

# Error: Cannot resolve SceneEntityCfg

Solution: Ensure robot and sensor names match environment configuration

Video/Data File Conflicts

# Error: File already exists

Solution: Clean previous video files or use different checkpoint iterations

Memory Issues with Data Logging

# Error: CUDA out of memory

Solution: Reduce --num_envs or --video_length for data collection

  • 🎬 play.py: Basic inference script without debugging features
  • 🏋️ train.py: Training script that generates the checkpoints being analyzed
  • 📊 VisualizationMarkers: IsaacLab visualization system for reference poses
  • 🎥 RecordVideo: Gymnasium video recording wrapper with custom triggers

This enhanced debugging script provides comprehensive analysis tools for evaluating trained policies, enabling detailed performance assessment and data collection for research and development purposes.