render flag bug is fixed

This commit is contained in:
Rooholla-KhorramBakht 2024-06-02 19:36:54 -04:00
parent 4922a44251
commit 6b3e6e242f
1 changed files with 8 additions and 4 deletions

View File

@ -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()