rdiankov / openrave

Open Robotics Automation Virtual Environment: An environment for testing, developing, and deploying robotics motion planning algorithms.
http://www.openrave.org
Other
722 stars 343 forks source link

Collada bug: reading translation of base link #382

Open stephane-caron opened 8 years ago

stephane-caron commented 8 years ago

Hi there,

Here is a bug report for the Collada parser. The cause of the problem and quickfix were found by Jose Enrique Chen.

Problem: the parser produces wrong results when the base-link is translated with respect to the world frame.

Affects: the current master and latest_stable branches.

Comment: the bug dates back to commit c054cabe42580e615c6d19d252868ff0ae021ae9, where the behavior of Collada changed. I noticed it because it broke compatibility with the Collada models generated from VRML by the openhrp-export-collada script of OpenHRP3. It seems that the translation of the base link is read differently for its mesh (kinbody) and for its link in the kinematic tree. See the example below.

Example: here is a Collada file that produces the bug: JVRC-1.dae

Quickfix: comment out the <translate> tags of the base link PELVIS_S in the Collada file, both in the definitions of its <node> (line 17) and its <link> (line 3405).

<environment>
    <robot>
        <kinbody>
            <body name="TRANS_X_LINK">
                <mass type="mimicgeom">
                    <total>0</total>
                </mass>
            </body>
        </kinbody>
        <kinbody>
            <body name="TRANS_Y_LINK">
                <mass type="mimicgeom">
                    <total>0</total>
                </mass>
            </body>
        </kinbody>
        <kinbody>
            <body name="TRANS_Z_LINK">
                <mass type="mimicgeom">
                    <total>0</total>
                </mass>
            </body>
        </kinbody>
        <kinbody>
            <body name="ROT_R_LINK">
                <mass type="mimicgeom">
                    <total>0</total>
                </mass>
            </body>
        </kinbody>
        <kinbody>
            <body name="ROT_P_LINK">
                <mass type="mimicgeom">
                    <total>0</total>
                </mass>
            </body>
        </kinbody>
        <kinbody>
            <body name="ROT_Y_LINK">
                <mass type="mimicgeom">
                    <total>0</total>
                </mass>
            </body>
        </kinbody>
        <robot file="JVRC-1.dae" name="JVRC-1">
            <kinbody>
                <joint name="TRANS_X" type="slider" circular="true">
                    <body>TRANS_X_LINK</body>
                    <body>TRANS_Y_LINK</body>
                    <axis>1 0 0</axis>
                </joint>
                <joint name="TRANS_Y" type="slider" circular="true">
                    <body>TRANS_Y_LINK</body>
                    <body>TRANS_Z_LINK</body>
                    <axis>0 1 0</axis>
                </joint>
                <joint name="TRANS_Z" type="slider" circular="true">
                    <body>TRANS_Z_LINK</body>
                    <body>ROT_R_LINK</body>
                    <axis>0 0 1</axis>
                </joint>
                <joint name="ROT_R" type="hinge" circular="true">
                    <body>ROT_R_LINK</body>
                    <body>ROT_P_LINK</body>
                    <axis>1 0 0</axis>
                </joint>
                <joint name="ROT_P" type="hinge" circular="true">
                    <body>ROT_P_LINK</body>
                    <body>ROT_Y_LINK</body>
                    <axis>0 1 0</axis>
                </joint>
                <joint name="ROT_Y" type="hinge" circular="true">
                    <body>ROT_Y_LINK</body>
                    <body>PELVIS_S</body>
                    <axis>0 0 1</axis>
                </joint>
            </kinbody>
        </robot>
    </robot>
</environment>
stephane-caron commented 8 years ago

On a related note, transforms (including translations of the baselink) appear in the <shape> tags of <rigid_body> definitions. Are these considered by OpenRAVE at all?

The Collada spec says the <shape> definitions are used for collision detection, but all transforms look static in the file definition...