[pybullet] expose collision filter mode and max constraint force:
pybullet.changeUserConstraint(maxForce=<double>) pybullet.setPhysicsEngineParameter(collisionFilterMode=<int>)
This commit is contained in:
@@ -347,6 +347,18 @@ int b3PhysicsParamSetNumSolverIterations(b3SharedMemoryCommandHandle commandHand
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int b3PhysicsParamSetCollisionFilterMode(b3SharedMemoryCommandHandle commandHandle, int filterMode)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle;
|
||||
b3Assert(command->m_type == CMD_SEND_PHYSICS_SIMULATION_PARAMETERS);
|
||||
command->m_physSimParamArgs.m_collisionFilterMode = filterMode;
|
||||
command->m_updateFlags |= SIM_PARAM_UPDATE_COLLISION_FILTER_MODE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int b3PhysicsParamSetTimeStep(b3SharedMemoryCommandHandle commandHandle, double timeStep)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle;
|
||||
@@ -1109,6 +1121,19 @@ int b3InitChangeUserConstraintSetFrameInB(b3SharedMemoryCommandHandle commandHan
|
||||
return 0;
|
||||
}
|
||||
|
||||
int b3InitChangeUserConstraintSetMaxForce(b3SharedMemoryCommandHandle commandHandle, double maxAppliedForce)
|
||||
{
|
||||
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*) commandHandle;
|
||||
b3Assert(command);
|
||||
b3Assert(command->m_type == CMD_USER_CONSTRAINT);
|
||||
b3Assert(command->m_updateFlags & USER_CONSTRAINT_CHANGE_CONSTRAINT);
|
||||
|
||||
command->m_updateFlags |=USER_CONSTRAINT_CHANGE_MAX_FORCE;
|
||||
command->m_userConstraintArguments.m_maxAppliedForce = maxAppliedForce;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
b3SharedMemoryCommandHandle b3InitRemoveUserConstraintCommand(b3PhysicsClientHandle physClient, int userConstraintUniqueId)
|
||||
{
|
||||
|
||||
@@ -77,6 +77,8 @@ int b3GetStatusUserConstraintUniqueId(b3SharedMemoryStatusHandle statusHandle);
|
||||
b3SharedMemoryCommandHandle b3InitChangeUserConstraintCommand(b3PhysicsClientHandle physClient, int userConstraintUniqueId);
|
||||
int b3InitChangeUserConstraintSetPivotInB(b3SharedMemoryCommandHandle commandHandle, double jointChildPivot[3]);
|
||||
int b3InitChangeUserConstraintSetFrameInB(b3SharedMemoryCommandHandle commandHandle, double jointChildFrameOrn[4]);
|
||||
int b3InitChangeUserConstraintSetMaxForce(b3SharedMemoryCommandHandle commandHandle, double maxAppliedForce);
|
||||
|
||||
|
||||
b3SharedMemoryCommandHandle b3InitRemoveUserConstraintCommand(b3PhysicsClientHandle physClient, int userConstraintUniqueId);
|
||||
|
||||
@@ -170,6 +172,10 @@ int b3PhysicsParamSetDefaultContactERP(b3SharedMemoryCommandHandle commandHandle
|
||||
int b3PhysicsParamSetNumSubSteps(b3SharedMemoryCommandHandle commandHandle, int numSubSteps);
|
||||
int b3PhysicsParamSetRealTimeSimulation(b3SharedMemoryCommandHandle commandHandle, int enableRealTimeSimulation);
|
||||
int b3PhysicsParamSetNumSolverIterations(b3SharedMemoryCommandHandle commandHandle, int numSolverIterations);
|
||||
int b3PhysicsParamSetCollisionFilterMode(b3SharedMemoryCommandHandle commandHandle, int filterMode);
|
||||
|
||||
|
||||
|
||||
int b3PhysicsParamSetUseSplitImpulse(b3SharedMemoryCommandHandle commandHandle, int useSplitImpulse);
|
||||
int b3PhysicsParamSetSplitImpulsePenetrationThreshold(b3SharedMemoryCommandHandle commandHandle, double splitImpulsePenetrationThreshold);
|
||||
|
||||
|
||||
@@ -3664,6 +3664,11 @@ bool PhysicsServerCommandProcessor::processCommand(const struct SharedMemoryComm
|
||||
btMatrix3x3 childFrameBasis(childFrameOrn);
|
||||
userConstraintPtr->m_mbConstraint->setFrameInB(childFrameBasis);
|
||||
}
|
||||
if (clientCmd.m_updateFlags & USER_CONSTRAINT_CHANGE_MAX_FORCE)
|
||||
{
|
||||
btScalar maxImp = clientCmd.m_userConstraintArguments.m_maxAppliedForce*m_data->m_physicsDeltaTime;
|
||||
userConstraintPtr->m_mbConstraint->setMaxAppliedImpulse(maxImp);
|
||||
}
|
||||
}
|
||||
if (userConstraintPtr->m_rbConstraint)
|
||||
{
|
||||
|
||||
@@ -540,6 +540,8 @@ enum EnumUserConstraintFlags
|
||||
USER_CONSTRAINT_CHANGE_CONSTRAINT=4,
|
||||
USER_CONSTRAINT_CHANGE_PIVOT_IN_B=8,
|
||||
USER_CONSTRAINT_CHANGE_FRAME_ORN_IN_B=16,
|
||||
USER_CONSTRAINT_CHANGE_MAX_FORCE=32,
|
||||
|
||||
};
|
||||
|
||||
struct UserConstraintArgs
|
||||
@@ -552,6 +554,7 @@ struct UserConstraintArgs
|
||||
double m_childFrame[7];
|
||||
double m_jointAxis[3];
|
||||
int m_jointType;
|
||||
double m_maxAppliedForce;
|
||||
int m_userConstraintUniqueId;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user