Commit Graph

300 Commits

Author SHA1 Message Date
Tigran Gasparian
740d2b9783 Adds a request body info command for the physics direct command. This is
useful to incrementally sync the body state in the physics clients of
plugins (e.g. in response to a Body Added notification).
2021-10-26 18:31:33 +02:00
Erwin Coumans
87605ca4c8 revert linkNames in createMultiBody, we cannot pass pointers pointing to local memory (storing the string) around into shared memory or over the network. 2021-09-20 12:22:30 -07:00
Erwin Coumans
b6df08b553 implement resetMeshData for deformable bodies, this allows better reset for reinforcement learning algorithms. 2021-09-02 17:27:05 -07:00
erwin coumans
e952ac6f63 Add pybullet.configureDebugVisualizer(rgbBackground=[red,green,blue]) (each component a float in the range [0,1])
This is an alternative to passing options="--background_color_red=red --background_color_green=green --background_color_blue=blue" in the connect method.
2021-05-06 18:08:22 -07:00
Erwin Coumans
c915e82d49 Merge branch 'master' of github.com:erwincoumans/bullet3 2021-04-22 16:20:31 -07:00
erwin coumans
e58e5bdf95 PyBullet:
expose pybullet.changeDynamics(sleepThreshold), default 0.05, for both useMaximalCoordinates=False and True
When the dot(vel,vel) < sleepThreshold for longer than 2 seconds (this timeout is hard coded) objects that have the ACTIVATION_STATE_ENABLE_SLEEPING enabled with be deactivated
Example:
p.changeDynamics(ob, -1, activationState=p.ACTIVATION_STATE_ENABLE_SLEEPING, sleepThreshold=0.05)
2021-04-20 11:29:27 -07:00
erwin coumans
84a63cf221 allow to use the useMultiBody argument for loadMJCF command
note that for dynamic and static objects (without joints) it is best to set useMultiBody=False
2021-04-19 20:37:26 -07:00
Erwin Coumans
973d8c128f Merge branch 'master' of github.com:erwincoumans/bullet3 2021-04-07 22:13:18 -07:00
erwin coumans
8b8c1af6a4 Cleaned-up/fixed version of this Pull Request #3239, thanks to Wenlong Lu 2021-04-05 11:40:45 -07:00
Erwin Coumans
58d47935a3 Merge remote-tracking branch 'bp/master' 2021-03-26 11:53:37 -07:00
erwin coumans
d1c4c41b9a add performCollisionDetection (stepSimulation also calls this, but does more, including solving constraints and integration) 2021-03-26 10:31:13 -07:00
yycho0108
c0d9553d65 add link names args to CreateMultibody 2021-01-20 15:53:24 +09:00
WenlongLu
21836afb97 Add share memory commands for user to change object dynamic types 2020-11-11 22:41:33 -08:00
Erwin Coumans
954ceff2ec Add an option for a plugin to report return data after calling executePluginCommand. Also add python binding.
Currently the return data has to fit in shared memory, 8MB (Linux, Windows) or 1MB (Apple)
Preparation for streaming is added (to allow unlimited return data, see CMD_CUSTOM_COMMAND_STREAM_RETURN_DATA)

New C-API: b3GetStatusPluginCommandReturnData
PyBullet reports return data if available, in pybullet_executePluginCommand

For the plugin developer:
plugin can provide additional return data for executePluginCommand in the b3PluginContext, during executePluginCommand.
Lifetime of this m_returnData pointer is minimum of next call to the next executePluginCommand or plugin termination.
2020-10-06 20:19:39 -07:00
Erwin Coumans
1452cae641 * add textured models of ball.vtk (obj/mtl) and torus (obj/mtl) and cloth.
1) allow to render deformables in 'getCameraImage', for TinyRenderer (tested OK) and EGL (untested)
2) allow to have textures for deformables. See deformable_ball.py, deformable_anchor.py and deformable_torus.py for examples
3) deformables: allow to request simulation mesh data (even if there is a render mesh) See deformable_anchor.py for an example usage
   data = p.getMeshData(clothId, -1, flags=p.MESH_DATA_SIMULATION_MESH)
