Enable contact visualization in the renderer to debug collisions
Browse files- tray_sim.py +7 -0
tray_sim.py
CHANGED
|
@@ -47,6 +47,13 @@ def run_tray_simulation(seed=0, num_objects=N_OBJECTS, azimuth=45, elevation=-25
|
|
| 47 |
|
| 48 |
# Custom camera parameters
|
| 49 |
scene_option = mujoco.MjvOption()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
cam = mujoco.MjvCamera()
|
| 51 |
cam.type = mujoco.mjtCamera.mjCAMERA_FREE
|
| 52 |
cam.lookat[:] = np.array([0.0, 0.0, 0.02]) # Center of the tray
|
|
|
|
| 47 |
|
| 48 |
# Custom camera parameters
|
| 49 |
scene_option = mujoco.MjvOption()
|
| 50 |
+
|
| 51 |
+
# Enable contact visualization in the renderer to debug collisions
|
| 52 |
+
# Check if contact points appear when the puck hits the tray. If not,
|
| 53 |
+
# collisions are not being detected.
|
| 54 |
+
scene_option.flags[mujoco.mjtVisFlag.mjVIS_CONTACTPOINT] = True
|
| 55 |
+
scene_option.flags[mujoco.mjtVisFlag.mjVIS_CONTACTFORCE] = True
|
| 56 |
+
|
| 57 |
cam = mujoco.MjvCamera()
|
| 58 |
cam.type = mujoco.mjtCamera.mjCAMERA_FREE
|
| 59 |
cam.lookat[:] = np.array([0.0, 0.0, 0.02]) # Center of the tray
|