separate spinning friction (torsional friction around contact normal) from

rolling friction (orthogonal to contact normal)
This commit is contained in:
Erwin Coumans
2016-09-16 00:04:33 +01:00
parent 4d6a95017e
commit 1d88cf71e4
11 changed files with 67 additions and 9 deletions

View File

@@ -410,6 +410,10 @@ void ConvertURDF2BulletInternal(
{
col->setRollingFriction(contactInfo.m_rollingFriction);
}
if ((contactInfo.m_flags & URDF_CONTACT_HAS_SPINNING_FRICTION)!=0)
{
col->setSpinningFriction(contactInfo.m_spinningFriction);
}
if ((contactInfo.m_flags & URDF_CONTACT_HAS_STIFFNESS_DAMPING)!=0)
{
col->setContactStiffnessAndDamping(contactInfo.m_contactStiffness,contactInfo.m_contactDamping);

View File

@@ -16,17 +16,20 @@ enum UrdfJointTypes
enum URDF_LinkContactFlags
{
URDF_CONTACT_HAS_LATERAL_FRICTION=1,
URDF_CONTACT_HAS_ROLLING_FRICTION=2,
URDF_CONTACT_HAS_INERTIA_SCALING=2,
URDF_CONTACT_HAS_CONTACT_CFM=4,
URDF_CONTACT_HAS_CONTACT_ERP=8,
URDF_CONTACT_HAS_STIFFNESS_DAMPING=16,
URDF_CONTACT_HAS_ROLLING_FRICTION=32,
URDF_CONTACT_HAS_SPINNING_FRICTION=64,
};
struct URDFLinkContactInfo
{
btScalar m_lateralFriction;
btScalar m_rollingFriction;
btScalar m_spinningFriction;
btScalar m_inertiaScaling;
btScalar m_contactCfm;
btScalar m_contactErp;
@@ -38,6 +41,7 @@ struct URDFLinkContactInfo
URDFLinkContactInfo()
:m_lateralFriction(0.5),
m_rollingFriction(0),
m_spinningFriction(0),
m_inertiaScaling(1),
m_contactCfm(0),
m_contactErp(0),

View File

@@ -672,7 +672,28 @@ bool UrdfParser::parseLink(UrdfModel& model, UrdfLink& link, TiXmlElement *confi
}
}
}
{
TiXmlElement *spinning_xml = ci->FirstChildElement("spinning_friction");
if (spinning_xml)
{
if (m_parseSDF)
{
link.m_contactInfo.m_spinningFriction = urdfLexicalCast<double>(spinning_xml->GetText());
link.m_contactInfo.m_flags |= URDF_CONTACT_HAS_SPINNING_FRICTION;
} else
{
if (!spinning_xml->Attribute("value"))
{
logger->reportError("Link/contact: spinning friction element must have value attribute");
return false;
}
link.m_contactInfo.m_spinningFriction = urdfLexicalCast<double>(spinning_xml->Attribute("value"));
link.m_contactInfo.m_flags |= URDF_CONTACT_HAS_SPINNING_FRICTION;
}
}
}
{
TiXmlElement *stiffness_xml = ci->FirstChildElement("stiffness");