The issue of abnormal joint movement in the legged robot in Isaac Lab

Isaac Sim Version

4.2.0

Isaac Lab Version (if applicable)

1.2

Operating System

Ubuntu 22.04

GPU Information

  • Model: RTX4090
  • Driver Version: 560.35.03

abnormal joint movement

Detailed Description

When I try to set the target position of the hip joint connecting the body to leg1 in the code, the simulation shows that leg1 is driving the body to move, causing the robot model to gradually move away from the origin.

But, what I actually want is for the body to drive leg1 to rotate!

I will provide the USD model file and code content. Please help me troubleshoot the issue.

Steps to Reproduce

phantomx.zip (3.0 MB)

Open the walk.py file, and you may need to modify the USD file path. Then, simply run walk.py using isaaclab.sh.

Additional Information

I have a few more questions: When I know the position of the end effector at the foot, how can I use the IKController to obtain the joint positions of the leg?

In fact, my main question is how to correctly obtain the Jacobian matrix. I know the API is:
jacobian = robot.root_physx_view.get_jacobians()[:, ee_index, :, joint_ids]
For example, with foot_lr, should the ee_index I pass be the foot_lr_index or the foot_lr_index - 1 ?
Should joint_ids be the indices of the 3 joints between the body and foot_lr?

How can I check the correctness of the computed Jacobian matrix?

I have identified the issue, and I made the following changes to the code.
before:

while simulation_app.is_running():

    joint_pos = hexapod.data.default_joint_pos.clone()
    joint_vel = hexapod.data.default_joint_vel.clone()
    hexapod.write_joint_state_to_sim(joint_pos, joint_vel)

    foot_joint_ids = np.array([0, 6, 12, 1, 7, 13, 2, 8, 14, 3, 9, 15, 4, 10, 16, 5, 11, 17]) 

    joint_angles = torch.tensor([[ -0.1, -1.1646e-05, -7.7008e-07,  3.4742e-05,  1.6288e-06,
     -1.8658e-05,  4.8839e-05,  5.7662e-05,  8.7161e-05,  8.2022e-05,
      1.0869e-04,  1.2426e-04,  6.5192e-05,  5.5894e-05,  7.4936e-05,
      4.7101e-05,  7.7366e-05,  1.2261e-04]], device = args_cli.device)
    
    hexapod.set_joint_position_target(joint_angles, foot_joint_ids)
    scene.write_data_to_sim()
    sim.step()
    scene.update(sim_dt)

after:

    count = 0
    while simulation_app.is_running():
        if count == 0:
            joint_pos = hexapod.data.default_joint_pos.clone()
            joint_vel = hexapod.data.default_joint_vel.clone()
            hexapod.write_joint_state_to_sim(joint_pos, joint_vel)
            hexapod.reset()
        else:
            foot_joint_ids = np.array([0, 6, 12, 1, 7, 13, 2, 8, 14, 3, 9, 15, 4, 10, 16, 5, 11, 17]) 

            joint_angles = torch.tensor([[ -1.0, -1.1646e-05, -7.7008e-07,  3.4742e-05,  1.6288e-06,
            -1.8658e-05,  4.8839e-05,  5.7662e-05,  8.7161e-05,  8.2022e-05,
            1.0869e-04,  1.2426e-04,  6.5192e-05,  5.5894e-05,  7.4936e-05,
            4.7101e-05,  7.7366e-05,  1.2261e-04]], device = args_cli.device)

            hexapod.set_joint_position_target(joint_angles, foot_joint_ids)
            scene.write_data_to_sim()
            sim.step()
            scene.update(sim_dt)
            
        count += 1

So, can someone tell me what the difference is here? It looks like I just added a reset() method. What is its purpose?

Thank you for your interest in Isaac Lab. To ensure efficient support and collaboration, please submit your topic to its GitHub repo following the instructions provided on Isaac Lab’s Contributing Guidelines regarding discussions, submitting issues, feature requests, and contributing to the project.

We appreciate your understanding and look forward to assisting you.