-
Notifications
You must be signed in to change notification settings - Fork 0
horseRL #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
angelayixuanli
wants to merge
40
commits into
main
Choose a base branch
from
yl/horseRL
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
horseRL #34
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
68aac8e
add height training
angelayixuanli 90f3271
mini_cheetah with horse mass
angelayixuanli b4ed45c
scale inertia
angelayixuanli 1582c75
baseline - stable cheetah
angelayixuanli afb939c
baseline - split body
angelayixuanli da4739a
Merge branch 'main' of github.com:sheim/QGym into yl/horseRL
angelayixuanli fb34dd5
mini_cheetah with horse values
angelayixuanli f9fa9d3
urdf-debugger fixed
angelayixuanli af0534b
stable horse but can't stand
angelayixuanli a880139
realistic effort values
angelayixuanli c456a0c
better results
angelayixuanli 5001e40
manual merge of non-logging part of yl/horse_RL
sheim 03538e5
Merge branch 'main' into horse_tweaks
sheim 12dc7a4
good SWE cleanup
angelayixuanli e1b3733
WIP: partial urdf changes
sheim 9aae283
reformat mini_cheetah urdf file for readability
sheim f155bb4
fix left legs
sheim 318d55e
mirror left and right
sheim b247418
remove inertial offsets along y for symmetry
sheim 5285384
rename urdf for symmetry ease, some minor tweaks
sheim ed90880
Merge branch 'yl/horseRL' into horse_tweaks
angelayixuanli aa7e536
merge horse tweaks
angelayixuanli 71985f6
plots separated by leg or joint
angelayixuanli 795cec0
log obs scaling
angelayixuanli 5d65cc9
update scaling
sheim 4414757
split off horse on its own
sheim f674162
fix play script
sheim 21a6913
Merge pull request #33 from sheim/horse_tweaks
angelayixuanli c7eb06f
add horse_osc
angelayixuanli dc21012
error stats logging
angelayixuanli 2d37c69
wandb sweep config
angelayixuanli c0411ff
cleanup
angelayixuanli ca10c7e
more cleanup
angelayixuanli b9401ac
whoops still need randomize_osc_params
angelayixuanli 80f05d0
horse_tweaks branch + tuning
angelayixuanli 91f2e7c
expand joint limits for lay down motion
angelayixuanli 1f547c4
logs_by_joint new limits
angelayixuanli 935b4d0
add tendon constraints
angelayixuanli 70cfb20
attempt at smoothing descent rewards
angelayixuanli 1957e3f
plots and fix height pos and command
angelayixuanli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| import torch | ||
|
|
||
| from isaacgym.torch_utils import torch_rand_float | ||
| from gym.envs.base.legged_robot import LeggedRobot | ||
|
|
||
|
|
||
| class Horse(LeggedRobot): | ||
| def __init__(self, gym, sim, cfg, sim_params, sim_device, headless): | ||
| super().__init__(gym, sim, cfg, sim_params, sim_device, headless) | ||
|
|
||
| def _reward_lin_vel_z(self): | ||
| """Penalize z axis base linear velocity with squared exp""" | ||
| return self._sqrdexp(self.base_lin_vel[:, 2] / self.scales["base_lin_vel"]) | ||
|
|
||
| def _reward_ang_vel_xy(self): | ||
| """Penalize xy axes base angular velocity""" | ||
| error = self._sqrdexp(self.base_ang_vel[:, :2] / self.scales["base_ang_vel"]) | ||
| return torch.sum(error, dim=1) | ||
|
|
||
| def _reward_orientation(self): | ||
| """Penalize non-flat base orientation""" | ||
| error = ( | ||
| torch.square(self.projected_gravity[:, :2]) | ||
| / self.cfg.reward_settings.tracking_sigma | ||
| ) | ||
| return torch.sum(torch.exp(-error), dim=1) | ||
|
|
||
| def _reward_min_base_height(self): | ||
| """Squared exponential saturating at base_height target""" | ||
| error = self.base_height - self.cfg.reward_settings.base_height_target | ||
| error /= self.scales["base_height"] | ||
| error = torch.clamp(error, max=0, min=None).flatten() | ||
| return self._sqrdexp(error) | ||
|
|
||
| def _reward_tracking_lin_vel(self): | ||
| """Tracking of linear velocity commands (xy axes)""" | ||
| # just use lin_vel? | ||
| error = self.commands[:, :2] - self.base_lin_vel[:, :2] | ||
| # * scale by (1+|cmd|): if cmd=0, no scaling. | ||
| error *= 1.0 / (1.0 + torch.abs(self.commands[:, :2])) | ||
| error = torch.sum(torch.square(error), dim=1) | ||
| return torch.exp(-error / self.cfg.reward_settings.tracking_sigma) | ||
|
|
||
| def _reward_tracking_ang_vel(self): | ||
| """Tracking of angular velocity commands (yaw)""" | ||
| ang_vel_error = torch.square( | ||
| (self.commands[:, 2] - self.base_ang_vel[:, 2]) / 5.0 | ||
| ) | ||
| return self._sqrdexp(ang_vel_error) | ||
|
|
||
| def _reward_dof_vel(self): | ||
| """Penalize dof velocities""" | ||
| return torch.sum(self._sqrdexp(self.dof_vel / self.scales["dof_vel"]), dim=1) | ||
|
|
||
| def _reward_dof_near_home(self): | ||
| return torch.sum( | ||
| self._sqrdexp( | ||
| (self.dof_pos - self.default_dof_pos) / self.scales["dof_pos_obs"] | ||
| ), | ||
| dim=1, | ||
| ) | ||
|
|
||
| def _resample_commands(self, env_ids): | ||
| super()._resample_commands(env_ids) | ||
|
|
||
| # resample height | ||
| height_range = self.command_ranges["height"] | ||
| self.commands[env_ids, 3] = torch_rand_float( | ||
| height_range[0], height_range[1], (len(env_ids), 1), device=self.device | ||
| ).squeeze(1) | ||
|
|
||
| def _reward_tracking_height(self): | ||
| """Reward for base height.""" | ||
| # error between current and commanded height | ||
| error = self.base_height.flatten() - self.commands[:, 3].flatten() | ||
| error /= self.scales["base_height"] | ||
|
|
||
| return self._sqrdexp(error) |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.