Commit Graph

1428 Commits

Author SHA1 Message Date
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
erwincoumans
93be7e6440
Merge pull request #3311 from erwincoumans/master
allow to compile pybullet using btDiscreteDynamicsWorld (no btMultiBody, no btSoftBody, no btDeformableBody)
2021-03-26 10:29:04 -07:00
erwin coumans
0196edd4d2 update single aabb, during resetJointState/resetBasePositionAndOrientation, to allow raycast/collision queries. 2021-03-26 09:11:59 -07:00
erwin coumans
6f7d458679 add missing line in previous commit 2021-03-16 18:17:23 -07:00
erwincoumans
395e17c7bf
Merge pull request #3238 from yycho0108/add-link-names-to-createmultibody
Add linkNames argument to CreateMultibody
2021-03-15 22:48:33 -07:00
erwin coumans
5cf8ee3360 Allow to compile pybullet using btDiscreteDynamicsWorld (no multibodies and no deformables), this allows to create Jacobian and Mass matrix (and A=J*M-1*J_transpose) with MLCP solvers
Add examples/pybullet/gym/pybullet_utils/readwriteurdf.py, this allows to read a URDF and write the URDF with more reasonable inertia tensors (based on mass and collision volumes)
2021-03-15 22:44:55 -07:00
erwincoumans
537ccb2200
Merge pull request #3237 from glebm/fix-pthread
CMake: Use Threads instead of pthread directly
2021-01-23 10:26:58 -08:00
Gleb Mazovetskiy
d248271e38 CMake: Also link Threads correctly in examples/ 2021-01-20 18:20:43 +00:00
yycho0108
6f65a12b3a no nullptr 2021-01-20 16:45:23 +09:00
yycho0108
c0d9553d65 add link names args to CreateMultibody 2021-01-20 15:53:24 +09:00
Erwin Coumans
375d7097e4 don't postpone release for remote visualizer (otherwise it blocks forever) 2020-12-23 10:42:25 -08:00
Erwin Coumans
6d1dae286b GraphicsServerExample, disallow COV_ENABLE_SINGLE_STEP_RENDERING 2020-12-22 17:10:51 -08:00
Erwin Coumans
c97f09cf66 Merge branch 'master' of github.com:erwincoumans/bullet3 into master 2020-12-15 16:24:36 -08:00
Erwin Coumans
93575a2e38 fix changeDynamics for to set lower/upper joint limits and joint limit max force 2020-12-15 16:24:24 -08:00
Erwin Coumans
3e16c616d5 cmake OPTION(USE_OPENVR OFF) so only compile OpenVR VR examples when explicitly set to ON
to avoid breaking builds
2020-12-04 08:52:28 -08:00
erwincoumans
272c7099d3
Merge pull request #3090 from ErikGartner/master
Revert 32277c
2020-11-25 09:25:46 -08:00
erwincoumans
875a6a4446
Merge pull request #3153 from WenlongLu/kinematic_multibody_interface
SharedMemory interface to set and get dynamic types
2020-11-18 11:05:03 -08:00
erwincoumans
464bbc4ddd
Merge pull request #3089 from Steven89Liu/fixDOF
we should use the m_jointMotorForceMultiDof which is indexed by degree
2020-11-13 10:06:52 -08:00
WenlongLu
21836afb97 Add share memory commands for user to change object dynamic types 2020-11-11 22:41:33 -08:00
erwincoumans
da28ca734a
Update b3PluginManager.cpp 2020-11-03 09:47:38 -08:00
erwincoumans
edbce66542
Update b3PluginManager.cpp 2020-10-29 17:06:18 -07:00
Erwin Coumans
e21c6c9f46 fix compile issues 2020-10-28 19:18:33 -07:00
Erwin Coumans
49be2cffaa improvement in b3PluginManager, hashing the postfix if available
(allows to load a plugin in the current executable instead of from disk)
2020-10-28 11:06:26 -07:00
erwincoumans
fea468d241
Update RBDModel.h
destructor needs to be virtual
2020-10-08 14:10:08 -07:00
Erwin Coumans
ad0994022d allow streaming of data 2020-10-07 10:12:02 -07:00
Erwin Coumans
bc51ac3f0f Support getCachedReturnData for PhysicsLoopBack
re-use existing code path for streaming plugin return data (work-in-progress)
2020-10-07 08:24:33 -07: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
6b91ecc0c5 allow to set changeDynamics(body, link, contactProcessingThreshold) for multibodies
(set to 0 if restitution is important)
2020-10-05 16:33:41 -07:00
Erik Gärtner
777ab5a5ab Revert "in case of substeps use the compensated delta time / numSubSteps to convert between force and impulse."
This reverts commit 32277c7bd5.
2020-10-02 15:49:23 +02:00
Steven89Liu
104789ca99 we should use the m_jointMotorForceMultiDof which is indexed by degree
of freedom.
2020-10-01 15:58:45 +08:00
Erwin Coumans
d0dc96aa05 Merge remote-tracking branch 'bp/master' 2020-09-20 16:36:45 -07:00
Erwin Coumans
1bd82e7d81 allow rendering of (textured) heightfield in TinyRenderer and EGL.
Also update normals, if heightfield is updated.
2020-09-20 16:03:56 -07:00
erwincoumans
7f4fdb16b3
Merge pull request #3061 from fuchuyuan/addAttributes
add configurable parameters to urdf
2020-09-18 16:59:43 -07:00
Erwin Coumans
4f8f28233c allow alternative deformable indexing (internal use/testing) 2020-09-17 03:15:44 -07:00
Chuyuan Fu
7d8379bad4 add configurable parameters to urdf 2020-09-14 12:34:21 -07:00
Erwin Coumans
e9f486eebb narrow from double to float please 2020-09-13 18:32:52 -07:00
Erwin Coumans
0c2a54193c fixes in cached textures (pointer re-use) 2020-09-13 16:49:13 -07:00
Erwin Coumans
f9a96442d1 disable texture caching in some place, due to pointer re-use issue 2020-09-13 16:24:42 -07:00
Erwin Coumans
f8288e029e fix color for deformables, if texture is not specified 2020-09-13 16:07:42 -07:00
Erwin Coumans
9ae41971bc re-enable pybullet.getVisualShapeData for deformables
(was broken in previous commit)
2020-09-13 15:08:42 -07:00
Erwin Coumans
bd1bd36bc6 allow to change texture for deformables 2020-09-12 20:12:46 -07:00
Erwin Coumans
c58a54174e allow to set color of deformables for debug visualizer
don't render deformables for TinyRenderer/EGL if p.configureDebugVisualizer(p.COV_ENABLE_TINY_RENDERER,0)
Fix segmentation mask in tinyrenderer for deformables
2020-09-12 19:41:10 -07:00
Erwin Coumans
e00691e132 more deformable rendering fixes, egl and tinyrenderer 2020-09-12 18:15:51 -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
448dd1a244 Synchronize 'resetDebugVisualizeCamera' using GUI critical section instead of waiting for the render thread, to avoid slow-down
Fixes issue https://github.com/bulletphysics/bullet3/issues/3045
2020-09-09 09:45:38 -07:00
Erwin Coumans
ccdec68b1d expose shadowmap intensity to PyBullet API 2020-09-07 16:52:14 -07:00
Steven
8a16ed5009 fix the issue "Inconsistency between rayTest and rayTestBatch of pybullet #2887"
we should initialize these variables otherwise these will be random.
2020-09-03 20:30:14 +08:00
Erwin Coumans
f9abae073b PyBullet: fix cases where contact point objects are swapped, reported here
https://github.com/bulletphysics/bullet3/issues/3023
Thanks to ichumuh for the report and reproduction!
2020-09-01 09:27:05 -07:00
Erwin Coumans
55451b6bfc Merge remote-tracking branch 'bp/master' 2020-08-20 17:16:07 -07:00
Erwin Coumans
9888e7b5a5 reset camera in the rendering thread to avoid artifacts 2020-08-20 09:08:37 -07:00
Erwin Coumans
bbb66370c6 reset camera in the rendering thread to avoid artifacts 2020-08-20 08:35:24 -07:00
erwincoumans
2c9a55da54
Update PhysicsServerCommandProcessor.cpp
fix potential crash, if user doesn't provide valid body unique id in pybullet.setCollisionFilterGroupMask
2020-08-14 16:59:56 -07:00
Erwin Coumans
8504384b63 Merge branch 'master' of github.com:erwincoumans/bullet3 2020-08-13 16:41:33 -07:00
Erwin Coumans
306245d68b fix potential memory leak in createMultiBody, reported by Fei Xia here (thanks for report/repro!)
https://github.com/bulletphysics/bullet3/issues/2898
2020-08-13 16:40:37 -07:00
erwincoumans
e52a30de68
Update TinyRendererVisualShapeConverter.cpp
only create a texture for a plane, not sphere (backward compatibility tests break)
2020-08-12 10:12:45 -07:00
Erwin Coumans
ff229baf1e TinyRenderer: support plane shape (creating similar textured plane to OpenGL renderer)
TinyRenderer: perform clipping in double precision to improve accuracy
2020-08-10 20:19:00 -07:00
Erwin Coumans
7d9bcafda8 when using stablePDPlugin, approximate inertia by box for unsupported shapes. 2020-08-10 17:00:19 -07:00
Erwin Coumans
d12d886e13 raycast filter masks can be negative, always apply the mask (-1 default). Thanks to Tingnan for reporting/reproduction case. 2020-08-03 11:00:14 -07:00
Erwin Coumans
1e8f39b492 improve premake4 build in case X11 headers are missing
improve video_sync_mp4.py example
allow to create a heightfield from file or programmatically in C++ robotics api. Example:

