Skip to content

Commit

Permalink
Add initial and goal as argument #9
Browse files Browse the repository at this point in the history
  • Loading branch information
FranJNaranjo committed Dec 14, 2023
1 parent c347906 commit 75d3849
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions grippers/gymnasium_playground_grippers/envs/grippers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

class GrippersEnv(gym.Env):

def __init__(self, render_mode=None):
super(GrippersEnv, self).__init__()
def __init__(self, render_mode=None, init_angle=0., goal_angle=0.5):
#super(GrippersEnv, self).__init__()
"""
The environment emulates two grippers,
wher the second one have the capability to
Expand All @@ -19,17 +19,17 @@ def __init__(self, render_mode=None):
"""

# Initial position
self.initial_angle = np.zeros(1)
self.initial_angle = init_angle

# goal
self.goal_angle = 0.5
self.goal_angle = goal_angle

# set max vel
self.max_w = 0.1 # 0.3rad/step or 18grad/step
self.max_dif = self.goal_angle - self.initial_angle[0]
self.max_dif = self.goal_angle - self.initial_angle

# Status: angle of the second gripper
self.angle = np.zeros(1)
self.angle = 0.

# Define action space: angle increment (normalized)
self.action_space = spaces.Box(low = -1,
Expand All @@ -46,6 +46,7 @@ def __init__(self, render_mode=None):
def reset(self, seed=None):
super().reset(seed=seed)

self.max_dif = self.goal_angle - self.initial_angle
self.angle = np.copy(self.initial_angle)

observation = np.copy(self.angle)
Expand Down

0 comments on commit 75d3849

Please sign in to comment.