🚀 Feature
urdfdom >= 6 support capsule as shape.
In previous urdfdom version, pinocchio was using a workaround to support capsule.
We should remove it when urdfdom 6 become the minimal version supported.
Motivation
Workaround code is here:
bool isCapsule(const std::string & linkName, const std::string & geomName) const
{
LinkMap_t::const_iterator _link = links_.find(linkName);
assert(_link != links_.end());
const ptree & link = _link->second;
if (link.count("collision_checking") == 0)
return false;
BOOST_FOREACH (const ptree::value_type & cc, link.get_child("collision_checking"))
{
if (cc.first == "capsule")
{
std::string name = cc.second.get<std::string>("<xmlattr>.name");
if (geomName == name)
return true;
}
} // BOOST_FOREACH
return false;
}
// ...
// Handle the case where collision geometry is a cylinder
// Use coal capsules for cylinders
else if (urdf_geometry->type == ::urdf::Geometry::CYLINDER)
{
const bool is_capsule = tree.isCapsule(linkName, geomName);
meshScale << 1, 1, 1;
const ::urdf::CylinderSharedPtr collisionGeometry =
::urdf::static_pointer_cast<::urdf::Cylinder>(urdf_geometry);
double radius = collisionGeometry->radius;
double length = collisionGeometry->length;
// Create coal capsule geometry.
if (is_capsule)
{
meshPath = "CAPSULE";
geometry = std::shared_ptr<coal::CollisionGeometry>(new coal::Capsule(radius, length));
}
else
{
meshPath = "CYLINDER";
geometry = std::shared_ptr<coal::CollisionGeometry>(new coal::Cylinder(radius, length));
}
}
An example can be found here:
<link name="BODY">
<inertial>
<origin xyz="0 0 0.0375" rpy="0 0 0"/>
<mass value="27"/>
<inertia ixx="1" ixy="0" ixz="0" iyy="1" iyz="0" izz="1" />
</inertial>
<collision name="test">
<geometry>
<cylinder radius="1" length="1"/>
</geometry>
</collision>
<collision name="box">
<geometry>
<mesh filename="package://example-robot-data/robots/simple_humanoid_description/meshes/box.stl" />
</geometry>
</collision>
<collision_checking>
<!--- This tells to pinocchio to replace the cylinder called "test"
by a capsule with the same radius and length -->
<capsule name="test"/>
<convex name="box"/>
</collision_checking>
</link>
Alternatives
No response
Additional context
No response
Checklist
🚀 Feature
urdfdom >= 6 support capsule as shape.
In previous urdfdom version, pinocchio was using a workaround to support capsule.
We should remove it when urdfdom 6 become the minimal version supported.
Motivation
Workaround code is here:
An example can be found here:
Alternatives
No response
Additional context
No response
Checklist