Skip to content

Commit

Permalink
fix type nnumbers; remove dynamic setting for action spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
OliEfr committed Aug 6, 2024
1 parent 58fc374 commit cb26731
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions loco_mujoco/environments/gymnasium.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ def __init__(self, env_name, render_mode=None, **kwargs):
self._env = LocoEnv.make(env_name, **kwargs)

self.observation_space = self._convert_space(self._env.info.observation_space)
self._set_action_space()

self.action_space = self._convert_space(self._env.info.action_space)

def step(self, action):
"""
Expand Down Expand Up @@ -160,7 +159,4 @@ def _convert_space(space):
low = np.min(space.low)
high = np.max(space.high)
shape = space.shape
return Box(low, high, shape, np.float64)

def _set_action_space(self):
return self._convert_space(self._env.info.action_space)
return Box(low, high, shape, np.float64)
2 changes: 1 addition & 1 deletion loco_mujoco/environments/humanoids/base_humanoid_4_ages.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def setup(self, obs):
sample = self.trajectories.reset_trajectory()
elif self._init_step_no is not None:
traj_len = self.trajectories.trajectory_length
n_traj = self.trajectories.nnumber_of_trajectories
n_traj = self.trajectories.number_of_trajectories
assert self._init_step_no <= traj_len * n_traj
substep_no = int(self._init_step_no % traj_len)
traj_no = int(self._init_step_no / traj_len)
Expand Down
2 changes: 1 addition & 1 deletion loco_mujoco/environments/quadrupeds/unitreeA1.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def setup(self, obs):
sample = rotate_obs(sample, angle, *self._get_relevant_idx_rotation())
elif self._init_step_no is not None:
traj_len = self.trajectories.trajectory_length
n_traj = self.trajectories.nnumber_of_trajectories
n_traj = self.trajectories.number_of_trajectories
assert self._init_step_no <= traj_len * n_traj
substep_no = int(self._init_step_no % traj_len)
traj_no = int(self._init_step_no / traj_len)
Expand Down

0 comments on commit cb26731

Please sign in to comment.