Skip to content

Commit

Permalink
signature for compute_reward
Browse files Browse the repository at this point in the history
  • Loading branch information
qgallouedec committed Jun 10, 2024
1 parent 0d17e18 commit ea82d34
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion panda_gym/envs/tasks/flip.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info:
d = angle_distance(achieved_goal, desired_goal)
return np.array(d < self.distance_threshold, dtype=bool)

def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray:
def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray:
d = angle_distance(achieved_goal, desired_goal)
if self.reward_type == "sparse":
return -np.array(d > self.distance_threshold, dtype=np.float32)
Expand Down
2 changes: 1 addition & 1 deletion panda_gym/envs/tasks/pick_and_place.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info:
d = distance(achieved_goal, desired_goal)
return np.array(d < self.distance_threshold, dtype=bool)

def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray:
def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray:
d = distance(achieved_goal, desired_goal)
if self.reward_type == "sparse":
return -np.array(d > self.distance_threshold, dtype=np.float32)
Expand Down
2 changes: 1 addition & 1 deletion panda_gym/envs/tasks/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info:
d = distance(achieved_goal, desired_goal)
return np.array(d < self.distance_threshold, dtype=bool)

def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray:
def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray:
d = distance(achieved_goal, desired_goal)
if self.reward_type == "sparse":
return -np.array(d > self.distance_threshold, dtype=np.float32)
Expand Down
2 changes: 1 addition & 1 deletion panda_gym/envs/tasks/reach.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info:
d = distance(achieved_goal, desired_goal)
return np.array(d < self.distance_threshold, dtype=bool)

def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray:
def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray:
d = distance(achieved_goal, desired_goal)
if self.reward_type == "sparse":
return -np.array(d > self.distance_threshold, dtype=np.float32)
Expand Down
2 changes: 1 addition & 1 deletion panda_gym/envs/tasks/slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info:
d = distance(achieved_goal, desired_goal)
return np.array(d < self.distance_threshold, dtype=bool)

def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray:
def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray:
d = distance(achieved_goal, desired_goal)
if self.reward_type == "sparse":
return -np.array(d > self.distance_threshold, dtype=np.float32)
Expand Down
2 changes: 1 addition & 1 deletion panda_gym/envs/tasks/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def is_success(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info:
d = distance(achieved_goal, desired_goal)
return np.array((d < self.distance_threshold), dtype=bool)

def compute_reward(self, achieved_goal, desired_goal, info: Dict[str, Any]) -> np.ndarray:
def compute_reward(self, achieved_goal: np.ndarray, desired_goal: np.ndarray, info: Dict[str, Any] = {}) -> np.ndarray:
d = distance(achieved_goal, desired_goal)
if self.reward_type == "sparse":
return -np.array((d > self.distance_threshold), dtype=np.float32)
Expand Down

0 comments on commit ea82d34

Please sign in to comment.