diff options
author | erwincoumans <erwincoumans@google.com> | 2020-08-06 17:16:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 17:16:22 -0700 |
commit | b09f9eda1dd64caf9f484383c6cc3e01b8f20d32 (patch) | |
tree | c13a2eaf17802996ef4cf6e01a2091fbbd145a31 | |
parent | ba6117c4eddae55ffc9273371d984c59020fca1c (diff) | |
parent | eef0d647cd47d3715ff7e723b8b525b98b243ed1 (diff) | |
download | bullet3-b09f9eda1dd64caf9f484383c6cc3e01b8f20d32.tar.gz |
Merge pull request #2968 from xhan0619/implicit-picking
Implicit picking
-rw-r--r-- | data/torus_deform.urdf | 4 | ||||
-rw-r--r-- | examples/pybullet/examples/deformable_ball.py | 2 | ||||
-rw-r--r-- | examples/pybullet/examples/deformable_torus.py | 2 | ||||
-rw-r--r-- | src/BulletSoftBody/btDeformableBackwardEulerObjective.cpp | 6 |
4 files changed, 8 insertions, 6 deletions
diff --git a/data/torus_deform.urdf b/data/torus_deform.urdf index 20fa3e1a3..a3b49dc94 100644 --- a/data/torus_deform.urdf +++ b/data/torus_deform.urdf @@ -2,13 +2,13 @@ <robot name="torus"> <deformable name="torus"> <inertial> - <mass value="1" /> + <mass value="3" /> <inertia ixx="0.0" ixy="0" ixz="0" iyy="0" iyz="0" izz="0" /> </inertial> <collision_margin value="0.006"/> <repulsion_stiffness value="800.0"/> <friction value= "0.5"/> - <neohookean mu= "60" lambda= "200" damping= "0.01" /> + <neohookean mu= "180" lambda= "600" damping= "0.01" /> <visual filename="torus.vtk"/> </deformable> </robot> diff --git a/examples/pybullet/examples/deformable_ball.py b/examples/pybullet/examples/deformable_ball.py index dea6bc51f..68dd39aaa 100644 --- a/examples/pybullet/examples/deformable_ball.py +++ b/examples/pybullet/examples/deformable_ball.py @@ -14,7 +14,7 @@ planeId = p.loadURDF("plane.urdf", [0,0,-2],planeOrn) boxId = p.loadURDF("cube.urdf", [0,3,2],useMaximalCoordinates = True) -ballId = p.loadSoftBody("ball.vtk", basePosition = [0,0,-1], scale = 0.5, mass = 0.1, useNeoHookean = 1, NeoHookeanMu = 20, NeoHookeanLambda = 20, NeoHookeanDamping = 0.001, useSelfCollision = 1, frictionCoeff = .5, collisionMargin = 0.006) +ballId = p.loadSoftBody("ball.vtk", basePosition = [0,0,-1], scale = 0.5, mass = 4, useNeoHookean = 1, NeoHookeanMu = 400, NeoHookeanLambda = 600, NeoHookeanDamping = 0.001, useSelfCollision = 1, frictionCoeff = .5, collisionMargin = 0.001) p.setTimeStep(0.001) p.setPhysicsEngineParameter(sparseSdfVoxelSize=0.25) p.setRealTimeSimulation(1) diff --git a/examples/pybullet/examples/deformable_torus.py b/examples/pybullet/examples/deformable_torus.py index 0408e8e90..fe64ae648 100644 --- a/examples/pybullet/examples/deformable_torus.py +++ b/examples/pybullet/examples/deformable_torus.py @@ -14,7 +14,7 @@ planeId = p.loadURDF("plane.urdf", [0,0,-2]) boxId = p.loadURDF("cube.urdf", [0,3,2],useMaximalCoordinates = True) -bunnyId = p.loadSoftBody("torus.vtk", mass = 1, useNeoHookean = 1, NeoHookeanMu = 60, NeoHookeanLambda = 200, NeoHookeanDamping = 0.01, collisionMargin = 0.006, useSelfCollision = 1, frictionCoeff = 0.5, repulsionStiffness = 800) +bunnyId = p.loadSoftBody("torus.vtk", mass = 3, useNeoHookean = 1, NeoHookeanMu = 180, NeoHookeanLambda = 600, NeoHookeanDamping = 0.01, collisionMargin = 0.006, useSelfCollision = 1, frictionCoeff = 0.5, repulsionStiffness = 800) bunny2 = p.loadURDF("torus_deform.urdf", [0,1,0], flags=p.URDF_USE_SELF_COLLISION) diff --git a/src/BulletSoftBody/btDeformableBackwardEulerObjective.cpp b/src/BulletSoftBody/btDeformableBackwardEulerObjective.cpp index e3b8a462b..0c3e0b5eb 100644 --- a/src/BulletSoftBody/btDeformableBackwardEulerObjective.cpp +++ b/src/BulletSoftBody/btDeformableBackwardEulerObjective.cpp @@ -86,7 +86,8 @@ void btDeformableBackwardEulerObjective::multiply(const TVStack& x, TVStack& b) { // add damping matrix m_lf[i]->addScaledDampingForceDifferential(-m_dt, x, b); - if (m_implicit) + // Always integrate picking force implicitly for stability. + if (m_implicit || m_lf[i]->getForceType() == BT_MOUSE_PICKING_FORCE) { m_lf[i]->addScaledElasticForceDifferential(-m_dt * m_dt, x, b); } @@ -176,7 +177,8 @@ void btDeformableBackwardEulerObjective::computeResidual(btScalar dt, TVStack& r // add implicit force for (int i = 0; i < m_lf.size(); ++i) { - if (m_implicit) + // Always integrate picking force implicitly for stability. + if (m_implicit || m_lf[i]->getForceType() == BT_MOUSE_PICKING_FORCE) { m_lf[i]->addScaledForces(dt, residual); } |