Unstable simulations when using height field

Discussion in 'Simulation' started by Silverjoda, Feb 21, 2019.

  1. Hello.

    I'm getting unstable contacts when using heightfields with small robots (30cm). The robot shivers
    when in contact with the height field. I reduced the margin to a very small number and this helps somewhat,
    but I'm still getting moments where the leg goes through the floor and the whole thing blows up and flings the robot
    up in the air, completely messing up the reinforcement learning procedure.

    Any advice on how to set the simulation parameters? I've attached an XML that I'm using.

    Thanks in advance,
    T.
     

    Attached Files:

  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    Can you attach the heightfield file: hf_barrier.png
     
  3. Thanks for the reply, Emo.

    Here is an example. I usually use some uneven terrain, but even in this example with flat ground if the margin is 0.01 or larger then the hexapod starts shaking.
    If the margin significantly smaller then i get wierd behavior like geoms going through other geoms (sometimes) and causing a blow up.

    I haven't had any such issues when using large models, such as from the OpenAI gym.
    Any advice on how to setup the simulation for small models?

    Thanks in advance,
    Teymur Azayev
     

    Attached Files:

  4. I keep getting "Pre-allocated constraint buffer is full. Increase njmax above 500. Time = 199202.5800.Increase njmax in mujoco XML" after a few minutes/hours of simulation even though I have
    that parameter set to 600.
     
  5. Emo Todorov

    Emo Todorov Administrator Staff Member

    Haven't looked at your heightfield yet, but this may explain it. If the pre-allocated contact or constraint buffer sizes are insufficient, the simulator will discard contacts at runtime, in which case objects can fall through the floor. Try bigger values, say njmax = 2000, nconmax = 500.

    Do you still get objects penetrating the heightfield with this change?
     
  6. I've been running into what I think is a similar issue. I have a heightfield geom (size 10m) that is essential in the shape of a hill (essential a 2D gaussian, where the peak is of height ~2m). The robots are ~0.7m diameter spheres that navigate by rolling (with a roll joint).

    I'm consistently seeing behavior where the robots pass through the heightfield (it seems to especially happen at inflection points of the surface, where things change from concave to convex); often this either results in the robots being trapped under the heightfield, or a seemingly weird contact being resolved with a large force applied on the robot (resulting in the robot flying off).

    I've tried increasing nconmax and njmax (> 500, >2000 respectively). I've also tried decreasing the simulator time step size to as small as 0.0005, as well as increasing the margin of the contact for both the heightfield and the sphere geoms. I am using condim 6 for both geom types.

    Is there a way to increase the thickness of the heightfield geom? Perhaps this would resolve some of the contact issues.

    Thanks in advance,
    A.
     
    Last edited: Nov 7, 2019
  7. Just wanted to follow up and mention that in my case, the error was that I was specifying the heightfield at runtime, and sometimes I had values outside of [0, 1]. Ensuring all values are [0,1] fixed my issue.