From 6b3e6e242f58a168cd2c2b9c3a84391d006ea38c Mon Sep 17 00:00:00 2001 From: Rooholla-KhorramBakht Date: Sun, 2 Jun 2024 19:36:54 -0400 Subject: [PATCH] render flag bug is fixed --- Go2Py/sim/mujoco.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Go2Py/sim/mujoco.py b/Go2Py/sim/mujoco.py index 39f5ae5..0ef1829 100644 --- a/Go2Py/sim/mujoco.py +++ b/Go2Py/sim/mujoco.py @@ -68,7 +68,8 @@ class Go2Sim: self.rot0 = np.array([1., 0., 0., 0.]) self.reset() mujoco.mj_step(self.model, self.data) - self.viewer.sync() + if self.render: + self.viewer.sync() self.nv = self.model.nv self.jacp = np.zeros((3, self.nv)) self.jacr = np.zeros((3, self.nv)) @@ -117,7 +118,8 @@ class Go2Sim: self.rot0 = np.array([1., 0., 0., 0.]) self.reset() mujoco.mj_step(self.model, self.data) - self.viewer.sync() + if self.render: + self.viewer.sync() def sitDownReset(self): self.q0 = self.sitting_q @@ -125,7 +127,8 @@ class Go2Sim: self.rot0 = np.array([1., 0., 0., 0.]) self.reset() mujoco.mj_step(self.model, self.data) - self.viewer.sync() + if self.render: + self.viewer.sync() def getJointStates(self): return {"q": self.data.qpos[7:], @@ -237,4 +240,5 @@ class Go2Sim: return False def close(self): - self.viewer.close() + if self.render: + self.viewer.close()