Skip to content

Commit 962ea24

Browse files
committed
Override xml path.
1 parent 0c0bb38 commit 962ea24

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

flybody/fruitfly/fruitfly.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ class FruitFly(legacy_base.Walker):
123123
def _build(
124124
self,
125125
name: str = 'walker',
126+
xml_path: str | None = None,
126127
use_legs: bool = True,
127128
use_wings: bool = False,
128129
use_mouth: bool = False,
@@ -143,6 +144,7 @@ def _build(
143144
144145
Args:
145146
name: Name of the walker.
147+
xml_path: Path to the fruitfly XML file. Defaults to assets/fruitfly.xml.
146148
use_legs: Whether to use or retract the legs.
147149
use_wings: Whether to use or retract the wings.
148150
use_mouth: Whether to use or retract the mouth.
@@ -169,12 +171,14 @@ def _build(
169171
eye_camera_size: Size in pixels (height and width) of the eye cameras.
170172
Height and width are assumed equal.
171173
"""
174+
if xml_path is None:
175+
xml_path = _XML_PATH
172176
self._use_wings = use_wings
173177
self._adhesion_filter = adhesion_filter
174178
self._control_timestep = control_timestep
175179
self._buffer_size = int(round(control_timestep / physics_timestep))
176180
self._eye_camera_size = eye_camera_size
177-
root = mjcf.from_path(_XML_PATH)
181+
root = mjcf.from_path(xml_path)
178182
self._mjcf_root = root
179183
if name:
180184
self._mjcf_root.model = name

0 commit comments

Comments
 (0)