Skip to content

Commit

Permalink
Merge pull request #247 from elladyr/fix_loco_obs
Browse files Browse the repository at this point in the history
BUGFIX: Fix mc24 loco obs helper functions
  • Loading branch information
elladyr authored Sep 27, 2024
2 parents d0a667b + 0f6b1e4 commit ba63e88
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions myosuite/envs/myo/myochallenge/run_track_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ def get_obs_dict(self, sim):
obs_dict['terrain'] = np.array([self.terrain_type])

# proprioception
obs_dict['internal_qpos'] = self.get_internal_qpos() #sim.data.qpos[7:].copy()
obs_dict['internal_qvel'] = self.get_internal_qvel() #sim.data.qvel[6:].copy() * self.dt
obs_dict['internal_qpos'] = self.get_internal_qpos()
obs_dict['internal_qvel'] = self.get_internal_qvel()
obs_dict['grf'] = self._get_grf().copy()
obs_dict['socket_force'] = self._get_socket_force().copy()
obs_dict['torso_angle'] = self.sim.data.body('pelvis').xquat.copy()
Expand Down Expand Up @@ -533,6 +533,7 @@ def get_internal_qpos(self):
counter = 0
for jnt in self.biological_jnt:
temp_qpos[counter] = self.sim.data.joint(jnt).qpos[0].copy()
counter+=1
return temp_qpos

def get_internal_qvel(self):
Expand All @@ -543,6 +544,7 @@ def get_internal_qvel(self):
counter = 0
for jnt in self.biological_jnt:
temp_qvel[counter] = self.sim.data.joint(jnt).qvel[0].copy()
counter+=1
return temp_qvel * self.dt

def muscle_lengths(self):
Expand All @@ -553,6 +555,7 @@ def muscle_lengths(self):
counter = 0
for jnt in self.biological_act:
temp_len[counter] = self.sim.data.actuator(jnt).length[0].copy()
counter+=1
return temp_len

def muscle_forces(self):
Expand All @@ -563,6 +566,7 @@ def muscle_forces(self):
counter = 0
for jnt in self.biological_act:
temp_frc[counter] = self.sim.data.actuator(jnt).force[0].copy()
counter+=1

return np.clip(temp_frc / 1000, -100, 100)

Expand All @@ -574,6 +578,7 @@ def muscle_velocities(self):
counter = 0
for jnt in self.biological_act:
temp_vel[counter] = self.sim.data.actuator(jnt).velocity[0].copy()
counter+=1

return np.clip(temp_vel, -100, 100)

Expand Down

0 comments on commit ba63e88

Please sign in to comment.