|
|
|
@ -285,12 +285,12 @@ class sprint(gym.Env):
|
|
|
|
|
def generate_random_target(self, position):
|
|
|
|
|
while True:
|
|
|
|
|
angle = np.random.uniform(0, 2 * np.pi)
|
|
|
|
|
X = position[0] * 10 * np.cos(angle)
|
|
|
|
|
Y = position[1] * 10 * np.sin(angle)
|
|
|
|
|
if -13 <= X <= 13 and -8 <= Y <= 8:
|
|
|
|
|
x = position[0] + 10 * np.cos(angle)
|
|
|
|
|
y = position[1] + 10 * np.sin(angle)
|
|
|
|
|
if -13 <= x <= 13 and -8 <= y <= 8:
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
self.walk_target = np.array([X, Y])
|
|
|
|
|
self.walk_target = np.array([x, y])
|
|
|
|
|
|
|
|
|
|
def step(self, action):
|
|
|
|
|
|
|
|
|
@ -362,9 +362,9 @@ class Train(Train_Base):
|
|
|
|
|
def train(self, args):
|
|
|
|
|
|
|
|
|
|
# --------------------------------------- Learning parameters
|
|
|
|
|
n_envs = min(10, os.cpu_count())
|
|
|
|
|
n_envs = min(12, os.cpu_count())
|
|
|
|
|
n_steps_per_env = 1024 # RolloutBuffer is of size (n_steps_per_env * n_envs)
|
|
|
|
|
minibatch_size = 256 # should be a factor of (n_steps_per_env * n_envs)
|
|
|
|
|
minibatch_size = 64 # should be a factor of (n_steps_per_env * n_envs)
|
|
|
|
|
total_steps = 50000000
|
|
|
|
|
learning_rate = 3e-4
|
|
|
|
|
folder_name = f'Sprint_R{self.robot_type}'
|
|
|
|
|