{
		b3RobotSimulatorCreateCollisionShapeArgs shapeArgs;
		shapeArgs.m_shapeType = GEOM_HEIGHTFIELD;
		bool useFile = true;
		if (useFile)
		{
			shapeArgs.m_fileName = "D:/dev/bullet3/data/heightmaps/gimp_overlay_out.png";
			shapeArgs.m_meshScale.setValue(.05, .05, 1);
		}
		else
		{
			shapeArgs.m_numHeightfieldColumns = 256;
			shapeArgs.m_numHeightfieldRows = 256;
			shapeArgs.m_meshScale.setValue(.05, .05, 1);
			shapeArgs.m_heightfieldData.resize(shapeArgs.m_numHeightfieldRows * shapeArgs.m_numHeightfieldColumns);
			double heightPerturbationRange = 0.05;
			for (int j = 0; j<int(shapeArgs.m_numHeightfieldColumns / 2); j++)
			{
				for (int i = 0; i < (int(shapeArgs.m_numHeightfieldRows / 2)); i++)
				{
					double height = ((double)rand() / (RAND_MAX)) * heightPerturbationRange;
					shapeArgs.m_heightfieldData[2 * i + 2 * j * shapeArgs.m_numHeightfieldRows] = height;
					shapeArgs.m_heightfieldData[2 * i + 1 + 2 * j * shapeArgs.m_numHeightfieldRows] = height;
					shapeArgs.m_heightfieldData[2 * i + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height;
					shapeArgs.m_heightfieldData[2 * i + 1 + (2 * j + 1) * shapeArgs.m_numHeightfieldRows] = height;
				}
			}
		}
		int shape = sim->createCollisionShape(shapeArgs.m_shapeType, shapeArgs);
		b3RobotSimulatorCreateMultiBodyArgs bodyArgs;
		bodyArgs.m_baseCollisionShapeIndex = shape;
		int groundId = sim->createMultiBody(bodyArgs);
		int texId = sim->loadTexture(shapeArgs.m_fileName);
		b3RobotSimulatorChangeVisualShapeArgs args;
		args.m_objectUniqueId = groundId;
		args.m_linkIndex = -1;
		args.m_textureUniqueId = texId;
		sim->changeVisualShape(args);
	}
2020-07-24 18:09:13 -07:00
Erwin Coumans
1de2269b6e add removeState in C++ API, see also Issue https://github.com/bulletphysics/bullet3/issues/2935 2020-07-17 15:04:54 -07:00
Erwin Coumans
caa8b26ce5 Fixes in TinyAudio, play sound on collision impact, can be configured in URDF/SDF file.
Requires a modified setup.py (or use premake4 to compile)

Example script:
import pybullet as p
import time
p.connect(p.GUI)
plane = p.loadURDF("plane_with_collision_audio.urdf")
box = p.loadURDF("cube.urdf",[0,0,1])
p.setGravity(0,0,-10)
while (1):
  p.stepSimulation()
  time.sleep(1./240.)
2020-07-13 14:07:58 -07:00
Erwin Coumans
d88d0e92ef also update m_jointLowerLimit/m_jointUpperLimit in multibody link. 2020-07-07 19:49:29 -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
Erwin Coumans
9de78ab6b3 fix array size in inverse kinematics orientation command
bump up shared memory version, since this was a potentially incompatible change
2020-07-06 22:57:03 -07:00
Erwin Coumans
4c63a5019e fix removeConstraint for deformables, thanks to Daniel Seita for reporting the issue. 2020-06-30 16:39:15 -07:00
erwincoumans
036e51c637
Merge pull request #2870 from erwincoumans/master
Fix applyExternalForce command for multibody links. Thanks to Avik fo…
2020-06-18 20:52:47 -07:00
Erwin Coumans
ebef331bbf Fix applyExternalForce command for multibody links. Thanks to Avik for the report. 2020-06-19 03:37:30 -07:00
erwincoumans
01bfdc643c
Merge pull request #2858 from CGJiaxiLiu/fix_softbody
Fix potential undefined softbody member in PhysicsServerCommandProcessor
2020-06-18 20:45:59 -07:00
Xuchen Han
f23e745666 clang format PhysicsServerCommandProcessor and BulletSoftBody 2020-06-17 17:20:39 -07:00
Erwin Coumans
4786ca1df2 Merge remote-tracking branch 'bp/master' 2020-06-16 16:20:17 -07:00
Erwin Coumans
a7b8b54c44 implement mouse picking for deformable objects in PyBullet (the one using p.resetSimulation(p.RESET_USE_DEFORMABLE_WORLD), not position based dynamics version) 2020-06-16 11:54:50 -07:00
Jiaxi
daaea3a4fb Fix potentially send data to invalid port 2020-06-14 21:57:43 -04:00
Jiaxi
f034e64cc6 Check for availability of soft body 2020-06-14 21:42:32 -04:00
Jiaxi
a848c1d6e9 Check for availability of soft body 2020-06-14 21:26:54 -04:00
erwincoumans
da50438c3c
Merge pull request #2826 from xhan0619/grav-factor
Deformable gravity factor
2020-06-05 10:07:27 -07:00
Erwin Coumans
a2cdadb9b4 add check to avoid crash, if link is out of bounds. 2020-06-04 00:24:51 -07:00
Erwin Coumans
e82a4ecc6d Apply patch to apply force at softbody nodes, thanks to Robert Lee, see
https://github.com/bulletphysics/bullet3/issues/2699#issuecomment-610734583
2020-06-04 00:09:11 -07:00
Erwin Coumans
c09007e005 Merge branch 'master' of github.com:erwincoumans/bullet3 2020-06-04 00:00:44 -07:00
Erwin Coumans
e6a0206d47 Allow to remove soft body anchors, using pybullet.removeConstraint (untested).
Usage example:
anchors = []
anchors.append(p.createSoftBodyAnchor(clothId  ,0,-1,-1))
anchors.append(p.createSoftBodyAnchor(clothId ,3,boxId,-1, [0.5,-0.5,0]))
for a in anchors:
  p.removeConstraint(a)
2020-06-04 00:00:19 -07:00
Xuchen Han
8c0192d639 turn on deformable rigid face contact 2020-05-26 16:52:40 -07:00
Xuchen Han
8a189763df support configuring gravity factor from client 2020-05-26 16:51:45 -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
7d61b3514c use memcpy instead of manual copy, alignment issue? 2020-05-20 07:19:26 -07:00
Erwin Coumans
32277c7bd5 in case of substeps use the compensated delta time / numSubSteps to convert between force and impulse. 2020-05-19 11:00:53 -07:00
erwincoumans
d4c7687b29
Merge pull request #2809 from erwincoumans/master
add pybullet.unsupportedChangeScaling feature for some small experime…
2020-05-17 19:22:40 -07:00
Erwin Coumans
3f0b8c938b fix for https://github.com/bulletphysics/bullet3/pull/2797 2020-05-17 14:09:42 -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
f07042723c bug fix in damping mode 2020-05-11 17:40:00 -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
Tigran Gasparian
faa708db49 Fixes bug where user data defined in a URDF link wasn't being applied on
the correct link.
2020-05-11 19:27:04 +02: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
8f380b3fd2 use white as default undefined color instead of the googley colors.
use loadURDF(..., flags = pybullet.URDF_GOOGLEY_UNDEFINED_COLORS) to get Googley colors when colors are undefined.
2020-05-08 10:44:39 -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
Erwin Coumans
d479ca712c allow to call getDebugVisualizerCamera in DIRECT mode (returns all 0) 2020-05-05 03:15:26 +00:00
Erwin Coumans
8719ac6c95 soft body is not enabled in the test 2020-05-05 02:46:19 +00:00
erwincoumans
ca50714996
Merge pull request #2775 from xhan0619/splitImpulse
Split impulse
2020-04-29 20:00:00 -07:00
Xuchen Han
eefec255cf Merge remote-tracking branch 'origin/master' into splitImpulse 2020-04-27 20:29:06 -07:00