Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[adroit ]Minor Cleanup: assignment of goal_achieved #205

Merged
merged 5 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gymnasium_robotics/envs/adroit_hand/adroit_door.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gymnasium_robotics/envs/adroit_hand/adroit_hammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions gymnasium_robotics/envs/adroit_hand/adroit_pen.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gymnasium_robotics/envs/adroit_hand/adroit_relocate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading