MJCF: support for default joint limited="true"
This commit is contained in:
@@ -152,6 +152,9 @@ struct BulletMJCFImporterInternalData
|
|||||||
int m_defaultCollisionMask;
|
int m_defaultCollisionMask;
|
||||||
btScalar m_defaultCollisionMargin;
|
btScalar m_defaultCollisionMargin;
|
||||||
|
|
||||||
|
// joint defaults
|
||||||
|
std::string m_defaultJointLimited;
|
||||||
|
|
||||||
//those collision shapes are deleted by caller (todo: make sure this happens!)
|
//those collision shapes are deleted by caller (todo: make sure this happens!)
|
||||||
btAlignedObjectArray<btCollisionShape*> m_allocatedCollisionShapes;
|
btAlignedObjectArray<btCollisionShape*> m_allocatedCollisionShapes;
|
||||||
|
|
||||||
@@ -243,6 +246,17 @@ struct BulletMJCFImporterInternalData
|
|||||||
{
|
{
|
||||||
parseAssets(child_xml,logger);
|
parseAssets(child_xml,logger);
|
||||||
}
|
}
|
||||||
|
if (n=="joint")
|
||||||
|
{
|
||||||
|
// Other attributes here:
|
||||||
|
// armature="1"
|
||||||
|
// damping="1"
|
||||||
|
// limited="true"
|
||||||
|
if (const char* conTypeStr = child_xml->Attribute("limited"))
|
||||||
|
{
|
||||||
|
m_defaultJointLimited = child_xml->Attribute("limited");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (n=="geom")
|
if (n=="geom")
|
||||||
{
|
{
|
||||||
//contype, conaffinity
|
//contype, conaffinity
|
||||||
@@ -366,9 +380,11 @@ struct BulletMJCFImporterInternalData
|
|||||||
bool isLimited = false;
|
bool isLimited = false;
|
||||||
double range[2] = {1,0};
|
double range[2] = {1,0};
|
||||||
|
|
||||||
|
std::string lim = m_defaultJointLimited;
|
||||||
if (limitedStr)
|
if (limitedStr)
|
||||||
{
|
{
|
||||||
std::string lim = limitedStr;
|
lim = limitedStr;
|
||||||
|
}
|
||||||
if (lim=="true")
|
if (lim=="true")
|
||||||
{
|
{
|
||||||
isLimited = true;
|
isLimited = true;
|
||||||
@@ -387,18 +403,34 @@ struct BulletMJCFImporterInternalData
|
|||||||
}
|
}
|
||||||
if (sizes.size()==2)
|
if (sizes.size()==2)
|
||||||
{
|
{
|
||||||
range[0] = sizes[0];
|
// TODO angle units are in "<compiler angle="degree" inertiafromgeom="true"/>
|
||||||
range[1] = sizes[1];
|
range[0] = sizes[0] * M_PI / 180;
|
||||||
|
range[1] = sizes[1] * M_PI / 180;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
logger->reportWarning("Expected range[2] in joint with limits");
|
logger->reportWarning("Expected range[2] in joint with limits");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
// TODO armature : real, "0" Armature inertia (or rotor inertia) of all
|
||||||
} else
|
// degrees of freedom created by this joint. These are constants added to the
|
||||||
{
|
// diagonal of the inertia matrix in generalized coordinates. They make the
|
||||||
// logger->reportWarning("joint without limited field");
|
// simulation more stable, and often increase physical realism. This is because
|
||||||
}
|
// when a motor is attached to the system with a transmission that amplifies
|
||||||
|
// the motor force by c, the inertia of the rotor (i.e. the moving part of the
|
||||||
|
// motor) is amplified by c*c. The same holds for gears in the early stages of
|
||||||
|
// planetary gear boxes. These extra inertias often dominate the inertias of
|
||||||
|
// the robot parts that are represented explicitly in the model, and the
|
||||||
|
// armature attribute is the way to model them.
|
||||||
|
|
||||||
|
// TODO damping : real, "0" Damping applied to all degrees of
|
||||||
|
// freedom created by this joint. Unlike friction loss
|
||||||
|
// which is computed by the constraint solver, damping is
|
||||||
|
// simply a force linear in velocity. It is included in
|
||||||
|
// the passive forces. Despite this simplicity, larger
|
||||||
|
// damping values can make numerical integrators unstable,
|
||||||
|
// which is why our Euler integrator handles damping
|
||||||
|
// implicitly. See Integration in the Computation chapter.
|
||||||
|
|
||||||
bool jointHandled = false;
|
bool jointHandled = false;
|
||||||
const UrdfLink* linkPtr = getLink(modelIndex,linkIndex);
|
const UrdfLink* linkPtr = getLink(modelIndex,linkIndex);
|
||||||
|
|||||||
Reference in New Issue
Block a user