2020-11-28 10:09

Run Ant-v1, got WARNING: Nan, Inf or huge value in QACC at DOF 0. The simulation is unstable. Time = 0.0000.

Hi all, I run a3c in Ant-v1 and got this warning:

WARNING: Nan, Inf or huge value in QACC at DOF 0. The simulation is unstable. Time = 0.0000.

Are there anyone know what's the problem with this, and maybe the reason why. (My code runs well for other envs


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • weixin_39945795 weixin_39945795 4月前

    I met the same issue on several environments, does anyone know a solution?

    点赞 评论 复制链接分享
  • weixin_39883194 weixin_39883194 4月前

    my mujoco-py version is mujoco-py==0.5.7 I'm not sure if it appears in other version

    点赞 评论 复制链接分享
  • weixin_39530509 weixin_39530509 4月前

    I also tried Ant-v1 with your pytorch a3c code. I changed line 81 in test.py

    state, reward, done, _ = env.step(action.numpy())

    and then, the warning was disappeared

    点赞 评论 复制链接分享
  • weixin_39692245 weixin_39692245 4月前

    Any updates on this issue? I am having the same trouble. I suspect that it is due to some structure that causes the acceleration becoming too large.

    点赞 评论 复制链接分享
  • weixin_39770592 weixin_39770592 4月前

    Same issue here with different environments. If anyone has found as solution plz kindly share!

    点赞 评论 复制链接分享
  • weixin_39603476 weixin_39603476 4月前

    Seems to be an issue with MuJoCo - too much penetration or contact between two bodies will cause this error. Model needs to updated

    点赞 评论 复制链接分享
  • weixin_39604819 weixin_39604819 4月前

    I had a similar problem in #340. I discovered that you should slow down stepping. I solved the issue by just delaying the next step with time.sleep(.002).

    time.sleep(.002) obs, r, done, _ = self.env.step(action)

    点赞 评论 复制链接分享
  • hookie1990 信雪神话 1月前

    OK, I found a solution.

    We found the official statement:

    Simulation time step in seconds. This is the single most important parameter affecting the speed-accuracy trade-off which is inherent in every physics simulation. Smaller values result in better accuracy and stability. To achieve real-time performance, the time step must be larger than the CPU time per step (or 4 times larger when using the RK4 integrator). The CPU time is measured with internal timers. It should be monitored when adjusting the time step. MuJoCo can simulate most robotic systems a lot faster than real-time, however models with many floating objects (resulting in many contacts) are more demanding computationally. Keep in mind that stability is determined not only by the time step but also by the Solver parameters; in particular softer constraints can be simulated with larger time steps. When fine-tuning a challenging model, it is recommended to experiment with both settings jointly. In optimization-related applications, real-time is no longer good enough and instead it is desirable to run the simulation as fast as possible. In that case the time step should be made as large as possible.

    According to above, we decreased the value of timestep in xml file from “timestep=0.001”to “timestep=0.0008”. It seems the simulator stability improved.

    The solver includes [PGS, CG, Newton]. The default is "Newton", relation of stability of this parameter need to be tested.

    official statement:

    This attribute selects one of the constraint solver algorithms described in the Computation chapter. Guidelines for solver selection and parameter tuning are available in the Algorithms section above.

    For parameter damping cited in the above answer, it seem it need to be decrased. 

    damping : real, "0"

    Damping applied to all degrees of freedom created by this joint. Unlike friction loss which is computed by the constraint solver, damping is simply a force linear in velocity. It is included in the passive forces. Despite this simplicity, larger damping values can make numerical integrators unstable, which is why our Euler integrator handles damping implicitly. See Integration in the Computation chapter.
    版权声明:本文为CSDN博主「信雪神话」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。

    点赞 评论 复制链接分享
  • hookie1990 信雪神话 1月前

    MujocoException: Got MuJoCo Warning: Nan, Inf or huge value in QACC at DOF 0. The simulation is unstable. 

    Ok, I got similiar error. Is there anyone know how to deal with it... I had tried to add delay function before env.step, but it seems no effects.

    点赞 评论 复制链接分享