Skip to content

Commit bc17a99

Browse files
committed
Fix track loading for mujoco>=3.3.0
1 parent 831abda commit bc17a99

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lsy_drone_racing/envs/race_core.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,19 @@ def _load_track_into_sim(self, gate_spec: MjSpec, obstacle_spec: MjSpec):
563563
frame = self.sim.spec.worldbody.add_frame()
564564
n_gates, n_obstacles = len(self.gates["pos"]), len(self.obstacles["pos"])
565565
for i in range(n_gates):
566-
gate = frame.attach_body(gate_spec.find_body("gate"), "", f":{i}")
566+
gate_body = gate_spec.body("gate")
567+
if gate_body is None:
568+
raise ValueError("Gate body not found in gate spec")
569+
gate = frame.attach_body(gate_body, "", f":{i}")
567570
gate.pos = self.gates["pos"][i]
568571
# Convert from scipy order to MuJoCo order
569572
gate.quat = self.gates["quat"][i][[3, 0, 1, 2]]
570573
gate.mocap = True # Make mocap to modify the position of static bodies during sim
571574
for i in range(n_obstacles):
572-
obstacle = frame.attach_body(obstacle_spec.find_body("obstacle"), "", f":{i}")
575+
obstacle_body = obstacle_spec.body("obstacle")
576+
if obstacle_body is None:
577+
raise ValueError("Obstacle body not found in obstacle spec")
578+
obstacle = frame.attach_body(obstacle_body, "", f":{i}")
573579
obstacle.pos = self.obstacles["pos"][i]
574580
obstacle.mocap = True
575581
self.sim.build(data=False, default_data=False)

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ classifiers = [
1919
"Intended Audience :: Science/Research",
2020
]
2121

22+
# TODO: Include crazyflow once it's installable via pip
2223
dependencies = [
2324
"fire >= 0.6.0",
2425
"numpy >= 1.24.1, < 2.0.0",

0 commit comments

Comments
 (0)