getCollisionShapeData and getVisualShapeData were added to RobotSimulatorClinetAPI_NoGUI. b3RobotSimulatorJointMotorArrayArgs initialization bug fix.

This commit is contained in:
donghokang
2018-05-29 16:23:17 +02:00
parent fc9a2f88ef
commit a3e4582bef
2 changed files with 69 additions and 3 deletions

View File

@@ -1626,6 +1626,10 @@ bool b3RobotSimulatorClientAPI_NoGUI::setPhysicsEngineParameter(struct b3RobotSi
b3PhysicsParamSetDefaultFrictionERP(command,args.m_frictionERP); b3PhysicsParamSetDefaultFrictionERP(command,args.m_frictionERP);
} }
if (args.m_restitutionVelocityThreshold >= 0) {
b3PhysicsParamSetSolverResidualThreshold(command, args.m_solverResidualThreshold);
}
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, command); statusHandle = b3SubmitClientCommandAndWaitStatus(sm, command);
return true; return true;
} }
@@ -2060,4 +2064,53 @@ void b3RobotSimulatorClientAPI_NoGUI::setGuiHelper(struct GUIHelperInterface* gu
struct GUIHelperInterface* b3RobotSimulatorClientAPI_NoGUI::getGuiHelper() struct GUIHelperInterface* b3RobotSimulatorClientAPI_NoGUI::getGuiHelper()
{ {
return m_data->m_guiHelper; return m_data->m_guiHelper;
} }
bool b3RobotSimulatorClientAPI_NoGUI::getCollisionShapeData(int bodyUniqueId, int linkIndex,
b3CollisionShapeInformation &collisionShapeInfo)
{
b3PhysicsClientHandle sm = m_data->m_physicsClientHandle;
if (sm == 0) {
b3Warning("Not connected");
return false;
}
b3SharedMemoryCommandHandle command;
b3SharedMemoryStatusHandle statusHandle;
int statusType;
{
command = b3InitRequestCollisionShapeInformation(sm, bodyUniqueId, linkIndex);
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, command);
statusType = b3GetStatusType(statusHandle);
}
btAssert(statusType == CMD_COLLISION_SHAPE_INFO_COMPLETED);
if (statusType == CMD_COLLISION_SHAPE_INFO_COMPLETED) {
b3GetCollisionShapeInformation(sm, &collisionShapeInfo);
}
return true;
}
bool b3RobotSimulatorClientAPI_NoGUI::getVisualShapeData(int bodyUniqueId, b3VisualShapeInformation &visualShapeInfo)
{
b3PhysicsClientHandle sm = m_data->m_physicsClientHandle;
if (sm == 0) {
b3Warning("Not connected");
return false;
}
b3SharedMemoryCommandHandle commandHandle;
b3SharedMemoryStatusHandle statusHandle;
int statusType;
{
commandHandle = b3InitRequestVisualShapeInformation(sm, bodyUniqueId);
statusHandle = b3SubmitClientCommandAndWaitStatus(sm, commandHandle);
statusType = b3GetStatusType(statusHandle);
btAssert(statusType == CMD_VISUAL_SHAPE_INFO_COMPLETED);
if (statusType == CMD_VISUAL_SHAPE_INFO_COMPLETED) {
b3GetVisualShapeInformation(sm, &visualShapeInfo);
}
return true;
}
}

View File

@@ -152,7 +152,14 @@ struct b3RobotSimulatorJointMotorArrayArgs
double *m_forces; double *m_forces;
b3RobotSimulatorJointMotorArrayArgs(int controlMode, int numControlledDofs) b3RobotSimulatorJointMotorArrayArgs(int controlMode, int numControlledDofs)
: m_controlMode(controlMode), m_numControlledDofs(numControlledDofs) : m_controlMode(controlMode),
m_numControlledDofs(numControlledDofs),
m_jointIndices(NULL),
m_targetPositions(NULL),
m_kps(NULL),
m_targetVelocities(NULL),
m_kds(NULL),
m_forces(NULL)
{ {
} }
}; };
@@ -204,6 +211,7 @@ struct b3RobotSimulatorSetPhysicsEngineParameters
double m_erp; double m_erp;
double m_contactERP; double m_contactERP;
double m_frictionERP; double m_frictionERP;
double m_solverResidualThreshold;
b3RobotSimulatorSetPhysicsEngineParameters() b3RobotSimulatorSetPhysicsEngineParameters()
: m_fixedTimeStep(-1), : m_fixedTimeStep(-1),
@@ -218,7 +226,8 @@ struct b3RobotSimulatorSetPhysicsEngineParameters
m_restitutionVelocityThreshold(-1), m_restitutionVelocityThreshold(-1),
m_erp(-1), m_erp(-1),
m_contactERP(-1), m_contactERP(-1),
m_frictionERP(-1) m_frictionERP(-1),
m_solverResidualThreshold(-1)
{} {}
}; };
@@ -566,6 +575,10 @@ public:
virtual void setGuiHelper(struct GUIHelperInterface* guiHelper); virtual void setGuiHelper(struct GUIHelperInterface* guiHelper);
virtual struct GUIHelperInterface* getGuiHelper(); virtual struct GUIHelperInterface* getGuiHelper();
bool getCollisionShapeData(int bodyUniqueId, int linkIndex, b3CollisionShapeInformation &collisionShapeInfo);
bool getVisualShapeData(int bodyUniqueId, b3VisualShapeInformation &visualShapeInfo);
}; };