From 735cd3ca46fe419e49d2458b653fe1bbcaf3be0d Mon Sep 17 00:00:00 2001 From: Rooholla-KhorramBakht Date: Sat, 25 May 2024 21:04:47 -0400 Subject: [PATCH] custom xml loading argument is added. --- Go2Py/sim/mujoco.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Go2Py/sim/mujoco.py b/Go2Py/sim/mujoco.py index 3ecc1f8..ae2d202 100644 --- a/Go2Py/sim/mujoco.py +++ b/Go2Py/sim/mujoco.py @@ -18,11 +18,14 @@ dist = np.zeros(nray, np.float64) class Go2Sim: - def __init__(self, mode='lowlevel', render=True, dt=0.002): + def __init__(self, mode='lowlevel', render=True, dt=0.002, xml_path=None): - self.model = mujoco.MjModel.from_xml_path( - os.path.join(ASSETS_PATH, 'mujoco/go2.xml') - ) + if xml_path is None: + self.model = mujoco.MjModel.from_xml_path( + os.path.join(ASSETS_PATH, 'mujoco/go2.xml') + ) + else: + self.model = mujoco.MjModel.from_xml_path(xml_path) self.simulated = True self.data = mujoco.MjData(self.model) self.dt = dt