bulletphysics / bullet3

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.
http://bulletphysics.org
Other
12.65k stars 2.88k forks source link

Can I get the position of multiple objects at once? #4153

Closed xyjbaal closed 2 years ago

xyjbaal commented 2 years ago

your work is really great.

I'm using pybullet to simulate some object stacking, there be about 1000 objects. I need to constantly monitor the position of each object, but getBasePositionAndOrientation() can only get the position of one object, and if I use a for() loop, it will be very slow. It takes about 5 minutes each time to get the current position of all the objects.

I would like to ask if there is a good solution for this?

erwincoumans commented 2 years ago

We should add some batch query for this indeed, it hasn't been added. One option is writing the code in a C or C++ PyBullet plugin. Otherwise, you may want to try out NVIDIA Isaac Gym or Brax, both support batch simulation. If/when this gets added, we can re-open/reply to this issue.

VallesMarinerisExplorer commented 1 year ago

I am interested in this as well. Is there a script you would recommend looking at for someone who might write a plugin? Would be happy to take a crack at it!