Load File from URDF and convert to Rigidbody (RobotSimulator)

Post Reply
SorryAmNoob
Posts: 2
Joined: Thu Apr 11, 2019 11:13 am

Load File from URDF and convert to Rigidbody (RobotSimulator)

Post by SorryAmNoob »

Hi y'all
First, I wanna apologize for the (probably) stupid question. But I'm a beginner with the Bullet Engine.
What I want to do is the following: In my project I am using b3RobotSimulatorClientAPI.h to set up a world, visualize it and load some objects into it (A plane and the humanoid.urdf, located in the data folder of bullet). As seen in the RobotSimulator App.

Now I need to find a way to constrain movement along one axis for the humanoid character.
I googled around and the solution I stumbled upon the most is to use a Rigidbody and set the setLinearFactor property accordingly. But it seems like I can't create a RB by doing the file import. As in, there is no function or method or anything. Can someone tell me if what I want is even possible?
Thank you.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Load File from URDF and convert to Rigidbody (RobotSimulator)

Post by Erwin Coumans »

There is a better way to limit motion for reduced coordinate (btMultiBody):

instead of using a free base, use a fixed base and add additional degrees of freedom to enable motion along the axis you want.

See the biped2d example how this is done:
https://github.com/bulletphysics/bullet ... ybullet.py


You can also load the URDF as btRigidBody and btTypedConstraints. Just pass the 'useMaximalCoordinates=true' to the loadURDF command. This works in PyBullet and should be easy to expose/enable in the underlying C++ binding. Again, this isn't the best way anymore, using btMultiBody is easier.
SorryAmNoob
Posts: 2
Joined: Thu Apr 11, 2019 11:13 am

Re: Load File from URDF and convert to Rigidbody (RobotSimulator)

Post by SorryAmNoob »

Thank you Erwin Coumans! I will give it a try that way :)
e: ok, sorry. I looked at the biped2d example, but it is not clear to me where this happens in the code. (the "unlocking" of the Y-axis movement).
And this confuses me, since it is pretty short.. Is this set in the .urdf file itself?
Post Reply