Skip to content

Questions on kinematic commands for deployment #20

Open
@xkhainguyen

Description

@xkhainguyen

Hi All,

Thanks for releasing the great framework.

I am trying to deploy HOVER on a real H1 robot using your s2r scripts (with OmniH2O mode -- 3 keypoint tracking). I don't have MoCap -- so NO root pos.

stable_punch motion seems to work just fine but amass_phd_filtered or anything requiring leg movements doesn't seem to work. I strongly believe the training is not the problem but the deployment part.

stable punch
Image

amass
Image

I got confused about how you compute kinematic commands. root_pos in robot._kinematic_model doesn't change. Mujoco robot's root stays fixed and deviates from the reference like in the image.

It might make sense because kinematics doesn't really need this info. But the code does use this info as below.

def compute_kinematic_command(
ref_motion_state: ReferenceMotionState,
body_state: BodyState,
ref_episodic_offset: torch.Tensor | None,
) -> torch.Tensor:
"""
Compute the link position command used in the observation of the student.
The link position command consists of:
- the delta between the current root position and the target link positions
"""
num_envs, num_bodies, _ = body_state.body_pos_extend.shape
root_pos = body_state.body_pos_extend[:, 0, :]
root_rot_wxyz = body_state.body_rot_extend[:, 0, :]
root_rot_xyzw = math_utils.convert_quat(root_rot_wxyz, to="xyzw")
ref_body_pos = ref_motion_state.body_pos_extend
heading_inv_rot_xyzw = torch_utils.calc_heading_quat_inv(root_rot_xyzw)
heading_inv_rot_expand_xyzw = heading_inv_rot_xyzw.unsqueeze(-2).repeat((1, num_bodies, 1))
# Delta between the current root position and the target link positions.
local_ref_body_pos = ref_body_pos - root_pos.unsqueeze(1).expand(-1, num_bodies, -1)
local_ref_body_pos = torch_utils.my_quat_rotate(
heading_inv_rot_expand_xyzw.view(-1, 4),
local_ref_body_pos.view(-1, 3),
).view(num_envs, num_bodies, -1)
return torch.cat(
[
local_ref_body_pos.view(num_envs, -1), # num_envs * (num_bodies * 3)
],
dim=1,
)

Then the robot tends to move agressively towards to red keypoints in the global frame. I believe they should be all in local frame? How can we actually align them? I believe you guys don't need root pos measurement in the real.

Could you explain the kinematic commands a bit more for my deployment purpose?

Many thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions