Skip to content

Commit 8da298d

Browse files
committed
add flag for sleeping
1 parent 9548a5a commit 8da298d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

robosuite/models/world.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@
77
class MujocoWorldBase(MujocoXML):
88
"""Base class to inherit all mujoco worlds from."""
99

10-
def __init__(self, enable_multiccd=False):
10+
def __init__(self, enable_multiccd=False, enable_sleeping=False):
1111
super().__init__(xml_path_completion("base.xml"))
1212
# Modify the simulation timestep to be the requested value
1313
options = find_elements(root=self.root, tags="option", attribs=None, return_first=True)
1414
options.set("timestep", convert_to_string(macros.SIMULATION_TIMESTEP))
1515
self.enable_multiccd = enable_multiccd
16+
self.enable_sleeping = enable_sleeping
1617
if self.enable_multiccd:
1718
multiccd_elem = ET.fromstring(
1819
"""<option> <flag multiccd="enable"/> </option>"""
1920
)
2021
mujoco_elem = find_elements(self.root, "mujoco")
2122
mujoco_elem.insert(0, multiccd_elem)
23+
if self.enable_sleeping:
24+
sleeping_elem = ET.fromstring(
25+
"""<option> <flag sleep="enable"/> </option>"""
26+
)
27+
mujoco_elem = find_elements(self.root, "mujoco")
28+
mujoco_elem.insert(0, sleeping_elem)
2229

0 commit comments

Comments
 (0)