|
|
|
@ -291,6 +291,8 @@ class sprint(gym.Env):
|
|
|
|
|
dir_y = (y - self.Gen_player_pos[1]) / abs (y - self.Gen_player_pos[1])
|
|
|
|
|
x = x + 5 * dir_x
|
|
|
|
|
y = y + 5 * dir_y
|
|
|
|
|
x = np.clip(x, -15, 15)
|
|
|
|
|
y = np.clip(y, -15, 15)
|
|
|
|
|
self.walk_target = np.array([x, y])
|
|
|
|
|
def step(self, action):
|
|
|
|
|
|
|
|
|
@ -341,7 +343,7 @@ class sprint(gym.Env):
|
|
|
|
|
direction_error = abs(self.walk_rel_orientation)
|
|
|
|
|
direction_error = min(direction_error, 10)
|
|
|
|
|
reward = robot_speed * (1.5 - direction_error / 10)
|
|
|
|
|
if self.walk_distance < 1:
|
|
|
|
|
if self.walk_distance < 0.5:
|
|
|
|
|
reward += 20
|
|
|
|
|
self.generate_random_target()
|
|
|
|
|
|
|
|
|
|