Closed nunoguedelha closed 6 years ago
The iCub foot has a quite complex shape. The SDF format provides 3 possible solutions to approximate the collision geometry.
In theory, we can have 4 or more little spheres on each corner of the foot. The major drawback, in this case, is that collisions that don't involve the spheres are not detected (i.e. the foot can intersect with a step, if the step edge is in contact only with the center of the sole).
In this case, we can either draw a box smaller than the foot or a bit bigger.
Starting from SDF version 1.5, it is possible to use also polylines. In this case we can better approximate the foot shape. If we go for this geometry, we need to update the supported geometries in the simmechanics-to-urdf tool.
This requires also making sure that the library package GTS is installed with the Gazebo simulator. This is automatically done by upgrading to the latest Gazebo version 8.1.1.7 or explicitly installing the package, for instance through a package manager (apt-get install libgts-dev
on linux, or brew intall gts
on macos.
4 points
6 points (compatible with IHMC controller)
8 points
We decided to go for the use of polylines for defining the collision geometry. As a reminder: the library package GTS has to be installed. It has been checked in macos that the library can be installed with Gazebo by upgrading to latest version 8.1.1.7 through Homebrew. The simmechanics-to-urdf dependency is implemented by ...
A link can contain multiple collision elements (refer to collision
definition in this Gazebo tutorial). For instance:
<link name='l_foot'>
...
<collision name='l_foot_collision'>
...
</collision>
<collision name='l_foot_collision_2'>
...
</collision>
...
</link>
In each collision element, only the first defined geometry element will be considered, the remaining ones ignored.
As per the URDF specification here, Polyline shapes are not supported in URDF format.
Multiple collision bodies are not supported in URDF either. Custom collision elements, for instance meant for collision checking by a controller, can be added wrapped in a custom tag—
<gazebo>
tag.<gazebo>
tag.So, two solutions are left:
<gazebo>
We give here an example of a model composed by a standalone foot link with simplified collision geometry. The extruded polyline geometry element between the foot mesh and the ground has 4 points and an exagerated height for making it more visible.
Thanks @nunoguedelha for the analysis. Do you think that we need the collision in the URDF? Otherwise, for the time being, I would keep it simple: use the polyline as the collision geometry of the sole for all the models (also the one that we don't use in Gazebo).
Replace the collision mesh by the box defined through the YAML config parameters.
As for the previous solution, the collision box is required only for iCub Gazebo models so the parameters could be inserted through Cmake when generating the YAML file from the YAML template. The input parameters would be generated in the YAML file as:
collisionShapes:
- linkName: l_foot
type: box
xyz: [<x>,<y>,<z>]
originXYZ: [<x>,<y>,<z>]
originRPY: [<r>,<p>,<y>]
- linkName: r_foot
...
Thanks @nunoguedelha for the analysis. Do you think that we need the collision in the URDF? Otherwise, for the time being, I would keep is simple: use the polyline as the collision geometry of the sole for all the models (also the one that we don't use in Gazebo).
Well, if we go for the Polyline choice (solution 1), it requires defining two new links "l_sole" and "r_sole" that we fixe to the feet. restraining it to Gazebo models through Cmake is no big deal and avoids adding complexity (additional links) to the other models.
Consider that sooner or later, Polylines should be supported also in URDF, or at least by the Gazebo URDF parser (unless they don't use any layer over the urdfdom
parser), and only then we can replace the mesh or add to it the polylines within the foot link definition.
The biggest simplification would be to use just a box for now (solution 1), on all models or just the Gazebo model.
If we go for solution 1, we can proceed as follows:
<collision_controller_check>
that would be ignored by Gazebo, and could be parsed any of our controllers if required.Consider that sooner or later, Polylines should be supported also in URDF, or at least by the Gazebo URDF parser (unless they don't use any layer over the urdfdom parser)
I am afraid Gazebo will never support Polylines in URDF files.
After last discussion with @fiorisi , we decided to go for solution 2, until a better support of polylines is available:
simmechanics-to-urdf
parser already supports replacing meshes with simple geometric shapes, as it was tested on R1.Possible sole approximation
In the future, to do this automatically (and more importantly, systematically) it could make sense to investigate the use of approximate convex decomposition techniques such as the one contained in https://github.com/gaschler/bounding-mesh or https://github.com/kmammou/v-hacd/ .
cc @aerydna @claudiofantacci @xEnVrE
The collision meshes in the foot should be substituted with a simpler primitive shapes (box or four spheres). This would improve the simulation performance and reduce the computations for estimating the contact forces.