PyBullet / BulletRobotics:
Implement collisionFilterPlugin, use setCollisionFilterPair to enable or disable collision detection between specific pairs of objects. Also, expose setCollisionFilterGroupMask as PyBullet API and in urdf using the tag <collision group="1" mask="2"/>. See examples/pybullet/examples/collisionFilter.py for an example. PyBullet default: Lower the warmstarting factor, for maximal coordinates rigid bodies for more stable simulation. Add btCollisionWorld::refreshBroadphaseProxy to easier recreate the broadphase proxy without adding/removing objects to the world.
This commit is contained in:
@@ -1405,7 +1405,31 @@ int BulletURDFImporter::getAllocatedTexture(int index) const
|
||||
return m_data->m_allocatedTextures[index];
|
||||
}
|
||||
|
||||
|
||||
int BulletURDFImporter::getCollisionGroupAndMask(int linkIndex, int& colGroup, int& colMask) const
|
||||
{
|
||||
int result = 0;
|
||||
UrdfLink* const* linkPtr = m_data->m_urdfParser.getModel().m_links.getAtIndex(linkIndex);
|
||||
btAssert(linkPtr);
|
||||
if (linkPtr)
|
||||
{
|
||||
UrdfLink* link = *linkPtr;
|
||||
for (int v=0;v<link->m_collisionArray.size();v++)
|
||||
{
|
||||
const UrdfCollision& col = link->m_collisionArray[v];
|
||||
if (col.m_flags & URDF_HAS_COLLISION_GROUP)
|
||||
{
|
||||
colGroup = col.m_collisionGroup;
|
||||
result |= URDF_HAS_COLLISION_GROUP;
|
||||
}
|
||||
if (col.m_flags & URDF_HAS_COLLISION_MASK)
|
||||
{
|
||||
colMask = col.m_collisionMask;
|
||||
result |= URDF_HAS_COLLISION_MASK;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
class btCompoundShape* BulletURDFImporter::convertLinkCollisionShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame) const
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
virtual void getMassAndInertia(int linkIndex, btScalar& mass,btVector3& localInertiaDiagonal, btTransform& inertialFrame) const;
|
||||
virtual void getMassAndInertia2(int urdfLinkIndex, btScalar& mass, btVector3& localInertiaDiagonal, btTransform& inertialFrame, int flags) const;
|
||||
|
||||
|
||||
|
||||
virtual bool getJointInfo(int urdfLinkIndex, btTransform& parent2joint, btTransform& linkTransformInWorld, btVector3& jointAxisInJointSpace, int& jointType, btScalar& jointLowerLimit, btScalar& jointUpperLimit, btScalar& jointDamping, btScalar& jointFriction) const;
|
||||
virtual bool getJointInfo2(int urdfLinkIndex, btTransform& parent2joint, btTransform& linkTransformInWorld, btVector3& jointAxisInJointSpace, int& jointType, btScalar& jointLowerLimit, btScalar& jointUpperLimit, btScalar& jointDamping, btScalar& jointFriction, btScalar& jointMaxForce, btScalar& jointMaxVelocity) const;
|
||||
|
||||
@@ -81,6 +81,8 @@ public:
|
||||
///todo(erwincoumans) refactor this convertLinkCollisionShapes/memory allocation
|
||||
|
||||
virtual class btCompoundShape* convertLinkCollisionShapes(int linkIndex, const char* pathPrefix, const btTransform& localInertiaFrame) const;
|
||||
|
||||
virtual int getCollisionGroupAndMask(int linkIndex, int& colGroup, int& colMask) const;
|
||||
|
||||
virtual int getNumAllocatedCollisionShapes() const;
|
||||
virtual class btCollisionShape* getAllocatedCollisionShape(int index);
|
||||
|
||||
@@ -571,6 +571,24 @@ bool UrdfParser::parseCollision(UrdfCollision& collision, XMLElement* config, Er
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
const char* group_char = config->Attribute("group");
|
||||
if (group_char)
|
||||
{
|
||||
collision.m_flags |= URDF_HAS_COLLISION_GROUP;
|
||||
collision.m_collisionGroup = urdfLexicalCast<int>(group_char);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const char* mask_char = config->Attribute("mask");
|
||||
if (mask_char)
|
||||
{
|
||||
collision.m_flags |= URDF_HAS_COLLISION_MASK;
|
||||
collision.m_collisionMask = urdfLexicalCast<int>(mask_char);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const char *name_char = config->Attribute("name");
|
||||
if (name_char)
|
||||
|
||||
Reference in New Issue
Block a user