roboticslibrary / rl-examples

Kinematics, dynamics, geometry, and path planning definitions for the Robotics Library (RL).
https://www.roboticslibrary.org/
40 stars 14 forks source link

Using Universal Robot with FCL #4

Closed bedieber closed 4 years ago

bedieber commented 4 years ago

Hi, I am having an issue using the FCL with the UR models. I am trying to allocate a collisionscene from FCL and load a scene containing a UR. You can reproduce that in the rlCollisionDemo pretty easily.

Steps to reproduce:

The resulting error message:

rl::sg::XmlFactory::load() - shapeScaleFactor not supported

I tried to find such a factor in the model. The only scale factor is in the UR links but changing it seems to make no difference.

The exception itself is thrown in sg/XmlFactory.cpp in line 243 (commit cba76ed3e54676d4 which is HEAD at the time of writing). I tried debugging a bit deeper but I could not really find the issue.

Thank you very much in advance Bernhard

rickertm commented 4 years ago

The rl::sg::XmlFactory will combine all transformation matrices between the body and the respective shape into one matrix, The CAD files for the UR5 were originally defined in millimeters. With the converter I was using, each link has a scale entry in a transform, e.g., in https://github.com/roboticslibrary/rl-examples/blob/31348e713c32fe35b28f1f6eae07ed7c47e4fecd/rlsg/universal-robots-ur5/link0.wrl#L8 FCL at the moment however only allows setting the rotation and translation for an object. An alternative would be to apply the scale to each point in the meshes, preferably directly when converting the files to VRML.

rickertm commented 4 years ago

The optimized convex geometries in rlsg/universal-robots-ur5.convex already remove the scale entries in the matrices and should work fine. For better performance in collision detection, I would recommend to use these over the other files anyway.

bedieber commented 4 years ago

Hm, indeed that solves the proble. I can load the ur5 convex in the collission demo. Thank's a lot for your help