fix: resolve training startup bugs for walking_clf_sym and lip_clf_ec tasks#23
Open
fanyahao1 wants to merge 2 commits into
Open
fix: resolve training startup bugs for walking_clf_sym and lip_clf_ec tasks#23fanyahao1 wants to merge 2 commits into
fanyahao1 wants to merge 2 commits into
Conversation
- trajectory_manager: skip ori_w axis when building output_names since new YAML files store full quaternion in frames but only 3D angular velocity in frame_vels - clf: make ordered_output_names optional and support legacy numpy array format for Q/R weights (used by HLIPCommandTerm) - hlip_cmd: add y_des/dy_des aliases and current_contact_vels, desired_contact_poses, current_contact_poses properties required by reward functions and observations - rewards: fix holonomic_constraint shape bug (was collapsing to scalar instead of returning [B] tensor); fix holonomic_constraint_vel shape bug (same issue) - g1_lip_clf_env_cfg, g1_vanilla_walking_env_cfg: minor config fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a series of cascading runtime errors that prevented the
walking_clf_symandlip_clf_ectraining tasks from starting up. The bugs were discovered sequentially as training initialization progressed further with each fix.Changes
1.
trajectory_manager.py— Skipori_wwhen buildingoutput_namesProblem: The new YAML trajectory files (e.g.,
hf/trajectories/walking/*.yaml) store orientation as a full quaternion (ori_w, ori_x, ori_y, ori_z) insidebezier_coeffs.frames, butframe_velsonly contains the 3-component angular velocity (ori_x, ori_y, ori_z). The previous code naively iterated over all axes inframes, causing aKeyError: 'ori_w'when looking up the velocity.Fix: In
_verify_consistent_outputs_and_get_info, filteroutput_namesto only include axes that exist in bothframesandframe_velsfor each frame.2.
clf.py— Makeordered_output_namesoptional; support legacy numpy array weightsProblem:
CLF.__init__was refactored to requireordered_output_namesas a positional argument and to expect dict-keyed Q/R weights. However,HLIPCommandTermstill instantiatesCLFwith positional numpy arrays forQ_weights/R_weightsand noordered_output_names, causing aTypeError.Fix: Made
ordered_output_namesoptional (Nonedefault). Addedisinstance(np.ndarray)branches so that legacy diagonal numpy array weights are accepted directly without needing named keys.3.
hlip_cmd.py— Add missing properties required by rewards and observationsProblem: Several reward functions and observation terms accessed attributes on
HLIPCommandTermthat did not exist:y_des/dy_des— observations expected these names; the internal fields werey_out/dy_outdesired_contact_poses— used byholonomic_constraintrewardcurrent_contact_poses— used byholonomic_constraintrewardcurrent_contact_vels— used byholonomic_constraint_velrewardFix: Added the following properties to
HLIPCommandTerm:y_des/dy_des: simple aliases fory_out/dy_outdesired_contact_poses→[B, 6]tensor concatenatingstance_foot_pos_0andstance_foot_ori_0; returns zeros before initializationcurrent_contact_poses→[B, 6]real-time stance foot pose (position + Euler angles) from robot body data; returns zeros whenstance_idxisNonecurrent_contact_vels→[B, 4]concatenation of stance foot linear velocity and yaw rate; returns zeros whenstance_idxisNone4.
rewards.py— Fix tensor shape bugs in holonomic constraint rewardsProblem: Two reward functions were incorrectly collapsing their output to a scalar instead of returning a
[B]per-environment tensor:holonomic_constraint:pose_errwas overwritten withwrap_to_pi(pose_err[:, -1])(shape[B]), then.sum(dim=-1)collapsed it to a scalar.holonomic_constraint_vel:v.sum(dim=-1).sum(dim=-1) ** 2double-reduced to a scalar.Fix:
holonomic_constraint: Clonepose_err, update only the last column in-place withwrap_to_pi, then compute(pose_err**2).sum(dim=-1)to retain[B]shape.holonomic_constraint_vel: Replace with(v**2).sum(dim=-1)to correctly return[B].5.
g1_lip_clf_env_cfg.py/g1_vanilla_walking_env_cfg.py— Minor config correctionsSmall fixes to env config files for
lip_clf_ecand vanilla walking tasks.Testing
These fixes were validated by running:
Both tasks now progress past the initialization phase without errors.