Start of a urdfEditor.py, limited support to extract a URDF from a PyBullet body.
Use btCylinderShapeZ for URDF cylinder, instead of converting it to a btConvexHullShape. Implement PyBullet.getCollisionShapeData Extend PyBullet.getDynamicsInfo / b3GetDynamicsInfo, remove flag (don't rely on API returning a fixed number of elements in a list!) Extend PyBullet.getJointInfo: add parentIndex
This commit is contained in:
@@ -54,6 +54,8 @@ struct PhysicsDirectInternalData
|
||||
btAlignedObjectArray<b3OverlappingObject> m_cachedOverlappingObjects;
|
||||
|
||||
btAlignedObjectArray<b3VisualShapeData> m_cachedVisualShapes;
|
||||
btAlignedObjectArray<b3CollisionShapeData> m_cachedCollisionShapes;
|
||||
|
||||
btAlignedObjectArray<b3VRControllerEvent> m_cachedVREvents;
|
||||
|
||||
btAlignedObjectArray<b3KeyboardEvent> m_cachedKeyboardEvents;
|
||||
@@ -1011,6 +1013,27 @@ void PhysicsDirect::postProcessStatus(const struct SharedMemoryStatus& serverCmd
|
||||
{
|
||||
break;
|
||||
}
|
||||
case CMD_COLLISION_SHAPE_INFO_FAILED:
|
||||
{
|
||||
b3Warning("getCollisionShapeData failed");
|
||||
break;
|
||||
}
|
||||
case CMD_COLLISION_SHAPE_INFO_COMPLETED:
|
||||
{
|
||||
B3_PROFILE("CMD_COLLISION_SHAPE_INFO_COMPLETED");
|
||||
if (m_data->m_verboseOutput)
|
||||
{
|
||||
b3Printf("Collision Shape Information Request OK\n");
|
||||
}
|
||||
int numCollisionShapesCopied = serverCmd.m_sendCollisionShapeArgs.m_numCollisionShapes;
|
||||
m_data->m_cachedCollisionShapes.resize(numCollisionShapesCopied);
|
||||
b3CollisionShapeData* shapeData = (b3CollisionShapeData*)&m_data->m_bulletStreamDataServerToClient[0];
|
||||
for (int i = 0; i < numCollisionShapesCopied; i++)
|
||||
{
|
||||
m_data->m_cachedCollisionShapes[i] = shapeData[i];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CMD_RESTORE_STATE_FAILED:
|
||||
{
|
||||
b3Warning("restoreState failed");
|
||||
@@ -1242,6 +1265,14 @@ void PhysicsDirect::getCachedVisualShapeInformation(struct b3VisualShapeInformat
|
||||
visualShapesInfo->m_visualShapeData = visualShapesInfo->m_numVisualShapes ? &m_data->m_cachedVisualShapes[0] : 0;
|
||||
}
|
||||
|
||||
void PhysicsDirect::getCachedCollisionShapeInformation(struct b3CollisionShapeInformation* collisionShapesInfo)
|
||||
{
|
||||
collisionShapesInfo->m_numCollisionShapes = m_data->m_cachedCollisionShapes.size();
|
||||
collisionShapesInfo->m_collisionShapeData = collisionShapesInfo->m_numCollisionShapes ? &m_data->m_cachedCollisionShapes[0] : 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PhysicsDirect::getCachedVREvents(struct b3VREventsData* vrEventsData)
|
||||
{
|
||||
vrEventsData->m_numControllerEvents = m_data->m_cachedVREvents.size();
|
||||
|
||||
Reference in New Issue
Block a user