Giter Club home page Giter Club logo

Comments (5)

cdfreeman-google avatar cdfreeman-google commented on July 23, 2024

Because we're using "impulsive" torques, these formulas actually end up being the same. But you're totally right that this is the more general expression for the rate of change of the angular velocity. There's a nice little discussion here: https://physics.stackexchange.com/questions/434760/integrating-rigid-body-equations-for-a-game-engine-simulation where someone noticed exactly this issue.

from brax.

o-Oscar avatar o-Oscar commented on July 23, 2024

My interpretation of the discussion you mention does not enter in conflict with my previous point.

In the first reply of the discussion, they go through the derivation of the equation that I mentioned, and then discuss its differences with the impulse formulation. The key difference between the two formulation is how the time is evolving.

In the first part of the answer, the time is evolving : the delta t in the following equation is non zero.
image
between those two different times, the inertia matrix can not be considered constant. Hence the omega x I omega term.

In contrary, in the second part of the answer, they are working with impulses and with instantaneous velocity change.

In the event that the applied torque takes the form of an instantaneous impulse

In this part of the answer, they are working with zero-sized delta t, and going from t0- to t0+. That leads them to say the following :

The space-fixed inertia tensor does not change during this infinitesimal time interval

In brax, what we essentially want to do is :

  • first integrate the physics forward in time
  • then solve for constraints violation using impulses.

During the forward physics integration, the correction term I am talking about should be included, because the delta t is non zero.
But then, during the constrain solve, with impulse correction, I agree that this term does not appear.

from brax.

erwincoumans avatar erwincoumans commented on July 23, 2024

Thanks for the feedback, o-Oscar!

Yes, the gyroscopic term is missing. See also Erin Catto's slides for some background and how to implement it efficiently:
https://box2d.org/files/ErinCatto_NumericalMethods_GDC2015.pdf (slide 60 onwards).
When implementing the gyroscopic force as an explicit force, it can easily add energy and 'blow up' the simulation, hence an implicit implementation.

See here the implementation of implicit and explicit gyroscopic forces in our Bullet physics engine (C++), it should be straight forward to add to Brax as well (this is the implemention for maximal coordinate rigid bodies):
https://github.com/bulletphysics/bullet3/blob/master/src/BulletDynamics/Dynamics/btRigidBody.cpp#L283

Note that for typical gym environments, such as humanoid, ant etc, the velocities and inertias don't cause large gyroscopic forces, so it is not obvious that omitting this term hurts realism significantly. Without the term, you won't get the interesting Dhanibekov effect though: https://www.youtube.com/watch?v=1x5UiwEEvpQ

By the way, I wonder where your minus sign comes from, usually it is a plus.
image

from brax.

o-Oscar avatar o-Oscar commented on July 23, 2024

Thanks a lot for the response!
Ok, so since in the classical RL settings, most bodies have low gyroscopic torques, and due to the added complexity that would arise in order to prevent divergence, It does make sense to not include this term in the simulation.
Thanks for clarifying that!

from brax.

cdfreeman-google avatar cdfreeman-google commented on July 23, 2024

Yep, you're totally right o-Oscar. Managed to confuse the heck out of myself, because I know I've measured conservation laws for our codebase, and everything seemed to check out. Turns out, we've only ever simulated primitives that have diagonal inertia tensors, so this term has always vanished.

from brax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.