Skip to content

Conversation

@angelayixuanli
Copy link
Collaborator

@angelayixuanli angelayixuanli commented Nov 19, 2025

Modified mini_cheetah for to add height commands.
Added horse model for training and integrated oscillators code. Currently unable to stabilize in a standing pose, still needs further config tuning.
Added helpful logging and plotting scripts. When you run play.py, logs are saved to joint_logs.npz. Then run scripts/analyze_joint_scaling.py or 'scripts/plot_logs_by_joint.py`
Added sweep config for automated hyperparameter sweeps for horse_osc

Modified files:

  • gym/envs/init.py
    • added horse files
  • gym/envs/base/legged_robot.py and other mini_cheetah_*.py
    • added height as a command
  • gym/utils/interfaces/KeyboardInterface.py
    • add height as a command (up/down key)
  • scripts/play.py
    • added joint metrics logging

New files:

  • gym/envs/horse/horse.py
  • gym/envs/horse/horse_config.py
  • gym/envs/horse/horse_osc.py
  • gym/envs/horse/horse_osc_config.py
  • resources/robots/horse/urdf/horse.urdf
  • scripts/analyze_joint_scaling.py
    • generate histogram graphs of error and stats
  • scripts/plot_logs_by_joint.py
    • generate graphs of actual_pos and target_pos with limit markers, grouped by joint
  • scripts/plot_logs_by_leg.py
    • generate graphs of joint pos, grouped by leg
  • scripts/sweep_configs/sweep_horse_osc_config.json
    • sweep config for horse_osc

@angelayixuanli angelayixuanli requested a review from sheim November 19, 2025 08:47
Copy link
Owner

@sheim sheim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. I put in some comments on things that can be trimmed down from mini_cheetah_osc to horse_osc.


self.osc_offset = stop * self.cfg.osc.offset
self.osc_omega = (
stop * self.cfg.osc.omega_stop
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here also, let's simplify and remove all the _var randomness

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed torch.randn_like(self.osc_omega/coupling) * self.cfg.osc.omega/coupling_var

self.oscillators_vel *= 2 * torch.pi
self.oscillators += (
self.oscillators_vel * dt
) # torch.clamp(self.oscillators_vel * dt, min=0)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zap the comment, and it'll go onto one line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed from both files

prod = torch.prod(torch.clip(combined_rew, 0, 1), dim=1)
return prod - torch.ones_like(prod)

# this is removed in mini_cheetah_osc
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean?
Oh it isn't removed, mini_cheetah_osc inherits from mini_cheetah, so whatever we don't overload is still there.

Copy link
Collaborator Author

@angelayixuanli angelayixuanli Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it! cleaned it up, just wanted to make note of differences I saw for easier comparison while working

diff = torch.abs(theta1 - theta2) % (2 * torch.pi)
return torch.min(diff, 2 * torch.pi - diff)

def _reward_trot(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these gait-specific rewards are rubbish that wasn't refactored, zap'em

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed everything from _reward_trot to _reward_asymmetric

similarity *= self._sqrdexp(angle - torch.pi, torch.pi)
return similarity

def _reward_asymettric(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zap until this one (included)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed everything from _reward_trot to _reward_asymmetric

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.

3 participants