Skip to content

Score tracking body velocities relative to the anchor heading. - #1274

Merged
kevinzakka merged 1 commit into
mainfrom
qiayuanl/tracking-relative-body-velocity
Nov 20, 2026
Merged

kevinzakka merged 1 commit into
mainfrom
qiayuanl/tracking-relative-body-velocity

Conversation

@qiayuanl

@qiayuanl qiayuanl commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

The tracking rewards motion_body_lin_vel and motion_body_ang_vel compared world-frame body velocities. A robot that follows the motion well but at a different heading therefore lost reward on both velocity terms as well as on motion_global_root_ori, even though the body pose terms already re-anchor the reference to the robot's xy position and heading.

This adds MotionCommand.to_robot_heading, which rotates reference body vectors by the yaw offset between the robot and reference anchors. The two terms apply it to the reference velocities through motion_relative_body_linear_velocity_error_exp and motion_relative_body_angular_velocity_error_exp, with the same weights and stds. These replace motion_global_body_linear_velocity_error_exp and motion_global_body_angular_velocity_error_exp, which are removed. The error_body_lin_vel / error_body_ang_vel metrics stay in the world frame.

The yaw offset has one definition, the property MotionCommand.yaw_offset_quat_w. update_relative_body_poses reads it for the cached pose targets, whose values are unchanged, and to_robot_heading reads it when it is called. The cache is filled one control step before the reward is evaluated, so on fast turns its yaw offset includes the reference's own yaw change. On a pirouette clip, a perfect tracker lost up to about 13% of the linear velocity reward on single frames with that cached offset.

A test in test_tracking_task.py gives the robot anchor a yaw and tilt offset from the reference and checks that to_robot_heading rotates by the yaw alone.

🤖 Generated with Claude Code

@qiayuanl
qiayuanl force-pushed the qiayuanl/tracking-relative-body-velocity branch 3 times, most recently from 9d7299f to 515957f Compare October 27, 2026 22:55
@qiayuanl
qiayuanl marked this pull request as ready for review October 27, 2026 22:57
@qiayuanl
qiayuanl force-pushed the qiayuanl/tracking-relative-body-velocity branch from 515957f to 4bdb284 Compare November 19, 2026 06:07
The tracking rewards motion_body_lin_vel and motion_body_ang_vel compared world-frame body velocities, so a yaw offset between the robot and reference anchors lowered both velocity terms on top of motion_global_root_ori. The two terms now use motion_relative_body_linear_velocity_error_exp and motion_relative_body_angular_velocity_error_exp, which rotate the reference body velocities with MotionCommand.to_robot_heading: the yaw offset between the robot and reference anchors, the same offset that re-anchors the body pose targets. Only the two anchor terms score global xy position and heading. Term names, weights and stds are unchanged. The new functions replace motion_global_body_linear_velocity_error_exp and motion_global_body_angular_velocity_error_exp, which are removed, and the error_body_lin_vel and error_body_ang_vel metrics stay in the world frame.

MotionCommand.yaw_offset_quat_w is the one expression of that offset. update_relative_body_poses reads it for the cached pose targets, whose values are unchanged, and to_robot_heading reads it when it is called. The cache is filled one control step before the reward is evaluated, so on fast turns its yaw offset includes the reference's own yaw change and a perfect tracker would lose velocity reward.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@qiayuanl
qiayuanl force-pushed the qiayuanl/tracking-relative-body-velocity branch from 4bdb284 to 614e2bf Compare November 19, 2026 08:04
@qiayuanl
qiayuanl requested a review from kevinzakka November 19, 2026 09:37
@kevinzakka

Copy link
Copy Markdown
Collaborator

Ran the G1 tracking nightly setup (side_kick_test for 6k iters) on this branch and on main, with 3 evals per checkpoint. It matches or slightly beats main.

this PR main
success_rate 0.980 0.969
mpkpe 0.0997 0.1006
ee_pos_error 0.0443 0.0459
ee_ori_error 0.1624 0.1675

@kevinzakka
kevinzakka merged commit 55182f0 into main Nov 20, 2026
15 checks passed
@kevinzakka
kevinzakka deleted the qiayuanl/tracking-relative-body-velocity branch November 20, 2026 05:39
qiayuanl added a commit to HybridRobotics/supermimic that referenced this pull request Nov 21, 2026
The world-model tracking reward compared predicted body velocities with world-frame targets, so a yaw offset between the predicted root and the reference anchor lowered both velocity terms on top of the root orientation term. _reanchor_targets rotates the velocity targets by the yaw offset that re-anchors the pose targets. Only the two anchor terms score global xy position and heading; term weights and stds are unchanged.

The env reward comes from mjlab's tracking config, where mujocolab/mjlab#1274 makes the same change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants