Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bullet SDF parser does not parse correctly SDF files with <use_parent_model_frame>1</use_parent_model_frame> #1707

Closed
traversaro opened this issue May 24, 2018 · 3 comments

Comments

@traversaro
Copy link

In SDF files, the joint axis can be expressed in the "joint frame", or in the parent "model frame" if the option use_parent_model_frame is set to true:

Represents the x,y,z components of the axis unit vector. The axis is expressed in the joint frame unless the use_parent_model_frame flag is set to true. The vector should be normalized.

http://sdformat.org/spec?ver=1.6&elem=joint#axis_xyz

See https://bitbucket.org/osrf/gazebo/issues/494 for an historical discussion on the use_parent_model_frame option.

Currently the Bullet SDF parser only supports the case in which the axis is expressed in joint frame:

if (!parseVector3(joint.m_localJointAxis,std::string(xyz_xml->GetText()),logger))

and it silently loads the wrong axis if a joint contains the <use_parent_model_frame>1</use_parent_model_frame> option.

It would be great if bullet at least printed an error when trying to load this files.

The main reason why this may be problematic is that SDF models generated with the URDF to SDF converter provided by sdformat always contain the use_parent_model_frame option set to 1

@traversaro
Copy link
Author

cc @diegoferigo @DanielePucci @anqingd

@erwincoumans
Copy link
Member

Indeed, PyBullet doesn't support this legacy support option of Gazebo (latest version of Gazebo uses the same default as PyBullet, using the joint axis in child joint frame). Adding a print is easy, somewhere in UrdfParser.cpp (which is also used for SDF files).

If someone wants to implement the backward compatibility, it is a bit more work. Aside from adding the element in UrdfParser (UrdfJoint), the conversion code would happen in Urdf2Bullet, around this block of code:

  btTransform offsetInA,offsetInB;
            offsetInA = parentLocalInertialFrame.inverse()*parent2joint;
            offsetInB = localInertialFrame.inverse();
            btQuaternion parentRotToThis = offsetInB.getRotation() * offsetInA.inverse().getRotation();

@traversaro
Copy link
Author

Since sdformat > 8.4, the URDF --> SDF converter does not export any more SDF files with use_parent_model_frame set to 1, so i think we can close the issue as this was actually just affecting SDF that were generated from URDF . See https://bitbucket.org/osrf/sdformat/issues/189/convert-urdf-files-to-sdf-with .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants