gazebosim / gazebo-classic

Gazebo classic. For the latest version, see https://github.com/gazebosim/gz-sim
http://classic.gazebosim.org/
Other
1.19k stars 481 forks source link

Distorted Actor animation by BVH file #2447

Open osrf-migration opened 6 years ago

osrf-migration commented 6 years ago

Original report (archived issue) by Anonymous.

The original report had attachments: 02_05.bvh


Dear developers, I am trying to load a sequence of animations to Actor from a BVH file. But after the loading, the Actor becomes distorted in Gazebo (in a weird shape but with correct actions, as shown in here). I tried to solve this by re-creating a dae file in Blender, but failed (Gazebo can't load the new dae file with animations). Could you tell me how to fix this issue?

The code I am using is as follows:

#!xml
<?xml version="1.0" ?>

<sdf version="1.6">
    <world name="learning">
        <actor name="actor">
            <pose>0 2 1.2 0 0 -1.57</pose>
            <skin>
                <filename>run.dae</filename>
            </skin>
            <animation name="striking">
                <filename>/home/mingfei/Documents/Engagement/src/main/worlds/02_05.bvh</filename>
                <scale>0.08</scale>
            </animation>
            <script>
                <delay_start>3.0</delay_start>
                <trajectory id="0" type="striking">
                    <waypoint>
                        <time>0</time>
                        <pose>0 2 0 1.57 0 0</pose>
                    </waypoint>
                    <waypoint>
                        <time>7</time>
                        <pose>0 2 0 1.57 0 0</pose>
                    </waypoint>
                </trajectory>
            </script>
        </actor>
    </world>
</sdf>

FYI, the BVH file for the animation can also be found in the attachment.

Thanks

osrf-migration commented 6 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


We have no working examples of BVH files. The last time I tried loading one I had a similar result to yours, I also tried baking the BVH into a DAE in Blender like you did, and also got bad results. As a reference, here's the model I was working on.

I investigated a bit and it's not clear to me if it's an issue with our loader or if it's a matter of choosing the correct options when exporting in Blender.

osrf-migration commented 6 years ago

Original comment by mingfei sun (Bitbucket: mingfeisun).


Thanks for your quick reply. I have investigated a little bit for this (Spent several days and got frustrated without solutions).

Basically, I found that the dae files provided in the gazebo examples (run.dae, walk.dae etc.) use a special skeleton definition different from CMU MoCap skeleton. In the examples, the bones are actually not connected, as shown in this pic. And all the bones are facing towards.

pose1.png

But in the standard skeleton or in BVH files, those bones are defined to be connected to each other (shown here), which means that move one bone will also cause other associated bones to move. However in the example files, move one bone will only cause this bone to move. I guess maybe this is the cause of the distortion, maybe from the loader.

pose2.png

osrf-migration commented 6 years ago

Original comment by mingfei sun (Bitbucket: mingfeisun).


@chapulina Could you tell me how the example dae files (walk.dae, run.dae, etc) were made ?? Thank you very much for your efforts and time. I really want to create an animated actor in Gazebo.

osrf-migration commented 6 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Sorry, but I don't know... I'd also love to find out. The earliest use of actors I know of is in this video.

osrf-migration commented 6 years ago

Original comment by mingfei sun (Bitbucket: mingfeisun).


Hi Louise, I solved this problem. I got inspired from sasabot's code here.

The point is before retargetting the BVH transformation to the dae file, it is required to do some pre-processing to the BVH transformation. Basically, it is needed to align the bone length, the initial posture, and the initial rotations. Accordingly, I made some changes to the Actor.cc and Actor.hh files. You can find my code here: Actor.cc and Actor.hh. I tested these codes on CMU MoCap bvh files and it works ok, as follows:

actor.png

Thanks again for your previous help. Also, the biggest credit should be given to sasabot

osrf-migration commented 6 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


This is awesome, @mingfeisun ! It would be great if you could make a pull request to Gazebo with your fixes!

osrf-migration commented 6 years ago

Original comment by mingfei sun (Bitbucket: mingfeisun).


No problem. It's my pleasure. I will make a pull request. @chapulina

osrf-migration commented 6 years ago

Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).


Pull request #2957