roboticslibrary / rl

The Robotics Library (RL) is a self-contained C++ library for rigid body kinematics and dynamics, motion planning, and control.
https://www.roboticslibrary.org/
BSD 2-Clause "Simplified" License
928 stars 215 forks source link

Best way to set Gravity when not mounted vertically #64

Open zhianguo opened 1 year ago

zhianguo commented 1 year ago

I see that in the rl source codes gravity is set to world with assumed gravity direction along z axis. What if we have a side mounted robot and the root frame is not z vertical? What is the recommended way to set gravity using the dynamics interface. Thanks

zhianguo commented 1 year ago

I was referring to the code in UrdfFactory where the world gravity is set to vertical. I guess if side mounting we have to set again with the correct direction?

rickertm commented 1 year ago

To the best of my knowledge, the URDF file format does not have an option to specify the gravitational vector. The native rl::mdl format allows you to modify this via <gravity></gravity>.

For a horizontally mounted robot I would however recommend to model this via a static transform that defines the mounting position including rotation. URDF has a joint type called fixed for this and rl::mdl uses <fixed></fixed>.