4) fix deletion of deformables, thanks to Fychuyan, https://github.com/bulletphysics/bullet3/pull/3048
5) allow to enable and disable double-sided rendering, p.changeVisualShape(objectUid, linkIndex, flags=p.VISUAL_SHAPE_DOUBLE_SIDED)
6) fix GripperGraspExample, model not found
7) Fix deformable anchor not attaching to multibody with object unique id of 0
8) Fix issue with assignment of unique ids in TinyRenderer/EGL renderer (always use broadphase uid)
9) Avoid crash/issue of simulation with pinned vertices (mass 0) in btDeformableBackwardEulerObjective::applyExplicitForce
10) Store uv/normal in btSoftBody::RenderNode to allow textured meshes
11) (uncomment in btSoftBodyHelpers.cpp): dump vertices and indices in obj wavefront format, when loading a VTK file, for quicker creation of a (textured) surface mesh
12) allow interpolateRenderMesh also for old position-based soft bodies (not only the shiny new FEM deformables)
13) fix a few premake targets
14) update build_visual_studio_vr_pybullet_double_cmake.bat so it suits c:\python37 and installs locally
    for local install of Bullet, see also this example https://github.com/erwincoumans/hello_bullet_cmake
2020-09-12 01:03:04 -07:00
Erwin Coumans
ccdec68b1d expose shadowmap intensity to PyBullet API 2020-09-07 16:52:14 -07:00
Erwin Coumans
c517c434e6 pybullet allow to enable/change joint limits:
pybullet.changeDynamicsInfo(objectUniqueId, linkIndex, jointLowerLimit=..., jointUpperLimit=...) # jointLowerLimit <= jointUpperLimit

and joint limit max force:
pybullet.changeDynamicsInfo(objectUniqueId, linkIndex, jointLimitForce=...)

For example:
p.changeDynamics(sphereUid,linkIndex, jointLowerLimit=1, jointUpperLimit=3, jointLimitForce=10.5)

