Commit Graph

749 Commits

Author SHA1 Message Date
Tigran Gasparian
0b1dca3d9c Updates the documentation for the pybullet function rayTestBatch to include the numThreads parameter. 2018-06-15 17:46:12 +02:00
Tigran Gasparian
08409cae9f Adds multithreading support for batch ray casts.
To enable the feature, enable the BULLET2_MULTITHREADING option.

Increases the number of rays that can go in a batch request by storing
them in the shared memory stream instead of the shared memory command.
Adds the API b3RaycastBatchSetNumThreads to specify the number of
threads to use for the raycast batch, also adds the argument numThreads
to the pybullet function rayTestBatch.
Rays are distributed among the threads in a greedy fashion there's a shared
queue of work, once a thread finishes its task, it picks the next
available ray from the task. This works better than pre-distributing the
rays among threads, since there's a large variance in computation time per ray.

Some controversial changes:
- Added a pointer to PhysicsClient to the SharedMemoryCommand struct, this
was necessary to keep the C-API the same for b3RaycastBatchAddRay, while
adding the ray to the shared memory stream instead of the command
struct. I think this may be useful to simplify other APIs as well, that
take both a client handle and a command handle.
- Moved #define SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE to
SharedMemoryPublic. This was necessary for the definition of
MAX_RAY_INTERSECTION_BATCH_SIZE.
2018-06-15 16:47:04 +02:00
erwincoumans
25c5e87dc2 PyBullet.loadURDF, expose flags=URDF_INITIALIZE_SAT_FEATURES 2018-06-13 15:35:56 -07:00
Erwin Coumans
e24da97140 revert GJK change yet again, some degenerate case / regression 2018-06-12 19:52:38 -07:00
erwincoumans
4d6741f5cd PyBullet: expose STATE_LOGGING_ALL_COMMANDS and STATE_REPLAY_ALL_COMMANDS
See examples/pybullet/examples/commandLogAndPlayback.py for an example.
2018-06-12 16:56:45 -07:00
erwincoumans
459d07a302 add example for enableSAT, using separating axis test (instead of GJK) for contact between polyhedral convex hull shapes (and convex hull vs triangle in a concave triangle mesh) 2018-06-12 16:10:49 -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
Erwin Coumans
e74f86d148 remove ANYmal meshes 2018-06-11 07:44:05 -07:00
erwincoumans
0cec85626f enable more unit tests in PyBullet.
return Py_None if no user data found, to pass the test.
enable m_deterministicOverlappingPairs by default.
if m_deterministicOverlappingPairs, sort the collision pairs.
2018-06-09 12:19:29 -07:00
erwincoumans
72d3f45b05 use new API b3CreateInProcessPhysicsServerFromExistingExampleBrowserAndConnect3 (not 2) 2018-06-05 19:54:08 -07:00
erwincoumans
5ede227e94
Update robot_bases.py
remove print
2018-06-05 19:33:28 -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
fa648a028e fix a few problems introduced in #1730
https://github.com/bulletphysics/bullet3/pull/1730
2018-06-05 09:16:00 -07:00
erwincoumans
d7cbe8dd26 Merge remote-tracking branch 'bp/master' 2018-06-05 08:15:11 -07:00
Tigran Gasparian
aefd5a9d66 Uses SHARED_MEMORY_SERVER instead of GUI_SERVER when starting a bullet server in the unit test. 2018-06-05 09:28:38 +02:00
Erwin Coumans
7bd84740d7 PyBullet / BulletRobotics: prepare for pdControlPlugin and collisionFilterPlugin
Split examples/SharedMemory/b3RobotSimulatorClientAPI_NoGUI.* and move to examples/SharedMemory/b3RobotSimulatorClientAPI_NoGUI.cpp and examples/SharedMemory/b3RobotSimulatorClientAPI_NoDirect.cpp
2018-06-05 11:41:41 +10:00
Erwin Coumans
e4cd88e24f PyBullet: allow to choose the shared memory key when starting SHARED_MEMORY_SERVER 2018-06-05 11:36:54 +10:00
Tigran Gasparian
c49e060e81 Starts bullet server when testsuite is ran, uses pybullet_utils to manage clients. 2018-06-04 19:40:16 +02:00
Tigran Gasparian
bb72a91080 Clears the user data cache when syncUserData is called.
Adds unit test for the UserData functons.
Changes the char pointer in btHashString to std::string. There were
problems where the object owning the string memory would deallocate the
string, making the btHashString object invalid.
2018-06-04 15:10:48 +02:00
erwincoumans
b6120e760a PyBullet.addUserData / getUserData / removeUserData / getUserDataId / getNumUserData / getUserDataInfo
See examples/pybullet/examples/userData.py how to use it. TODO: add to PyBullet Quickstart Guide.
Thanks to Tigran Gasparian for the contribution!
2018-06-02 13:40:08 -07:00
erwincoumans
cb6b7a7c38 PyBullet: expose flags to createMultiBody 2018-06-02 11:37:14 -07:00
Erwin Coumans
39c9ffa4c3 PyBullet IK: backward compatible changes related to joint damping 2018-06-01 23:25:47 -07:00
Erwin Coumans
e74cd05e37 add space 2018-05-31 21:21:50 -07:00
erwincoumans
4c75e022c8 Use dofCount and not numJoints in PyBullet.calculateInverseKinematics, fixes null space demo
See baxter_ik_demo at https://github.com/erwincoumans/pybullet_robots
2018-05-31 21:07:04 -07:00
Erwin Coumans
76e88dddc5 add space to make conversion work 2018-05-31 18:16:40 -07:00
erwincoumans
3463d0a879 Merge branch 'master' of https://github.com/erwincoumans/bullet3 2018-05-31 16:06:33 -07:00
erwincoumans
edc70582dd implement accurate inverse kinematics in C++. PyBullet.calculateInverseKinematics gets "maxNumIterations=20", "residualThreshold=1.04" to tune
allow to provide current joint positions in IK, overriding the body joint positions, also IK target will be in local coordinates.
expose b3ComputeDofCount in C-API
2018-05-31 16:06: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
39808ddfdf allow to run minitaur environment examples from pip version, like this:
python -m pybullet_envs.minitaur.envs.minitaur_trotting_env_example
python -m pybullet_envs.minitaur.envs.minitaur_reactive_env_example
2018-05-29 09:28:31 -07:00
Erwin Coumans
efe9161670 fix cmake build 2018-05-26 08:46:12 +10:00
Erwin Coumans
5de53d7355 PyBullet: add ANYmal.py quadruped example, usage:
pip install pybullet
python -m pybullet_envs.examples.ANYmal
2018-05-25 07:54:38 +10:00
Erwin Coumans
ab7bbf4396 Merge branch 'master' of https://github.com/erwincoumans/bullet3 2018-05-24 15:50:02 +10:00
Erwin Coumans
ff4d0b1777 add HelloBulletRobotics C++ example with similar API to PyBullet
Add ANYmal quadruped robot URDF to pybullet_data
2018-05-24 15:48:45 +10:00
erwincoumans
abeae7e1e7
Merge pull request #1701 from erwincoumans/master
PyBullet: add option to cache graphics shapes for URDF files, handy f…
2018-05-23 14:47:01 +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
erwincoumans
f1b4ffaf98
Merge pull request #1699 from benelot/fix-pendula-with-pbclient
Fix pendulum & manipulator envs with pybullet client
2018-05-23 08:20:40 +10:00
Benelot
4a16032820 Fix manipulators too. 2018-05-22 18:12:45 +02:00
Benelot
7b219e0ea6 Fix pendula to use the bullet-client. 2018-05-22 16:40:10 +02: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
9a706d9cfd PyBullet: fix Gym envs 2018-05-23 00:24:03 +10:00
Erwin Coumans
a0a1c9347c PyBullet: fix in Gym env 2018-05-23 00:18:17 +10:00
Erwin Coumans
a7a6e20d9c Merge branch 'master' of https://github.com/erwincoumans/bullet3 2018-05-20 14:19:49 +10:00
Erwin Coumans
90939279f9 PyBullet: cmake build, enable DBUILD_PYBULLET_NUMPY=ON
fix issue with HalfCheetahBulletEnv-v0 in previous commit
2018-05-20 14:18:53 +10:00
Erwin Coumans
964f52f62d remove unsupported simpleHumanoid.py, use env = gym.make("HumanoidBulletEnv-v0") instead. 2018-05-20 12:35:33 +10:00
Erwin Coumans
701b50ec12 Merge branch 'master' of https://github.com/erwincoumans/bullet3 2018-05-18 16:25:27 -07:00
Erwin Coumans
0abe4151e5 Fix for 1643, allow to instantiate multiple PyBullet Gym environments (Ant, Humanoid, Hopper, Pendula etc) in the same process (same or other thread). It uses the pybullet_utils.bullet_client to achieve this. 2018-05-18 16:23:54 -07:00
erwincoumans
034dfba3ae fix VR controllers only visible in one eye (remove stray glClear for testing planar reflection)
PyBullet: force both contactStiffness and contactDamping (report error otherwise)
2018-05-16 14:24:12 -07:00
erwincoumans
e5a9b42f9a expose PyBullet.setPhysicsEngineParameter(jointFeedbackMode)
use p.JOINT_FEEDBACK_IN_JOINT_FRAME if you want the joint feedback expressed in joint frame (instead of link inertial frame)
use p.JOINT_FEEDBACK_IN_WORLD_SPACE if you want the joint feedback in world space coordinates, instead of local link/joint coordinates.
Example: p.setPhysicsEngineParameter(jointFeedbackMode=p.JOINT_FEEDBACK_IN_WORLD_SPACE+p.JOINT_FEEDBACK_IN_JOINT_FRAME)
2018-05-11 19:52:06 -07:00
erwincoumans
1ec24a0853 fix PyBullet.applyExternalTorque for links (instead of base) 2018-05-11 19:35:27 -07:00