bullet3/examples/SharedMemory
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
..
plugins enable pdControlPlugin by default (requires pdControlPlugin.cpp and b3RobotSimulatorClientAPI_NoDirect.cpp) 2018-06-05 15:59:01 -07:00
tcp enable pdControlPlugin by default (requires pdControlPlugin.cpp and b3RobotSimulatorClientAPI_NoDirect.cpp) 2018-06-05 15:59:01 -07:00
udp enable pdControlPlugin by default (requires pdControlPlugin.cpp and b3RobotSimulatorClientAPI_NoDirect.cpp) 2018-06-05 15:59:01 -07:00
b3PluginManager.cpp fix issue with plugin manager (store plugin uid instead of pointer) 2018-02-06 08:56:24 -08:00
b3PluginManager.h 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
b3RobotSimulatorClientAPI_InternalData.h PyBullet / BulletRobotics: prepare for pdControlPlugin and collisionFilterPlugin 2018-06-05 11:41:41 +10:00
b3RobotSimulatorClientAPI_NoDirect.cpp path -> const 2018-06-12 21:26:34 -07:00
b3RobotSimulatorClientAPI_NoDirect.h path -> const 2018-06-12 21:26:34 -07:00
b3RobotSimulatorClientAPI_NoGUI.cpp remove some warnings 2018-06-06 16:10:20 -07:00
b3RobotSimulatorClientAPI_NoGUI.h PyBullet / BulletRobotics: prepare for pdControlPlugin and collisionFilterPlugin 2018-06-05 11:41:41 +10:00
BodyJointInfoUtility.h further work on urdfEditor.py, fix some serialization issues 2018-01-08 12:25:56 -08:00
CMakeLists.txt enable pdControlPlugin by default (requires pdControlPlugin.cpp and b3RobotSimulatorClientAPI_NoDirect.cpp) 2018-06-05 15:59:01 -07:00
IKTrajectoryHelper.cpp Expose IK solver options including DLS and SDLS. 2017-10-19 14:00:53 -07:00
IKTrajectoryHelper.h Expose IK solver options including DLS and SDLS. 2017-10-19 14:00:53 -07:00
InProcessMemory.cpp Allow InProcessExampleBrowser to use a malloc allocated memory block, instead of system shared memory. 2016-03-10 14:36:46 -08:00
InProcessMemory.h Allow InProcessExampleBrowser to use a malloc allocated memory block, instead of system shared memory. 2016-03-10 14:36:46 -08:00
main.cpp Prepare/allow for non-Bullet2-based physics command processor in pybullet/Bullet-C-API 2017-05-30 19:54:55 -07:00
PhysicsClient.cpp sync repo 2015-11-11 12:44:26 -08:00
PhysicsClient.h Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsClientC_API.cpp Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsClientC_API.h Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsClientExample.cpp add segmask_linkindex.py example using p.getCameraImage(320,200,flags=p.ER_SEGMENTATION_MASK_OBJECT_AND_LINKINDEX) 2017-12-28 12:37:07 -08:00
PhysicsClientExample.h make one of the cubes in two_cubes.sdf static (immovable) using the <static> tag in SDF 2016-06-03 19:03:56 -07:00
PhysicsClientSharedMemory2_C_API.cpp remove some memory leaks in example code. 2017-01-10 14:57:16 -08:00
PhysicsClientSharedMemory2_C_API.h work-in-progress 2016-11-04 13:15:10 -07:00
PhysicsClientSharedMemory2.cpp remove some memory leaks in example code. 2017-01-10 14:57:16 -08:00
PhysicsClientSharedMemory2.h work-in-progress 2016-11-04 13:15:10 -07:00
PhysicsClientSharedMemory_C_API.cpp Quick first prototype/test to integrate pybullet into Unity, 2017-09-20 23:18:18 -07:00
PhysicsClientSharedMemory_C_API.h Quick first prototype/test to integrate pybullet into Unity, 2017-09-20 23:18:18 -07:00
PhysicsClientSharedMemory.cpp Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsClientSharedMemory.h Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsClientTCP_C_API.cpp add B3_SHARED_API to the remaining PhysicsClientC_API APIs 2017-09-21 16:40:19 -07:00
PhysicsClientTCP_C_API.h add B3_SHARED_API to the remaining PhysicsClientC_API APIs 2017-09-21 16:40:19 -07:00
PhysicsClientTCP.cpp Add a btIDEbugDraw::clearLines, helps multi-threaded rendering of lines (while updating those lines in a dynamics world in a different thread) 2017-05-16 12:19:03 -07:00
PhysicsClientTCP.h reduce dependency: PhysicsServerCommandProcessor -> PhysicsCommandProcessorInterface 2018-01-16 13:39:37 -08:00
PhysicsClientUDP_C_API.cpp add B3_SHARED_API to the remaining PhysicsClientC_API APIs 2017-09-21 16:40:19 -07:00
PhysicsClientUDP_C_API.h add B3_SHARED_API to the remaining PhysicsClientC_API APIs 2017-09-21 16:40:19 -07:00
PhysicsClientUDP.cpp expose lsMemory destroy function to release thread memory 2018-05-02 14:32:43 -07:00
PhysicsClientUDP.h reduce dependency: PhysicsServerCommandProcessor -> PhysicsCommandProcessorInterface 2018-01-16 13:39:37 -08:00
PhysicsCommandProcessorInterface.h allow to disable/enable default keyboard shortcuts ('w', 'd' 's' etc) and default mouse picking 2017-06-17 13:29:14 -07:00
PhysicsDirect.cpp Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsDirect.h Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsDirectC_API.cpp add B3_SHARED_API to the remaining PhysicsClientC_API APIs 2017-09-21 16:40:19 -07:00
PhysicsDirectC_API.h add B3_SHARED_API to the remaining PhysicsClientC_API APIs 2017-09-21 16:40:19 -07:00
PhysicsLoopBack.cpp Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsLoopBack.h Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsLoopBackC_API.cpp fix many warnings 2017-01-15 22:26:11 -08:00
PhysicsLoopBackC_API.h consistent *API.* in examples/SharedMemory 2015-11-23 08:00:42 -08:00
PhysicsServer.cpp add physics server loopback (both client and server in the same process, using shared memory) 2015-11-22 20:50:32 -08:00
PhysicsServer.h print better error warning, in case the physics client/server version mismatch. 2017-05-28 17:05:18 -07:00
PhysicsServerCommandProcessor.cpp Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
PhysicsServerCommandProcessor.h PyBullet.addUserData / getUserData / removeUserData / getUserDataId / getNumUserData / getUserDataInfo 2018-06-02 13:40:08 -07:00
PhysicsServerExample.cpp PyBullet: avoid a crash in SHARED_MEMORY_SERVER 2018-05-20 12:20:06 +10:00
PhysicsServerExample.h Prepare/allow for non-Bullet2-based physics command processor in pybullet/Bullet-C-API 2017-05-30 19:54:55 -07:00
PhysicsServerExampleBullet2.cpp Prepare/allow for non-Bullet2-based physics command processor in pybullet/Bullet-C-API 2017-05-30 19:54:55 -07:00
PhysicsServerExampleBullet2.h Prepare/allow for non-Bullet2-based physics command processor in pybullet/Bullet-C-API 2017-05-30 19:54:55 -07:00
PhysicsServerSharedMemory.cpp fix posix memory release issues 2018-05-02 15:39:16 -07:00
PhysicsServerSharedMemory.h allow to disable/enable default keyboard shortcuts ('w', 'd' 's' etc) and default mouse picking 2017-06-17 13:29:14 -07:00
PosixSharedMemory.cpp re-enable shared memory connection for pybullet Gym envs (with fallback to GUI or DIRECT) 2017-09-13 09:56:39 -07:00
PosixSharedMemory.h make OSX/Unix version of PosixSharedMemory work 2015-07-14 16:23:01 -07:00
premake4.lua enable pdControlPlugin by default (requires pdControlPlugin.cpp and b3RobotSimulatorClientAPI_NoDirect.cpp) 2018-06-05 15:59:01 -07:00
RobotControlExample.cpp remove duplicate definitions of SHARED_MEMORY_MAX_STREAM_CHUNK_SIZE 2016-09-11 08:40:58 +01:00
RobotControlExample.h add a robot joint sensor example, reading joint reaction forces/torques using the shared memory API 2015-08-24 15:26:29 -07:00
SharedMemoryBlock.h Replace large timeout (1024*1024*1024) using real-time clock timeout (10 seconds default) 2017-02-22 09:33:30 -08:00
SharedMemoryCommandProcessor.cpp print better error warning, in case the physics client/server version mismatch. 2017-05-28 17:05:18 -07:00
SharedMemoryCommandProcessor.h Add a btIDEbugDraw::clearLines, helps multi-threaded rendering of lines (while updating those lines in a dynamics world in a different thread) 2017-05-16 12:19:03 -07:00
SharedMemoryCommands.h Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
SharedMemoryCommon.h add command-line argument for example browser and shared memory app, --shared_memory_key=<int> 2015-08-07 00:13:26 -07:00
SharedMemoryInProcessPhysicsC_API.cpp people are actually using this internal API, add a new one and keep old one backward compatible 2018-06-05 19:44:33 -07:00
SharedMemoryInProcessPhysicsC_API.h people are actually using this internal API, add a new one and keep old one backward compatible 2018-06-05 19:44:33 -07:00
SharedMemoryInterface.h minor refactoring 2015-07-23 11:51:25 -07:00
SharedMemoryPublic.h Adds multithreading support for batch ray casts. 2018-06-15 16:47:04 +02:00
SharedMemoryUserData.h add new file related to PyBullet userData 2018-06-02 13:52:00 -07:00
Win32SharedMemory.cpp use Bullet3Common/b3AlignedObjectArray.h instead of LinearMath version in SharedMemory/PhysicsClientSharedMemory 2018-05-16 12:10:34 -07:00
Win32SharedMemory.h Refactor of PhysicsClient/PhysicsServer, to separate from the example browser code. 2015-07-14 15:30:17 -07:00