mujoco_mpc icon indicating copy to clipboard operation
mujoco_mpc copied to clipboard

The problem of adding new motion capture data for human motion tracking

Open rottenapple777 opened this issue 1 year ago • 6 comments

In the human motion tracking task, I want to add new motion capture data, but the amc file I downloaded from CMU is different from the xml of the keyframe in mjpc. Is some format conversion program being used? How do I get the new motion capture data file in the new xml format. Thanks a lot.

rottenapple777 avatar Aug 08 '24 14:08 rottenapple777

@hartikainen

thowell avatar Aug 08 '24 16:08 thowell

Unfortunately, I haven't open-sourced any of these functions as they're overly complicated and not very user friendly for anyone else than myself. It's been long on my todo-list to clean up the IK-code but I'm honestly not sure if I'll ever get there.

You need to transform the .amc-files into our .xml format. For that, you basically have to extract the cartesian joint/body positions for each frame and order them like they're used here: https://github.com/google-deepmind/mujoco_mpc/blob/1f78168912b4fe4af30365198c9f4e3ecf025ba1/mjpc/tasks/humanoid/tracking/tracking.cc#L69-L73

That should be relatively easy to do. Just note that you'll have to rescale the positions with a constant value to get them right. Then just write the each frame into an .xml file like here: https://github.com/google-deepmind/mujoco_mpc/blob/1f78168912b4fe4af30365198c9f4e3ecf025ba1/mjpc/tasks/humanoid/tracking/keyframes/CMU-CMU-02-02_04_poses.xml#L3

That is, each key in the .xml contains 48 = 16 * 3 (cartesian xyz position for the 16 joints) mpos values.

What's a bit trickier is if you also want to use reset positions for the motions. These are controlled by the first keyframe's qpos and qvel values (like in the above example key). For these, you're gonna have to do some inverse kinematics because the .amc-files don't include those for our humanoid. For the inverse kinematics, I've used the multi-site IK functions from here: https://github.com/google-deepmind/dm_control/pull/399.

hartikainen avatar Aug 09 '24 14:08 hartikainen

I looked around and noticed that I had opened a PR (https://github.com/hartikainen/mocap-environments/pull/6/files) for converting the AMASS files (which also contains most of the CMU mocap motions) into our .xml format. That might give you some ideas on how to approach the conversion. But be warned: as I mentioned above, the code is not super usable right now and it's been so long since I opened the PR that the code might be buggy/stale already.

hartikainen avatar Aug 09 '24 14:08 hartikainen

@rottenapple777 if you would clean that up and make it usable, that would be a much-appreciated contribution 👍

yuvaltassa avatar Aug 09 '24 14:08 yuvaltassa

@hartikainen Okay, I'll check it out. Thanks for taking the time to reply.

rottenapple777 avatar Aug 09 '24 15:08 rottenapple777

Is there an update on this?

rohanpsingh avatar Nov 08 '24 10:11 rohanpsingh