How to Measure Robot Velocity During Evaluation in Isaac Sim Using SKRL? #2839
-
Hi everyone, I'm working with IsaacLab 2.1 and Isaac Sim to implement deep reinforcement learning using the Leatherback environment tutorial. I'm currently using SKRL as my training library. I'd like to know: How can I track the robot's velocity at each timestep? How can I compute the average velocity over the course of the entire evaluation episode? Any examples or pointers to relevant APIs in Isaac Sim would be greatly appreciated. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Thank you for starting this discussion. The following summary is still under review but you may find it helpful. To measure and track the robot's velocity during the evaluation phase, you can leverage IsaacLab's direct access to simulation data structures and APIs. Here’s how you can accomplish both per-timestep velocity tracking and average velocity calculation over an episode: 1. Tracking Robot Velocity at Each Timestep
# Assuming 'robot' is your robot instance in the environment
velocity = robot.data.root_vel_w # Shape: (num_envs, 6)
# The first three components are linear velocity (x, y, z), the next three are angular velocity
linear_velocity = velocity[:, :3]
# For the ith link (e.g., end-effector)
link_velocity = robot.data.body_vel_w[:, i, :] # Shape: (num_envs, 6)
2. Computing Average Velocity Over an Evaluation Episode
import torch
velocities = [] # Collect at each timestep
# During evaluation loop:
velocities.append(linear_velocity) # or linear_velocity.norm(dim=-1) for speed
# After the episode:
velocities_tensor = torch.stack(velocities) # Shape: (timesteps, num_envs, 3)
average_velocity = velocities_tensor.mean(dim=0) # Mean over timesteps
# For average speed:
average_speed = velocities_tensor.norm(dim=-1).mean(dim=0)
3. Integration with SKRL
Summary Table
References to NVIDIA Documentation and Forums
Footnotes |
Beta Was this translation helpful? Give feedback.
Thank you for starting this discussion. The following summary is still under review but you may find it helpful. To measure and track the robot's velocity during the evaluation phase, you can leverage IsaacLab's direct access to simulation data structures and APIs. Here’s how you can accomplish both per-timestep velocity tracking and average velocity calculation over an episode:
1. Tracking Robot Velocity at Each Timestep
robot.data.root_vel_w
(for root velocity in the world frame) androbot.data.body_vel_w
(for link velocities in the world frame)1