Event detection best practice

Discussion in 'Simulation' started by Omer, Feb 9, 2020.

  1. Hello,
    I'm wondering what is the best practice for event detection. I.e., if we have a simulation of a bouncing ball and we want to find the exact time/state in which an event occur. for the ball example, an event may be the ball reaching the apex of the bounce, or the ball hitting the ground. For the latter, we would also want to know the pre and post impact states.
    Any thought about how to accomplish this?
  2. After every mj_Step() iterate through the contacts in mjdata to see if the respective geometry pair intersects or not

    pre and post impact states: I dont exactly what you mean. But you can of course always just buffer the states do achieve this.

    Alternatively you could look into the callbacks mujoco provides. Theny you have access to the state right after mj_collision was querried