diff --git a/gymnasium_robotics/envs/adroit_hand/adroit_door.py b/gymnasium_robotics/envs/adroit_hand/adroit_door.py index 3ea6b1b6..323222ab 100644 --- a/gymnasium_robotics/envs/adroit_hand/adroit_door.py +++ b/gymnasium_robotics/envs/adroit_hand/adroit_door.py @@ -282,7 +282,7 @@ def step(self, a): # compute the sparse reward variant first goal_distance = self.data.qpos[self.door_hinge_addrs] - goal_achieved = True if goal_distance >= 1.35 else False + goal_achieved = goal_distance >= 1.35 reward = 10.0 if goal_achieved else -0.1 # override reward if not sparse reward diff --git a/gymnasium_robotics/envs/adroit_hand/adroit_hammer.py b/gymnasium_robotics/envs/adroit_hand/adroit_hammer.py index 74abb5fa..8d4c6c0d 100644 --- a/gymnasium_robotics/envs/adroit_hand/adroit_hammer.py +++ b/gymnasium_robotics/envs/adroit_hand/adroit_hammer.py @@ -296,7 +296,7 @@ def step(self, a): # compute the sparse reward variant first goal_distance = np.linalg.norm(nail_pos - goal_pos) - goal_achieved = True if goal_distance < 0.01 else False + goal_achieved = goal_distance < 0.01 reward = 10.0 if goal_achieved else -0.1 # override reward if not sparse reward diff --git a/gymnasium_robotics/envs/adroit_hand/adroit_pen.py b/gymnasium_robotics/envs/adroit_hand/adroit_pen.py index baaebec5..5e0f6517 100644 --- a/gymnasium_robotics/envs/adroit_hand/adroit_pen.py +++ b/gymnasium_robotics/envs/adroit_hand/adroit_pen.py @@ -301,9 +301,7 @@ def step(self, a): # compute the sparse reward variant first goal_distance = np.linalg.norm(obj_pos - desired_loc) orien_similarity = np.dot(obj_orien, desired_orien) - goal_achieved = ( - True if (goal_distance < 0.075 and orien_similarity > 0.95) else False - ) + goal_achieved = goal_distance < 0.075 and orien_similarity > 0.95 reward = 10.0 if goal_achieved else -0.1 # goal_failed = obj_pos[2] < 0.075 diff --git a/gymnasium_robotics/envs/adroit_hand/adroit_relocate.py b/gymnasium_robotics/envs/adroit_hand/adroit_relocate.py index 08fecf48..8cb41138 100644 --- a/gymnasium_robotics/envs/adroit_hand/adroit_relocate.py +++ b/gymnasium_robotics/envs/adroit_hand/adroit_relocate.py @@ -286,7 +286,7 @@ def step(self, a): # compute the sparse reward variant first goal_distance = float(np.linalg.norm(obj_pos - target_pos)) - goal_achieved = True if goal_distance < 0.1 else False + goal_achieved = goal_distance < 0.1 reward = 10.0 if goal_achieved else -0.1 # override reward if not sparse reward