Skip to content

Commit

Permalink
hotfix walker2d energy cost
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasAlegre committed Oct 27, 2024
1 parent 311f378 commit b18a31c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mo_gymnasium/envs/mujoco/walker2d_v4.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self, **kwargs):
def step(self, action):
observation, reward, terminated, truncated, info = super().step(action)
velocity = info["x_velocity"]
neg_energy_cost = info["reward_ctrl"] / self._ctrl_cost_weight
neg_energy_cost = -np.sum(np.square(action))

vec_reward = np.array([velocity, neg_energy_cost], dtype=np.float32)

Expand Down
4 changes: 2 additions & 2 deletions mo_gymnasium/envs/mujoco/walker2d_v5.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def __init__(self, **kwargs):
def step(self, action):
observation, reward, terminated, truncated, info = super().step(action)
velocity = info["x_velocity"]
energy = -np.sum(np.square(action))
neg_energy_cost = info["reward_ctrl"] / self._ctrl_cost_weight

vec_reward = np.array([velocity, energy], dtype=np.float32)
vec_reward = np.array([velocity, neg_energy_cost], dtype=np.float32)

vec_reward += self.healthy_reward # All objectives are penalyzed when the agent falls

Expand Down

0 comments on commit b18a31c

Please sign in to comment.