jrl-umi3218 / RBDyn

RBDyn provides a set of classes and functions to model the dynamics of rigid body systems.
BSD 2-Clause "Simplified" License
163 stars 47 forks source link

forwardDynamics #48

Closed wuv-ogre closed 6 years ago

wuv-ogre commented 6 years ago

For a Free base joint I noticed bodies fall in the opposite direction to gravity, easy to fix just change sign of gravity in ForwardDynamics::computeC() to

sva::MotionVecd a_0(Eigen::Vector3d::Zero(), -mbc.gravity);

then if I set gravity to (0, -9.81, 0) objects fall down the y-axis rather than up it

haudren commented 6 years ago

The default gravity in RBDyn can be a little surprising: it is along the y-axis. This is a remainder of the integration with a now defunct simulator, in which gravity was along the y-axis to cover 2D and 3D cases seamlessly. Thus, we most often set the gravity in the mbc to {0, 0, 9.81}.

This is not a bug, but a recurring source of surprises that we maybe should get rid of.