From 8dd76d0494f197f3900ad91d263fc7a6d185f610 Mon Sep 17 00:00:00 2001 From: MagDish <2717360869@qq.com> Date: Wed, 13 Nov 2024 20:02:07 +0800 Subject: [PATCH] new --- scripts/gyms/sprint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/gyms/sprint.py b/scripts/gyms/sprint.py index 1d1b0c1..93163c3 100644 --- a/scripts/gyms/sprint.py +++ b/scripts/gyms/sprint.py @@ -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()