Commit Graph

336 Commits

Author SHA1 Message Date
erwincoumans
ae8e83988b Add preliminary PhysX 4.0 backend for PyBullet
Add inverse dynamics / mass matrix code from DeepMimic, thanks to Xue Bin (Jason) Peng
Add example how to use stable PD control for humanoid with spherical joints (see humanoidMotionCapture.py)
Fix related to TinyRenderer object transforms not updating when using collision filtering
2019-01-22 21:08:37 -08:00
erwincoumans
fb2baa81d6 only use the mutex if using BT_THREADSAFE 2018-12-22 11:35:56 -08:00
Erwin Coumans
e3c03401c8 PyBullet: fixed a few more file leaks 2018-12-04 19:58:24 +01:00
Erwin Coumans
d4db50f668 PyBullet: fix some file leaks. 2018-12-04 19:37:25 +01:00
erwincoumans
69321a9ee6 allow textured cube/sphere from URDF 'box' and 'sphere' visual primitive, when using
texUid = p.loadTexture("tex256.png")
p.changeVisualShape(cube ,-1, textureUniqueId = texUid)
See also https://github.com/bulletphysics/bullet3/issues/2012
2018-11-29 15:41:32 -08:00
erwincoumans
17219f84c6 make setJointPosMultiDof and setJointVelMultiDof argument const.
add PyBullet.resetJointStateMultiDof / getJointStateMultiDof, for preliminary support for spherical and planar joints
2018-11-10 14:26:31 -08:00
erwincoumans
642c6a71d2 fix 2 potential data race conditions. 2018-11-08 14:41:22 -08:00
Erwin Coumans
8e82de1b00 add rudimentary MuJoCo mjcf xml to ROS URDF file, based on
pybullet_utils.urdfEditor
2018-10-31 11:02:19 -07:00
erwincoumans
078887c4d7 PyBullet fileIOPlugin: don't add equal fileIO interface twice (based on identical fileIOType and pathPrefix)
loadBullet goes through fileIOPlugin
2018-10-29 10:25:40 -07:00
erwincoumans
a44df2b0a6 PyBullet: allow to pass vertices (for convex) and vertices+indices (for concave) to createCollisionShape
See createObstacleCourse.py for an example use. At the moment a limit of 1024 vertices and 1024 indices.
Will be lifted once we implement the streaming version (soon).
2018-10-26 10:18:51 -07:00
erwincoumans
707bac9c3d fix sphere sdf parsing 2018-10-22 16:01:58 -07:00
erwincoumans
b5e475aec3 enable planar reflection in MinitaurGymEnv
enable follow cam in other Gym locomotion environments
add testing assets for multi-material obj files -> sdf conversion.
Also use ER_NO_SEGMENTATION_MASK flag for TinyRenderer/EGL plugin renderer
2018-10-14 15:10:19 -07:00
erwincoumans
c1e20c448f Implement InMemoryFile for memory caching for fileIO plugin.
Support SDF loading through fileIO plugin.
Replace strcspn by C code (not crossplatform)
Add flag for loadURDF to use color from MTL file (instead from URDF link material)
pybullet.URDF_USE_MATERIAL_COLORS_FROM_MTL and pybullet.URDF_USE_MATERIAL_TRANSPARANCY_FROM_MTL
2018-10-14 12:54:34 -07:00
erwincoumans
a24c1436af state 2 of FileIO plugin: adding/removing FileIO types, search through all registered FileIO types.
(not enabled by default yet)
Example:
fileIO = p.loadPlugin("fileIOPlugin")
print("fileIO=",fileIO)
p.executePluginCommand(fileIO,"e:/develop/bullet3/data/plane.zip", [p.AddFileIOAction,p.ZipFileIO])
p.executePluginCommand(fileIO,"e:/develop/bullet3/data/test2.zip", [p.AddFileIOAction,p.ZipFileIO])
planeId = p.loadURDF("plane.urdf")
duckId = p.loadURDF("duck_vhacd.urdf",[0,0,1])
2018-10-11 14:39:31 -07:00
erwincoumans
f792a5951a move zipfFileIO into own header
route loadTextureFile from fileIO plugin
fix B3_ENABLE_FILEIO_PLUGIN logic
2018-10-11 10:58:14 -07:00
Erwin Coumans
32b5c88d4b close the fileIO for urdf loading 2018-10-09 20:45:17 -07:00
Erwin Coumans
5f954e2496 backward compatibility fix 2018-10-09 16:25:32 -07:00
erwincoumans
dba239fe8d First pass of load files through an interface (to allow loading from memory, zip file etc). So instead of posix fopen/fread, using CommonFileIOInterface.
A fileIO plugin can override custom file IO operations. As a small test, load files from a zipfile in memory.
Default fileIO implementation is in examples/Utils/b3BulletDefaultFileIO.h
Affects URDF, SDF, MJCF, Wavefront OBJ, STL, DAE, images.
2018-10-08 21:27:08 -07:00
erwincoumans
2c13e70d1a make projective textures work in DIRECT+eglPlugin (see examples/pybullet/examples/projective_texture.py) 2018-10-05 19:24:44 -07:00
erwincoumans
8aff1fbd49 removed flags from loadURDF command. The flags are already available in m_data->m_flags in BulletUrdfImporter.cpp 2018-10-02 08:39:47 -07:00
mbennice
99dbedab6e Update import 2018-09-27 12:49:39 -07:00
mbennice
7485999254 Clang Format Change 2018-09-27 10:00:39 -07:00
mbennice
30d4c4136a Piping through the flag to parse sensors 2018-09-27 09:49:59 -07:00
mbennice
173cc2538f Correct header update
Revert the header update change.
2018-09-26 16:38:59 -07:00
mbennice
f79b04357f Update URDF Importer to process sensor elements.
Update the URDF Importer to add sensors as 0 mass 0 inertia elements
attached by a fixed joint. This way their states can be read as links.
2018-09-26 16:35:22 -07:00
erwincoumans
ab8f16961e Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
2018-09-23 14:17:31 -07:00
erwincoumans
9553892770 PyBullet / BulletRobotics:
Implement collisionFilterPlugin, use setCollisionFilterPair to enable or disable collision detection between specific pairs of objects.
Also, expose setCollisionFilterGroupMask as PyBullet API and in urdf using the tag <collision group="1" mask="2"/>.
See examples/pybullet/examples/collisionFilter.py for an example.
PyBullet default: Lower the warmstarting factor, for maximal coordinates rigid bodies for more stable simulation.
Add btCollisionWorld::refreshBroadphaseProxy to easier recreate the broadphase proxy without adding/removing objects to the world.
2018-09-12 19:30:49 -07:00
erwincoumans
dc7feb9027 Merge remote-tracking branch 'bp/master' 2018-09-09 10:48:58 -07:00
erwincoumans
233a7083d1
Merge pull request #1790 from BlGene/egl-plugin
OpenGL render plugin
2018-09-09 09:27:15 -07:00
erwincoumans
63f4a63e15 since parent collision is always disabled by default for self-collision, we add a new flag
URDF_USE_SELF_COLLISION_INCLUDE_PARENT, to force self-collision between direct parent/child (not recommended in general)
2018-09-08 14:46:43 -07:00
erwincoumans
5164f2f9a7 remove pre-build proto/grpc files (they differ for each platform and proto/grpc version) 2018-09-07 15:44:33 -07:00
Max Argus
a6a8b091ca wip 2018-08-30 13:24:25 +02:00
Max Argus
f80f0c76a4 added egl plugin commit 2018-08-30 13:24:25 +02:00
Erwin Coumans
ff43cea263 Fix some deactivation issues with btMultiBodyDynamicsWorld, should also improve performance for PyBullet with larger worlds
(even when sleeping is disabled, islands are split)
2018-08-26 16:14:36 -07:00
Erwin Coumans
3036a6d2bc also drop 'model://' from URDF file names (like we drop package://) 2018-08-26 09:33:51 -07:00
erwincoumans
55e185fe39 PyBullet loadURDF in useMaximalCoordinated=True (btRigidBody), support lower/upper limits for revolute joints. 2018-06-22 09:28:07 -07:00
erwincoumans
25c5e87dc2 PyBullet.loadURDF, expose flags=URDF_INITIALIZE_SAT_FEATURES 2018-06-13 15:35:56 -07:00
erwincoumans
97c6937388 Simplify GJK. Still needs double precision for large differences of feature scales.
Extract faces directly from btConvexHullComputer (in initializePolyhedralFeatures), instead of reconstructing them, thanks to Josh Klint in #1654
PyBullet: use initializePolyhedralFeatures for convex hulls and boxes (to allow SAT)
PyBullet: expose setPhysicsEngineParameter(enableSAT=0 or 1) to enable Separating Axis Test based collision detection for convex vs convex/box and convex versus concave triangles (in a triangle mesh).
2018-06-12 16:08:46 -07:00
erwincoumans
62485abafe PyBullet: disable deterministic pairs by default
PyBullet: Only set static when sleeping is enables (todo: figure out issue with determinism)
2018-06-11 17:32:44 -07:00
Erwin Coumans
38469deec7 getNumLinks -> getNumDofs, to make sure fixed objects don't transfer activation state 2018-06-11 11:41:33 -07:00
erwincoumans
b6f5cb4c34 enable pdControlPlugin by default (requires pdControlPlugin.cpp and b3RobotSimulatorClientAPI_NoDirect.cpp)
add pdControl.py example, make pdControlPlugin functional
reduce memory usage
fix examples/pybullet/gym/pybullet_data/random_urdfs/948/948.urdf, fixes issue #1704
2018-06-05 15:59:01 -07:00
erwincoumans
49eb83c24e Avoid static multibody to activate/wake up sleeping objects.
Couldn't reproduce an issue related to this.
2018-06-05 12:20:42 -07:00
erwincoumans
92579f9196 Merge branch 'master' of https://github.com/erwincoumans/bullet3
# Conflicts:
#	examples/SharedMemory/PhysicsServerCommandProcessor.cpp
2018-06-01 09:35:15 -07:00
erwincoumans
8567f6bb7c PyBullet: rename sleepObjectAutoDeactivation -> sleeping.py
PyBullet: allow maximal coordinate rigid bodies to sleep/deactivate
2018-05-30 21:14:35 -07:00
Erwin Coumans
491ecf2a20 export object auto-deactivation (sleeping) to pybullet (needs some more testing/configuring) 2018-05-30 18:37:08 -07:00
Erwin Coumans
8ace9251aa pass by pointer instead of reference to satisy compiler 2018-05-23 14:22:22 +10:00
Erwin Coumans
94da262906 case sensitive header include 2018-05-23 13:51:51 +10:00
Erwin Coumans
77c332bd88 PyBullet: add option to cache graphics shapes for URDF files, handy for benchmarks with many duplicate robots
See https://github.com/erwincoumans/pybullet_robots ANYmal.py for an example.
PyBullet: Expose p.setPhysicsEngineParameter(solverResidualThreshold=1e-2) (b3PhysicsParamSetSolverResidualThreshold), increases solver performance a lot
PyBullet: Expose p.setPhysicsEngineParameter(contactSlop) Set it to zero, to avoid issues with restitution.
PyBullet: Expose isNumpyEnabled, return True is PyBullet was compiled with NUMPY support for 'getCameraImage'.
PyBullet: Expose p.ChangeDynamics(objectUid, linkIndex, contactProcessingThreshold), to avoid issues of speculative/predictive contacts with restitution.
See also http://twvideo01.ubm-us.net/o1/vault/gdc2012/slides/Programming%20Track/Vincent_ROBERT_Track_ADifferentApproach.pdf
2018-05-23 13:26:00 +10:00
Erwin Coumans
f5952a73e7 UrdfImporter: Collada DAE, rudimentary support for polylist (for ANYmal), assumes all polygons have 3 vertices
remove obsolete env from __init__.py
2018-05-23 00:28:49 +10:00
Erwin Coumans
ff646fbef2 workaround for an out-of-date tinyxml2 version 2018-05-17 12:18:17 -07:00
Erwin Coumans
84b20bda80 don't use the URDF inertia element, unless flag CUF_USE_URDF_INERTIA is set, not for the diagonal and also not for the inertial frame shift. 2018-05-03 14:24:16 -07:00
Erwin Coumans
4a8ad1a54e fix posix memory release issues
fix compile problems on Mac OSX
reduce shared memory size on Mac (>512*1024 fails to allocate)
2018-05-02 15:39:16 -07:00
Erwin Coumans
552cb5852a PyBullet: add signed distance field support, with example/signedDistanceField.py
See also data\toys\concave_box.urdf and data\toys\concave_box.cdf

data\toys\concave_box.cdf was generated from concave_box.obj using
//GenerateSDF.exe -r "32 32 32" -d "-1.6 -1.6 -.6 1.6 1.6 .6" concave_box.obj
//SDF is based on code from DiscreGrid, https://github.com/InteractiveComputerGraphics/Discregrid
2018-04-16 22:57:43 +02:00
erwincoumans
dbb0318782 fixes related to tinyxml2 2018-04-12 12:46:43 -07:00
Erwin Coumans
11008d8110 fixes, backwards compatibility 2018-04-12 09:28:30 -07:00
erwincoumans
9c77e07494 upgrade from tinyxml to tinyxml2 2018-04-12 00:09:44 -07:00
erwincoumans
73a4334e30 explicitly remove textures during resetSimulation
move glViewport to Win32Window
2018-02-21 23:22:16 -08:00
erwincoumans
ddf304ca78 PyBullet: expose internal edge utility, to adjust edge normals to prevent object penetrating along triangle edges of concave triangle meshes
(due to local convex-triangle collisions causing opposite contact normals, use the pre-computed edge normal)
PyBullet: expose experimental continuous collision detection for maximal coordinate rigid bodies, to prevent tunneling.
2018-02-16 19:44:33 -08:00
erwincoumans
a92423b6f7 minor clarification in UrdfRenderingInterface 2018-01-21 11:15:35 -08:00
erwincoumans
1661f25fd8 minor indentation fix 2018-01-17 13:11:02 -08:00
erwincoumans
c781e98de4 add a little bit of documentation to the UrdfRenderingInterface 2018-01-17 13:06:44 -08:00
erwincoumans
329a1f5a74 PyBullet: move TinyRenderer into a plugin, default statically loaded. You can also dynamically load a render plugin, as shown in renderPlugin.py example. premake has a way to compile the tinyRendererPlugin. 2018-01-17 12:48:48 -08:00
erwincoumans
df89ce6f92 small refactor of LinkVisualShapesConverter / TinyRendererVisualShapeConverter, it allows to use it in a Python module and in a PyBullet plugin. 2018-01-16 17:58:19 -08:00
erwincoumans
9d405fde67 PyBullet: free cached textures
PyBullet: bool PhysicsServerCommandProcessor::pickBody, disable collision filtering to allow picking of all objects
2018-01-15 08:36:08 -08:00
erwincoumans
e961800278 parse plane geom for URDF files (not just SDF) 2018-01-13 13:41:46 -08:00
Erwin Coumans
79051b7611 allow to use colors from MJCF file as option (default to random Google colors), use p.loadMJCF(filename, flags=p.URDF_MJCF_COLORS_FROM_FILE
fix quadruped.py example.
add PyBullet.isConnected() API, more friendly than PyBullet.getConnectionInfo()["connected"]
2018-01-11 21:04:08 -08:00
erwincoumans
22b4809891 leave m_useGlobalVelocities to false, until enabled, for backward compatibility
use URDF_GLOBAL_VELOCITIES_MB flag in PyBullet loadURDF.
fix robot_bases.py due to new fields in getJointInfo.
backward compabitibility: BulletMJCFImporter, keep creating btMultiSphereShape for MJCF capsules with fromto, instead of shifted btCapsuleShapeZ, unless if CUF_USE_IMPLICIT_CYLINDER is used.
2018-01-10 11:16:50 -08:00
erwincoumans
c4b1b84687 Enable 'global absolute velocities' by default for btMultiBody. See 8.3.2B Proposed resolution Jakub Stepien PhD Thesis
https://drive.google.com/file/d/0Bz3vEa19XOYGNWdZWGpMdUdqVmZ5ZVBOaEh4ZnpNaUxxZFNV/view?usp=sharing
Fixes crashes due to rendering of softbody wireframe in the wrong thread (needs to be in 'debug' rendering section)
Use btCapsuleShapeZ instead of btMultiSphereShape when converting MJCF MuJoCo capsules using fromto
2018-01-09 22:47:56 -08:00
erwincoumans
15a429f1bf premake build system fixes 2018-01-09 12:23:25 -08:00
erwincoumans
e138e85bca allow to enable/disable implicit cylinder conversion through an API
p.loadURDF("r2d2.urdf", flags=p.URDF_USE_IMPLICIT_CYLINDER)
allow to enable/disable deterministicOverlappingPairs through an API
p.setPhysicsEngineParameter(deterministicOverlappingPairs = False)
2018-01-09 10:10:36 -08:00
Erwin Coumans
e97b751781 further work on urdfEditor.py, fix some serialization issues 2018-01-08 12:25:56 -08:00
Erwin Coumans
c59a3763e5 tweak ImportMJCFSetup.cpp example MJCF humanoid a bit, clamp target positions to be within joint limits to avoid solver problems (conflicting constraints)
add humanoid_manual_control.py PyBullet example which is similar to ImportMJCFSetup.cpp
2018-01-04 13:14:11 -08:00
Erwin Coumans
4743d2770a fix recently introduced crashing bug in MJCF reader
due to https://github.com/bulletphysics/bullet3/pull/1484 (Issue 1484)
2018-01-03 21:47:58 -08:00
Erwin Coumans
79d78a325a Start of a urdfEditor.py, limited support to extract a URDF from a PyBullet body.
Use btCylinderShapeZ for URDF cylinder, instead of converting it to a btConvexHullShape.
Implement PyBullet.getCollisionShapeData
Extend PyBullet.getDynamicsInfo / b3GetDynamicsInfo, remove flag (don't rely on API returning a fixed number of elements in a list!)
Extend PyBullet.getJointInfo: add parentIndex
2018-01-03 19:17:28 -08:00
erwincoumans
e3a85493e8
Merge pull request #1484 from rhaps0dy/MJCFImporter
Support for reading <inertial> elements from MJCF
2017-12-29 10:58:08 -08:00
Erwin Coumans
97547eda0d preliminary work towards saveState/restoreState and saveRestoreState.py example (not implemented yet)
allow multiple options in connect, for example: p.connect(p.GUI, options="--width=640, --height=480")
2017-12-28 10:05:51 -08:00
Adrià Garriga
cb2fcfd032 Skipping calculateLocalInertia is unnecessary 2017-12-23 17:56:47 +01:00
Adrià Garriga
4d70d54d19 Support for reading <inertial> elements from MJCF 2017-12-23 08:53:10 +01:00
erwincoumans
eb35cba740 expose local inertia diagonal in C-API, PyBullet, through the 'getDynamicsInfo'
render the inertia boxes in examples/pybullet/examples/quadruped.py and examples/pybullet/examples/reset_dynamic_info.py
fix an issue where the original margin (0.04) was used to compute the inertia, instead of latest margin
2017-12-20 14:54:32 -08:00
erwincoumans
6a9300809d premake4 add option --enable_static_vr_plugin to statically link the VR sync plugin
fix texture caching from previous commit (what happened there?)
2017-10-25 10:00:45 -07:00
erwincoumans
ed8de36ffa pybullet: allow to replace existing text, to avoid flickering (remove/add)
allow texture caching (disable using the disable file caching)
2017-10-25 08:15:01 -07:00
erwincoumans
cec8da3d85 Implement first draft of pybullet.createVisualShape and add createVisualShape.py example
add normals to duck.obj for nicer appearance
fix plane100.urdf (so collision shape matches visual shape size)
2017-10-07 18:50:23 -07:00
Erwin Coumans
26d32f2aa8 improve loading performance of large textures:
option to disable tinyrenderer, use p.configureDebugVisualizer(p.COV_ENABLE_TINY_RENDERER,0)
also make sure to use p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,0) before loadURDF, and enable rendering afterwards using p.configureDebugVisualizer(p.COV_ENABLE_RENDERING,1)
reorder 2 loops, making the flip texels twice as fast (cache coherency),
single memcpy of entire texture in tinyrenderer, instead of per-pixel copy (memory layout is the same)
add lots of B3_PROFILE timings, to see where time is going
2017-10-06 13:46:24 -07:00
erwincoumans
822ff077c7 expose some parameters through pybullet.getPhysicsEngineParameters (C-API: b3InitRequestPhysicsParamCommand + b3GetStatusPhysicsSimulationParameters) 2017-10-05 11:43:14 -07:00
Erwin Coumans
3d3e391b6a Support SDF capsule and cylinder. 2017-09-11 21:49:39 -07:00
Erwin Coumans
cbe0d0aff2 pybullet fix: accidently enable self-collision 2017-09-07 14:27:00 -07:00
Erwin Coumans
9ecd345783 backwards compatibility... 2017-09-07 11:40:11 -07:00
erwincoumans
eb97e06280 fix minitaur.urdf: move lower-leg inertia to center, add missing collision for one of the motors, add contact parameters for friction_anchor, spinning friction, compliance (stiffness/damping)
fix in indexing for maximal coordinates (unused by default, still experimental, requires many iterations for Minitaur due to extreme mass-ratio, hence use of reduces/generalized coordinates)
modify quadruped.py to test maximal coordinates
wrap angular servo (positional) target within [-PI,PI] in btGeneric6DofSpring2Constraint
add 'j' key to show body frames in wireframe/debug mode
2017-09-02 01:05:42 -07:00
erwincoumans
8dfa76e924 implement pybullet.createUserConstraint for maximalCoordinates (fixed, p2p, gear)
maximalCoordinates, make sure parent is bodyA, child is BodyB
2017-08-30 09:54:38 -07:00
erwincoumans
1f7db4519e enable motor control for maximal coordinates robots (btRigidBody, btTypedConstraint) for force, velocity, position control. 2017-08-29 19:14:27 -07:00
Erwin Coumans
5c5993edcb fix potential memory leaks for concave triangle meshes (<concave=true> or createCollisionShape with flags=1) 2017-08-24 09:16:11 -07:00
Erwin Coumans
226aaedc46 bump up pybullet setup.py version, make B3_NO_PYTHON_FRAMEWORK default on Mac
minor fixes (arg name in header/cpp the same)
2017-08-18 08:53:46 -07:00
Erwin Coumans
a66576f034 revert API to be backward compatible, add b3CreateInProcessPhysicsServerAndConnectSharedMemory
same for BulletURDFImporter constructor
2017-08-16 12:33:25 -07:00
Erwin Coumans
99beb44625 fix build issues in previous commit 2017-08-15 10:46:09 -07:00
Erwin Coumans
aafaa7e33e Expose optional "globalScaling" factor to pybullet.loadURDF and pybullet.loadSDF. This will scale the visual, collision shapes and transform locations.
Fix two_cubes.sdf (was lacking collision shape for second cube)
2017-08-14 14:59:41 -07:00
erwincoumans
457312f94f fix leak in loadSDF in case of visuals with duplicate/identical names that have a material.
fix GUI performance issue on Mac OSX
fix issue introduced in previous commit (in btConvexHullComputer.cpp)
2017-08-11 17:14:52 -07:00
Erwin Coumans
dcaaed9238 also generate TinyRendererVisualShapeConverter for programmatically generated collision shapes
use similar random colors for TinyRenderer (if rgba colors are not specified)
2017-06-29 22:06:27 -07:00
Erwin Coumans
97f6a161f1 fix stb_image.h include path to be consistent. 2017-06-22 08:09:33 -07:00
erwincoumans
b2a46a7edd mimicJointConstraint.py creates actual differential drive
See https://www.youtube.com/watch?v=pK3PTPlRTGA  :-)
2017-06-09 10:15:05 -07:00
erwincoumans
c1f6b7e9b8 fix memory leak in case a Wavefront .obj file had multiple shapes (texture was loaded multiple times, while only releasing one) 2017-06-08 09:21:32 -07:00