Commit Graph

429 Commits

Author SHA1 Message Date
yunfeibai
d077bdec07 Change the API names for loading softbody. 2018-01-07 19:24:37 -08:00
yunfeibai
e3e9546960 Load the deformable object through obj file. Modify the demo for two way coupling between multibody and softbody. 2018-01-07 19:06:09 -08:00
Erwin Coumans
a85a4f387b more work on UrdfEditor.py 2018-01-06 15:00:20 -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
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
Erwin Coumans
35b44f8a85 implement pybullet.saveState command, for in-memory storage of state.
bump up pybullet API version (SHARED_MEMORY_MAGIC_NUMBER) to 201801010
2017-12-31 15:37:16 -08:00
Erwin Coumans
9c55b61315 pybullet.createVisualShape: process sphere radius, box half extents, capsule+cylinder radius/length
fixes issue #1427, https://github.com/bulletphysics/bullet3/issues/1427
2017-12-30 17:42:13 -08:00
Erwin Coumans
0326fa93a8 made some progress in saving and restoring the state during the simulation, with identical results.
Option to de/serialize btPersistentContactManifolds and fix lossy conversion during btMultiBody de/serialization of base world transform
(serialize the quaternion, not the converted 3x3 matrix)
There are still several caches not taken into account, and btMultiBody links/constraints are not deserialized yet etc.
See examples\pybullet\examples\saveRestoreState.py for an example.
2017-12-30 14:19:13 -08:00
Erwin Coumans
5517cbc4e0 add segmask_linkindex.py example using p.getCameraImage(320,200,flags=p.ER_SEGMENTATION_MASK_OBJECT_AND_LINKINDEX)
to extract object unique id and link index from segmentation mask in getCameraImage
2017-12-28 12:37:07 -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
erwincoumans
41f9bb89e5 expose API to change the local inertia diagonal, pybullet.ChangeDynamics(objectUid, linkIndex, localInertiaDiagonal=[xx,yy,zz]) 2017-12-20 16:56:31 -08: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
8ff75e11cd fixes related to torsional friction, due to recent cone friction update. 2017-11-28 20:09:56 -08:00
erwincoumans
29aa9cb789 Bullet bump up to version 2.88
add preliminary support to import btMultiBody from a .bullet file (will help save/restore state)
fix some Windows char/widechar issues
2017-11-22 18:12:02 -08:00
erwincoumans
ab843b26f0 expose a maximum velocity due to the joint motor in position control.
see also pybullet/examples/motorMaxVelocity.py
this fixes issue 1444
2017-11-21 17:05:28 -08:00
erwincoumans
81146a4090 pybullet: move RGB,depth, segmentation mask preview windows to the right
remove some dead code from PhysicsServerCommandProcessor.cpp
2017-11-18 13:21:20 -08:00
erwincoumans
a9b59b4511 Finally refactored the PhysicsServerCommandProcessor::processCommand switch statements into over 50 separate functions.
Over time, some of those functions can be moved into separate plugins, similar to vrSyncPlugin (either statically/dynamically linked plugins or dynamically loaded at run-time)
2017-11-17 16:14:18 -08:00
erwincoumans
6be7e34dd6 pybullet vr_kuka_setup.py: add a gear joint, to keep the gripper centered,
vr_kuka_control.py: control all joints, use analogue button to close gripper
remove some debug warnings/prints
pybullet, avoid crash in changeUserConstraint if not passing a [list]
allow some gym environments (pybullet_pendulum and locomotors) to re-use an existing physics client connection.
2017-11-12 10:36:30 -08:00
erwincoumans
7524e37124 Merge branch 'master' of https://github.com/erwincoumans/bullet3 2017-10-25 08:15:14 -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
c1ba04a580 Merge pull request #1404 from erwincoumans/master
perform IK in local body-fixed frame ,  add jointFrictionDamping.py example
2017-10-25 00:52:16 +00:00
Erwin Coumans
7a1dbf2e59 allow IK on a floating base, see video:
add inverse_kinematics_husky_kuka.py example
fix spacing in inverse_dynamics.py
2017-10-25 00:32:47 -07:00
Erwin Coumans
41a1362bc5 perform IK in local body-fixed frame
For now, Jacobian, mass matrix and inverse dynamics return results in local coordinates of the tree.
2017-10-24 21:06:44 -07:00
Jonathan Tompson
03b2cfe991 Added gear info to getConstraintInfo return.
Fixed bug in GEAR constraint update.
2017-10-22 15:01:13 -07:00
erwincoumans
28ea41bfe6 Merge pull request #1393 from YunfeiBai/master
Expose IK solver options: DLS and SDLS.
2017-10-20 13:22:56 -07:00
yunfeibai
dda1b05f4a Expose IK solver options including DLS and SDLS. 2017-10-19 14:00:53 -07:00
Erwin Coumans
c178c101a8 fix the pybullet.changeDynamics linear/angular damping
expose pybullet.getConstraintState
2017-10-18 19:15:35 -07:00
erwincoumans
de44e4811a fix pybullet.addUserDebugText borders around letters
bump up pybullet version
In a few pybullet examples, first connect to SHARED_MEMORY, if not connected use GUI mode
2017-10-10 22:11:32 -07:00
erwincoumans
c155e105a5 unlock thread at exitPhysics
pybullet: don't crash in inverse kinematic if #dofs don't match due to free base
C-API: don't crash if status/statusHandle = 0
2017-10-10 11:10:42 -07:00
erwincoumans
6b4f69f733 Merge remote-tracking branch 'bp/master' 2017-10-09 21:09:23 -07:00
yunfeibai
55b60e90f7 Modify inverse kinematics to also support robot model with fixed joint. 2017-10-09 18:28:52 -07:00
Erwin Coumans
d48e2a20af fix a string check issue 2017-10-09 12:28:39 -07:00
Jonathan Tompson
2dee1638f4 quick update to SAVE_WORLD for JOINT_GEAR. 2017-10-09 10:48:03 -07:00
erwincoumans
7d7f5ee7d4 Merge pull request #1371 from jonathantompson/userConstraintResultArgs_fix
Fixed setting of m_userConstraintResultArgs.
2017-10-08 22:56:56 -07:00
Jonathan Tompson
a57c7e7fcf Fixed setting of m_userConstraintResultArgs (not sure how it ever worked for anyone). It was filling up the userConstraintData with stale memory. 2017-10-08 21:31:29 -07:00
erwincoumans
2f2f070ab5 allow changeVisualShape (rgbaColor, specularColor and texture) for maximal coordinates rigid body (btRigidBody)
Make the examples\pybullet\examples\createVisualShape.py a bit more interesting
2017-10-08 11:34:42 -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
1034c7e720 reorder initializer 2017-10-06 17:30:10 -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
b572fe43f9 fix signal handling in ExampleBrowser on linux/mac on termination
expose all analogue axes from OpenVR (5 controllers, each x,y -> 10 floats) in pybullet.getVREvents(allAnalogAxes=1)
2017-10-05 12:59:58 -07:00
erwincoumans
822ff077c7 expose some parameters through pybullet.getPhysicsEngineParameters (C-API: b3InitRequestPhysicsParamCommand + b3GetStatusPhysicsSimulationParameters) 2017-10-05 11:43:14 -07:00
erwincoumans
1262adeaec build a named tuple for 'getConnectionInfo'
remove debug code
2017-10-05 09:57:17 -07:00
erwincoumans
f467f325f7 store mass matrix in streaming part of shared memory (no support for unlimited mass matrix sizes at the moment) 2017-10-05 08:23:10 -07:00
erwincoumans
a2d6a2e822 Merge pull request #1350 from bingjeff/add_mass_matrix
[pybullet] Add calculateMassMatrix.
2017-10-05 07:45:30 -07:00
Erwin Coumans
acbe457d31 add option to statically link a plugin, select the postFix (to avoid naming conflict of multiple plugins functions ('initPlugin' becomes initPlugin_postFix)
pass events (keyboard, mouse, vr controllers etc) to the plugin, and clear them after the tick callback, so that it doesn't interfere with Python 'getEvents'
2017-10-03 15:00:52 -07:00
Jeffrey Bingham
d9782f953d Add calculateMassMatrix to physics server command processor. 2017-09-30 13:56:40 -07:00
Jeffrey Bingham
d49fade704 fix some formatting. 2017-09-27 22:30:32 -07:00
Jeffrey Bingham
d8b80bce40 Fix the translation jacobian. 2017-09-27 22:25:39 -07:00
erwincoumans
8a265b8af2 expose gear erp/relative position target to C-API/pybullet
finish much better C++ vrSyncPlugin, running in-the-loop with the physics at high frequency, see also vr_kuka_setup_vrSyncPlugin.py
2017-09-26 19:54:36 -07:00
erwincoumans
b1f8eb74a4 bump up shared memory version number
add option to recompute forward kinematics, to be consistent with link velocities in pybullet.getLinkState (..., computeForwardKinematics=0/1), thanks to Jeff Bingham for bringing up this inconsistency
2017-09-26 10:05:17 -07:00
Jeffrey Bingham
ee30ca93c5 [sharedmemory] Fill-out calculateJacobian command.
The server command processor actually didn't do anything with
the local point that was passed along with the calculateJacobian
command. Added in the necessary bit of math to return the
corresponding jacobian.

Also, fixed a typo in pybullet that was returning the same
jacobian for translation and rotation.
2017-09-24 18:57:48 -07:00
Erwin Coumans
70364445b8 Merge remote-tracking branch 'bp/master' 2017-09-24 09:49:53 -07:00
Jeffrey Bingham
1727e47beb [pybullet] Add calculateJacobian.
* Add the calculateJacobian method to the pybullet API.
* Adjust the shared memory interface to handle fixed/floating bases
  in the calculateJacobian method.
* Fix a few comments.
2017-09-23 19:58:59 -07:00
erwincoumans
8e496036c6 More work on the C/C++ plugin system for pybullet/C-API:
Add preTickPluginCallback/postTickPluginCallback
User pointer for b3PluginContext, to store objects (class/struct instances)
Pass ints and floats as optional argument for plugin executePluginCommand
2017-09-23 18:05:23 -07:00
erwincoumans
815a56c9bc Allow to load a urdf file in the testplugin.cpp, as first quick test, example pybullet script:
import pybullet as p
p.connect(p.GUI)
pluginUid = p.loadPlugin("E:/develop/bullet3/bin/pybullet_testplugin_vs2010_x64_debug.dll")
commandUid = 0
argument = "plane.urdf"
p.executePluginCommand(pluginUid,commandUid,argument)
p.unloadPlugin(pluginUid)
2017-09-23 09:25:00 -07:00
erwincoumans
240fff575d Merge branch 'master' of https://github.com/erwincoumans/bullet3 2017-09-23 07:22:50 -07:00
Erwin Coumans
3783dccaa3 create a C/C++ plugin system for pybullet / C-API. 2017-09-22 19:17:57 -07:00
erwincoumans
312e35964f make some code const correct. 2017-09-22 07:53:21 -07:00
Erwin Coumans
2e7c0cef38 pybullet/C-API: fix width/height when getCameraImage has a fallback from OpenGL hardware
to TinyRenderer
2017-09-14 15:39:22 -07:00
Erwin Coumans
c250a5f0b9 re-enable shared memory connection for pybullet Gym envs (with fallback to GUI or DIRECT)
suppress shared memory connection warnings
add fallback from ER_BULLET_HARDWARE_OPENGL to TinyRenderer if not available
2017-09-13 09:56:39 -07:00
erwincoumans
cc9995d44b fix uninitialized camera position in 'VR' / 'camera rendering' mode (causing broken specular reflections in VR)
use debug visualizer camera viewmatrix/projection matrix if not provided, in ER_BULLET_HARDWARE_OPENGL mode.
fix broken changeRGBAColor implementation, thanks to Laura for the report!
2017-09-12 22:14:00 -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
Erwin Coumans
7878f7ace9 Add Extras/BulletRobotics, will be installed as 'Extra Libs' using CMake
Reduce size of command-logfile (used in PhysicsServer (Logging) and PhysicsServer (Log Replay))
Make Bullet3Common and BulletInverseDynamics part of core Bullet libraries (not optional)
2017-09-06 13:18:39 -07:00
Erwin Coumans
3f21e528f0 revert name 'v' -> 'u' (backward compatibility) and 'u' -> 't'
make vr_kuka_setup.py load faster, by disabling rendering during loading
allow to setRealTimeSimulation(0) in VR
2017-09-02 11:35:54 -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
ee30479a28 add option to log joint torques (due to user applied torques and/or motor torques)
See quadruped.py for an example:
p.startStateLogging(p.STATE_LOGGING_GENERIC_ROBOT, "genericlogdata.bin", maxLogDof = 16, logFlags = p.STATE_LOG_JOINT_TORQUES)
Thanks to JulianYG, in pull request https://github.com/bulletphysics/bullet3/pull/1273
2017-08-30 19:41:15 -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
1569f3845c more fixes in pybullet_gym envs/data.
implement pybullet.setAdditionalSearchPath
2017-08-27 19:34:00 -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
erwincoumans
2e0a987750 pybullet only allow one GUI/GUI_SERVER instance.
Fix LINK_FRAME/WORLD_FRAME coordinate issue in pybullet applyExternalForce
2017-08-15 14:15:30 -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
Erwin Coumans
88897cc744 implement pybullet.changeTexture. For now, the width/height has to match the target texture unique id, otherwise crashes may happen (a check for width/height match will be added)
See also examples\pybullet\examples\changeTexture.py
2017-06-30 19:11:43 -07:00
Erwin Coumans
dd3d55610b fixes in pybullet.loadTexture, changeVisualShape replacing texture.
(also works for OpenGL3 renderer now)
2017-06-30 13:35:07 -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
65e22ba3e9 allow auxilary link to be used for gear btMultiBodyGearConstraint. 2017-06-23 20:24:04 -07:00
Erwin Coumans
2ab56b4d62 Allow to create concave collision meshes. Note that this is only supported for static (mass 0) multibodies. 2017-06-23 14:43:28 -07:00
Erwin Coumans
71170d6384 reduce stack usage (cause some crashes in low-stack tests)
fix crashing bug in changeVisualShape
add differential gear version of racecar (only 2 back wheels are powered)
2017-06-20 20:22:14 -07:00
Erwin Coumans
7441515c0e Preliminary version of pybullet.createMultiBody including links connected to parent by a joint.
See createMultiBodyLinks.py example.
2017-06-19 13:15:05 -07:00
Erwin Coumans
f3c11b6f31 add capsule, cylinder, plane, mesh support for pybullet.createCollisionShape
preparation to add links to pybullet.createMultiBody
2017-06-19 10:14:26 -07:00
Erwin Coumans
2e6f8c271e allow to disable/enable default keyboard shortcuts ('w', 'd' 's' etc) and default mouse picking
pybullet.getMouseEvents / b3RequestMouseEventsCommandInit
2017-06-17 13:29:14 -07:00
Erwin Coumans
3a826a5997 getCameraImage: use debug visualizer camera viewmatrix/projection matrix if possible (only if view/proj matrix is not provided) 2017-06-17 11:21:10 -07:00
Erwin Coumans
23b155a2b4 add getAABB.py example.
fix getAABB / b3RequestCollisionInfoCommandInit to use less stack memory
2017-06-16 18:10:10 -07:00
Erwin Coumans
bb8cfe3c9a pybullet.getAABB and getAPIVersion
fix btMultiBody::getLinkCollider
bump up Bullet C-API version
2017-06-15 19:46:27 -07:00
erwincoumans
3921ea88fa Merge pull request #1177 from YunfeiBai/master
Bug fix. Only return friction coefficient when there is a valid link …
2017-06-14 08:11:57 -07:00
Erwin Coumans
c84416d932 add debug view for getCameraImage (RGB, depth, segmentation mask) 2017-06-13 10:53:24 -07:00
yunfeibai
037043467a Bug fix. Only return friction coefficient when there is a valid link collider. 2017-06-08 18:59:11 -07:00
Erwin Coumans
46f2f3db4e implement 'mimic' joint constraint or 'gear' constraint for btMultiBody, add example in pybullet/examples/mimicJointConstraint.py 2017-06-07 16:22:02 -07:00
Erwin Coumans
60e3887456 enable btGearConstraint, expose 'changeDynamics' for gearRatio, only works for maximalCoordinates rigid bodies.
See examples\pybullet\examples\mimicJointConstraint.py
2017-06-07 13:44:34 -07:00
Erwin Coumans
d08f3e5f91 expose pybullet non-contact erp, friction erp and frictionAnchor, b3PhysicsParamSetDefaultNonContactERP / b3PhysicsParamSetDefaultFrictionERP / b3ChangeDynamicsInfoSetFrictionAnchor 2017-06-07 09:37:28 -07:00
Erwin Coumans
0c3a3cc466 pybullet.changeDynamicsInfo/b3ChangeDynamicsInfoSetContactStiffnessAndDamping expose contactStiffness/contactDamping 2017-06-07 08:37:42 -07:00
Erwin Coumans
a7aed37632 work on pybullet/C-API createMultiBody (still preliminary, only sphere/box collision shapes, no links/hierarchies yet, soon)
pybullet/C-API, expose linear/angular damping
fix some warnings (param name needs to be same in .h and .cpp)
fix potential startup threading issue (args were deleted in main thread while still possibly use in child thread)
fix for spinning/rolling friction in case of mixing maximal and reduced coordinate btMultiBody+btRigidBody
2017-06-04 22:04:16 -07:00
Erwin Coumans
b23cb1dd2c pybullet.createCollisionShape, createVisualShape, createMultiBody, programmatic creation using ProgrammaticUrdfInterface
(still preliminary, not ready for commit yet, see examples\pybullet\examples\createSphereMultiBodies.py)
2017-06-03 10:57:56 -07:00
yunfeibai
bfcbb339cf Merge remote-tracking branch 'upstream/master' 2017-06-02 18:26:04 -07:00
yunfeibai
0a29c8d9af Get debug visualizer camera yaw, pitch, dist, and target. 2017-06-02 18:24:51 -07:00
yunfeibai
f350a506a6 Enable rgba color update for TinyRender. 2017-06-01 23:32:26 -07:00
erwincoumans
3987bdd333 remove pose frame from SDF,
allow plane collision shape in SDF
load the Roboschool stadium.sdf in humanoid_knee_position_control.py
2017-06-01 20:13:39 -07:00
yunfeibai
e6d1a8cf97 Swap yaw and pitch in camera computation. Add functions to convert view matrix to camera position, and camera position to camera yaw pitch roll. 2017-06-01 15:30:37 -07:00
Erwin Coumans
87293e835c implement specular, URDF non-standard specular part (see sphere2.urdf) and SDF specular support.
pybullet.changeVisualShape(obUid,linkIndex,specularColor=[R,G,B]) and Bullet C-API b3UpdateVisualShapeSpecularColor
Bug fixes in b3ResourcePath::findResourcePath resolution.
add stadium.sdf and roboschool/models_outdoor/stadium assets https://github.com/openai/roboschool/tree/master/roboschool/models_outdoor/stadium
minor fixes to obj2sdf
2017-06-01 12:32:44 -07:00