GithubHelp home page GithubHelp logo

Comments (3)

yuvaltassa avatar yuvaltassa commented on June 10, 2024

This is working as expected, not sure why you are confused. After mj_step, everything in mjData except for the state is wrt the previous timestep. So after an mj_step there is an inconsistency between the state and everything else, since mj_step only does everything until it computes the new state and then it stops. After mj_forward all the quantities are wrt the current timestep, there is no inconsistency.

Let me know if something is still unclear.

from mujoco.

yuvaltassa avatar yuvaltassa commented on June 10, 2024

Actually, this is probably a good opportunity to improve the documentation. If you now fully get it, tell me how you think we should improve the docs. If not, please keep asking questions until you are 100% confident you get it, and this conversation will help clarify how the docs should be improved...

from mujoco.

wualbert avatar wualbert commented on June 10, 2024

@yuvaltassa Thank you for the reply. I understand the behavior now.

After spending more time reading the documentation, what you described is indeed detailed in Programming/Simulation loop section.

... Jacobians, passive forces. None of these quantities are available before mj_step is called (or rather, they are available but outdated by one time step)

However, the documentation in APIreference/APIfunctions/Main simulation makes no mention of this explicitly. I also find the statement "mj_step is the only call needed" to be misleading. As far as I can tell most robotics use cases must call mj_forward separately to get forward kinematics results.

Most users will only need to call mj_step, which computes everything and advanced the simulation state by one time step...mj_forward performs the same computations as mj_step but without the integration. It is useful after loading or resetting a model (to put the entire mjData in a valid state), and also for out-of-order computations that involve sampling or finite-difference approximations.

I think adding more emphasis on all quantities except for the state itself is outdated after mj_step would be helpful, especially in the APIreference section.

from mujoco.

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.