isaac-sim / IsaacGymEnvs

Isaac Gym Reinforcement Learning Environments
Other
1.89k stars 410 forks source link

Creating a T-Pose .npy file with Poselib #41

Open noshaba opened 2 years ago

noshaba commented 2 years ago

Hi,

I’m failing to create a T-Pose .npy. I want to retarget the SFU Wushu motion to the AMP skeleton. As I do not have any MJCF file from them but only FBX, I tried to extract the T-Pose from the FBX and saved it as another FBX. However, when I run fbx_importer on it it creates a SkeletonMotion but the retargeting expects a SkeletonState for the T-Pose. In the example a SkeletonState is only created from a MJCF file however.

Best, Noshaba

anonymous-pusher commented 2 years ago

In my case, I have a t-pose at the beginning of the motion in the fbx file, so I found a crop method for SkeletonMotion and changed it so that it return a SkeletonState instead, the cropped the beginning of my motion to be my t-pose. so you can change the crop method for the SkeletonMotion class in poselib/skeleton/skeleton3d.py with something like:

def crop(self, start: int, end: int, fps: Optional[int] = None, return_skel_state: bool = False): if fps is None: new_fps = int(self.fps) old_fps = int(self.fps) else: new_fps = int(fps) old_fps = int(self.fps) assert old_fps % fps == 0, ( "the resampling doesn't support fps with non-integer division " "from the original fps: {} => {}".format(old_fps, fps) ) skip_every = old_fps // new_fps if return_skel_state: return SkeletonState.from_rotation_and_root_translation( skeleton_tree=self.skeleton_tree, t=self.root_translation[start:end:skip_every], r=self.local_rotation[start:end:skip_every], is_local=True ) else: return SkeletonMotion.from_skeleton_state( SkeletonState.from_rotation_and_root_translation( skeleton_tree=self.skeleton_tree, t=self.root_translation[start:end:skip_every], r=self.local_rotation[start:end:skip_every], is_local=True ), fps=self.fps ) Then use it in fbx_importer.py with: motion.crop(0, 1, return_skel_state=True).to_file("data/FBX_tpose.npy")

Frank-Dz commented 2 years ago

Hi,

I’m failing to create a T-Pose .npy. I want to retarget the SFU Wushu motion to the AMP skeleton. As I do not have any MJCF file from them but only FBX, I tried to extract the T-Pose from the FBX and saved it as another FBX. However, when I run fbx_importer on it it creates a SkeletonMotion but the retargeting expects a SkeletonState for the T-Pose. In the example a SkeletonState is only created from a MJCF file however.

Best, Noshaba

Hi, Do you have a T-pose npy? Could you share it with me:D Thanks!

-- update

Made it.