chrisjcc commited on
Commit
492932f
·
verified ·
1 Parent(s): 0e6daaf

Move variable definition and initialization up.

Browse files
Files changed (1) hide show
  1. tray_sim.py +5 -4
tray_sim.py CHANGED
@@ -15,6 +15,11 @@ def run_tray_simulation(seed=0, num_objects=N_OBJECTS, azimuth=45, elevation=-25
15
  model = mujoco.MjModel.from_xml_path(MODEL_PATH)
16
  data = mujoco.MjData(model)
17
 
 
 
 
 
 
18
  # Pusher setup
19
  pusher_pos = np.array([0.35, -0.35, 0.08]) # Slightly outside tray corner
20
  pusher_quat = [1, 0, 0, 0]
@@ -37,10 +42,6 @@ def run_tray_simulation(seed=0, num_objects=N_OBJECTS, azimuth=45, elevation=-25
37
  data.qpos[obj_start+3:obj_start+7] = quat
38
  data.qvel[i*6:i*6+6] = 0
39
 
40
- # Locate pusher DOF index (last one in qpos if you have 10 objects)
41
- pusher_idx = num_objects * 7
42
- pusher_vel_idx = num_objects * 6
43
-
44
  # Renderer setup
45
  renderer = mujoco.Renderer(model, width=480, height=480) # width=640, height=640
46
 
 
15
  model = mujoco.MjModel.from_xml_path(MODEL_PATH)
16
  data = mujoco.MjData(model)
17
 
18
+ # Locate pusher DOF index (last one in qpos if you have 10 objects)
19
+ # Compute DOF offsets
20
+ pusher_idx = num_objects * 7
21
+ pusher_vel_idx = num_objects * 6
22
+
23
  # Pusher setup
24
  pusher_pos = np.array([0.35, -0.35, 0.08]) # Slightly outside tray corner
25
  pusher_quat = [1, 0, 0, 0]
 
42
  data.qpos[obj_start+3:obj_start+7] = quat
43
  data.qvel[i*6:i*6+6] = 0
44
 
 
 
 
 
45
  # Renderer setup
46
  renderer = mujoco.Renderer(model, width=480, height=480) # width=640, height=640
47