add b3ChangeDynamicsInfoSetJointLimit/b3ChangeDynamicsInfoSetJointLimitForce
add getConstraintType for btMultiBodyConstraint
2020-07-07 19:42:23 -07:00
erwincoumans
5233b72160
Merge pull request #2800 from xhan0619/splitImpulseMulti
Stability improvements for deformable.
2020-05-21 09:47:33 -07:00
Erwin Coumans
754dbd5fda add pybullet.unsupportedChangeScaling feature for some small experiments, this is not general and has many limitations that are not likely are going to be resolved,
so unless it does what you want, ignore this api, it is unsupported!
2020-05-17 13:46:11 -07:00
Xuchen Han
ce237ec7ec fix API for different damping modes for mass spring 2020-05-11 17:08:33 -07:00
Xuchen Han
644fd5f311 add API for two different damping modes for mass spring 2020-05-11 16:42:17 -07:00
Erwin Coumans
53b65b795f add fractionEpsilon to filter rays with similar hit fraction
remove debug printf
2020-05-09 02:42:47 -07:00
Erwin Coumans
f0cccf0faa add collisionFilterMask to rayTestBatch and rayTest
This will allow to exclude (filter) certain bodies.
By default, static bodies have collision group 2, and dynamic (mass=1) bodies have collision group 1.
As long as mask & group != 0, a raytest will be performed.
2020-05-08 11:57:25 -07:00
Erwin Coumans
daa0a27403 add reportHitNumber to allow reporting a specific ray intersection hit
(by default, pybullet.rayTestBatch reports the closest hit, so you can report 2nd closest or 3rd closest hit etc)
Fix pybullet.createCollisionShape, in some cases (concave trimesh, convex mesh) two instances were created.
2020-05-07 23:23:24 -07:00
Xuchen Han
5f1260199a set appropriate repulsion stiffness for pybullet torus demo 2020-04-27 20:05:16 -07:00
Xuchen Han
ae3526254d add API for setting repulsion stiffness 2020-04-27 17:42:45 -07:00
Erwin Coumans
1640eef937 pybullet: enable getMeshData for multibody/rigid body (and filter on collisionShapeIndex for compound shapes) 2020-03-17 00:38:12 -07:00
Erwin Coumans
27fbbfee7f pybullet removeAllParameters (sliders, buttons)
pybullet addUserDebugParameter adds button instead of slider, if min > max.
2020-03-16 21:29:30 -07:00
Erwin Coumans
f0528db5e9 embed V-HACD directly into Pybullet to make it easier to use:
pip3 install pybulle
import pybullet as p
p.connect(p.DIRECT)
p.vhacd("teddy.obj", "teddy_large_newout.obj", "newlog.txt", depth=2,resolution=1000000)
2020-03-16 00:38:52 -07:00
Xuchen Han
4f36e09747 Motor->NonContactInner 2020-03-02 16:00:40 -08:00
Xuchen Han
7ad19fde6f formatting 2020-02-26 14:16:51 -08:00
Xuchen Han
84117b8440 separate motor constraint iterations and expose API 2020-02-26 14:11:41 -08:00
Erwin Coumans
6afa0a463d 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.)
2020-02-14 17:36:40 -08:00
Tigran Gasparian
34db76d263 Adds an option to syncUserData to specify the bodies for which to sync. 2020-01-23 14:46:33 +01:00
erwincoumans
44f21e462a
Merge pull request #2509 from xhan0619/separate-bending-stiffness
Separate in-plane and bending stiffness for mass spring model
2019-12-04 07:34:28 -08:00
Xuchen Han
7bce5d61f4 separate in-plane and bending stiffness for mass spring model for easier parameter tuning 2019-11-27 11:40:10 -08:00
Erwin Coumans
d9ab536682 Merge branch 'master' of https://github.com/erwincoumans/bullet3 2019-11-21 19:37:11 -08:00
Erwin Coumans
824fd6410f Use -> Set in API 2019-11-21 19:07:11 -08:00
Xuchen Han
00add5490f fix separate render and sim mesh 2019-11-19 23:10:08 -08:00
Xuchen Han
64e5e007e3 load render mesh from command 2019-11-19 21:07:26 -08:00
Erwin Coumans
96deb42aa5 pybullet.createSoftBodyAnchor 2019-11-19 19:20:08 -08:00
Erwin Coumans
1f6d504e44 fix memory issues in btSparseSDF.h
(hash function on structure with uninitialized padding, and  Reset not called in destructor)
expose sparseSdfVoxelSize in PyBullet.setPhysicsEngineParameter
don't call deformable wireframe drawing in the wrong thread/place (it can cause crashes)
2019-11-18 10:22:56 -08:00
Xuchen Han
a86710c5b6 add python binding to allow loading deformable objects 2019-11-15 21:25:11 -08:00
Erwin Coumans
72e0e7c223 fix load_soft_body.py example.
add optional flags in pybullet.resetSimulation.
fix compile issue due to SKIP_DEFORMABLE_WORLD
fix issue in .obj importer (todo: replace with tiny_obj_loader)
todo: replace std::ifstream fs; by fileIO usage.
2019-11-14 21:20:42 -08:00
Chuyuan Fu
913400eba1 add SOLVER_USE_ARTICULATED_WARMSTARTING option and APIs
fix compile
2019-10-23 21:36:26 -07:00
Xuchen Han
0cb7cb2445 bool->int 2019-10-15 13:47:55 -07:00
Xuchen Han
e13578fee3 add option to turn self-collision on/off 2019-10-15 13:47:55 -07:00
Xuchen Han
d0e4bbf04d fix gravity set up 2019-10-15 13:47:54 -07:00
Xuchen Han
ec91a0ffa4 configure damping coefficients for neohookean models 2019-10-15 13:47:54 -07:00
Xuchen Han
3dcfcda19a typo fix 2019-09-28 14:44:41 -07:00