unsupported: expose collisionMargin to changeDynamics/getDynamicsInfo.

add cube_convex.urdf for testing this collisionMargin. Test script:
import pybullet as p
import time
p.connect(p.GUI)
plane = p.loadURDF("plane_implicit.urdf")
cube = p.loadURDF("cube_convex.urdf",[0,0,1])
p.setGravity(0,0,-10)
while (1):
	p.stepSimulation()
	pts = p.getContactPoints()
	p.changeDynamics(plane,-1,collisionMargin=0.3)
	p.changeDynamics(cube,-1,collisionMargin=0.3)
	print("===================")
	print("cube pos=", p.getBasePositionAndOrientation(cube)[0])
	print("margin=", p.getDynamicsInfo(plane,-1)[11])
	#time.sleep(1./10.)
This commit is contained in:
Erwin Coumans
2020-02-14 17:36:40 -08:00
parent b3ff3ebcb1
commit 6afa0a463d
7 changed files with 86 additions and 3 deletions

View File

@@ -3256,6 +3256,19 @@ B3_SHARED_API int b3ChangeDynamicsInfoSetMaxJointVelocity(b3SharedMemoryCommandH
return 0;
}
B3_SHARED_API int b3ChangeDynamicsInfoSetCollisionMargin(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, double collisionMargin)
{
struct SharedMemoryCommand* command = (struct SharedMemoryCommand*)commandHandle;
b3Assert(command->m_type == CMD_CHANGE_DYNAMICS_INFO);
command->m_changeDynamicsInfoArgs.m_bodyUniqueId = bodyUniqueId;
command->m_changeDynamicsInfoArgs.m_linkIndex = -1;
command->m_changeDynamicsInfoArgs.m_collisionMargin = collisionMargin;
command->m_updateFlags |= CHANGE_DYNAMICS_INFO_SET_COLLISION_MARGIN;
return 0;
}
B3_SHARED_API int b3ChangeDynamicsInfoSetActivationState(b3SharedMemoryCommandHandle commandHandle, int bodyUniqueId, int activationState)