Skip to content

Commit

Permalink
Adroit hand dense reward fixes
Browse files Browse the repository at this point in the history
* fix hand-to-object dense reward component sign in adroit hand door, hammer, and relocate scenarios
  • Loading branch information
7oponaut committed Jul 4, 2024
1 parent 0a213bb commit 4bcb801
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
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 @@ -294,7 +294,7 @@ def step(self, a):
palm_pos = self.data.site_xpos[self.grasp_site_id].ravel()

# get to handle
reward = 0.1 * np.linalg.norm(palm_pos - handle_pos)
reward = -0.1 * np.linalg.norm(palm_pos - handle_pos)
# open door
reward += -0.1 * (goal_distance - 1.57) * (goal_distance - 1.57)
# velocity cost
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 @@ -305,7 +305,7 @@ def step(self, a):
# override reward if not sparse reward
if not self.sparse_reward:
# get the palm to the hammer handle
reward = 0.1 * np.linalg.norm(palm_pos - hamm_pos)
reward = -0.1 * np.linalg.norm(palm_pos - hamm_pos)
# take hammer head to nail
reward -= np.linalg.norm(head_pos - nail_pos)
# make nail go inside
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 @@ -294,7 +294,7 @@ def step(self, a):

# override reward if not sparse reward
if not self.sparse_reward:
reward = 0.1 * np.linalg.norm(palm_pos - obj_pos) # take hand to object
reward = -0.1 * np.linalg.norm(palm_pos - obj_pos) # take hand to object
if obj_pos[2] > 0.04: # if object off the table
reward += 1.0 # bonus for lifting the object
reward += -0.5 * np.linalg.norm(
Expand Down

0 comments on commit 4bcb801

Please sign in to comment.