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.44k stars 2.86k forks source link

Can't get Base position in 2D constrained robot #2569

Closed MartinFultot closed 4 years ago

MartinFultot commented 4 years ago

Hi. When using the biped/biped2d_pybullet.urdf I noticed getBasePositionAndOrientation() never updates the position (of course I'm calling it in the loop). It only returns the initial position set up by the user. This is a very big problem, as there doesn't seem to be any other way to get the position of the base and I need it to implement springs, which are also not at all straightforward to do. I just want to apply an external force that depends on the position of the object and I need the entire model to be 2D. This is impossible at the moment.

Thank you for your time.

erwincoumans commented 4 years ago

This is intentional. When using a fixed base, the base is the world. If you like to get the position of any of the child links, you can use 'getLinkState' using the optional 'computeForwardKinematics' option and read the URDF link transform or center of mass (inertial) frame transform. See the PyBullet Quickstart Guide for more info about getLinkState: https://docs.google.com/document/d/10sXEhzFRSnvFcl3XxNGhnD4N2SedqwdAvK3dsihxVUA/edit#heading=h.3v8gjd1epcrt