Comments (5)
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.
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.
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.
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.
from brax.
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.
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)
- Subsume part of System inside State; EDIT: Or add Options to reset HOT 11
- MjxEnv no where to be found HOT 2
- Broken links on Github's brax's main page HOT 2
- [MJX] Model loading errors in `brax.io`, for features supported by MJX HOT 1
- Rendering an image with brax.io.image HOT 6
- Dump to json fails if mj model contains no meshes HOT 2
- Collision of robot with solid object HOT 1
- How to access parameter values for each time-step with callback function policy_param? HOT 1
- Different behavior from gym.Mujoco: the walker body penetrate the ground HOT 1
- ValueError: vmap got inconsistent sizes for array axes to be mapped HOT 1
- There's another issue. The renderings are not in color. Here are some example gifs and the code used to produce them. HOT 1
- episode reward is NAN by training HOT 2
- HTML rendering not working in local Jupyter Notebook HOT 2
- Failure to write videos upon training completion HOT 1
- Are control actions scaled in BRAX environments? HOT 6
- Nan encounted in pipeline_step() HOT 1
- Cannot run simple MJX example on standard v4-8 Cloud TPU VM HOT 2
- Pusher environment with Spring pipeline HOT 3
- Optimizer with MultiTransform throws ValueError HOT 2
- Documentation bug: wrong observation and action spaces ordering HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from brax.