Skip to content
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

[fix] Fix the bug of absolute height for h1 locomotion policy #8

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,8 @@ work_dirs/
/asset
/assets

# user scripts
/scripts

# sphinx build dir
docs/en/_build
2 changes: 2 additions & 0 deletions demo/configs/h1_house.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ tasks:
- name: "move_with_keyboard"
- name: "web_chat"
sensor_params:
- name: "camera"
enable: false
- name: "tp_camera"
enable: false
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def forward(
joint_pos -= default_dof_pos

base_height = base_pose_w[0][2]
heights = np.clip(base_height - 0.5 - np.zeros(121), -1., 1.) * 5.0
ankle_height = self.robot.get_ankle_height()
relative_base_height = base_height - ankle_height
heights = np.clip(relative_base_height - 0.5 - np.zeros(121), -1., 1.) * 5.0

# Set action command.
tracking_command = np.array([forward_speed, lateral_speed, rotation_speed, 0.0], dtype=np.float32)
Expand Down
6 changes: 6 additions & 0 deletions grutopia_extension/robots/humanoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,19 @@ def __init__(self, config: Config, robot_model: RobotModel, scene: Scene):
self._robot_ik_base = None

self._robot_base = RigidPrim(prim_path=config.prim_path + '/pelvis', name=config.name + '_base')
self._robot_right_ankle = RigidPrim(prim_path=config.prim_path + '/right_ankle_link', name=config.name + 'right_ankle')
self._robot_left_ankle = RigidPrim(prim_path=config.prim_path + '/left_ankle_link', name=config.name + 'left_ankle')

def post_reset(self):
super().post_reset()
self.isaac_robot._process_actuators_cfg()
if self._gains is not None:
self.isaac_robot.set_gains(self._gains)


def get_ankle_height(self):
return np.min([self._robot_right_ankle.get_world_pose()[0][2], self._robot_left_ankle.get_world_pose()[0][2]])

def get_robot_scale(self):
return self._robot_scale

Expand Down