diff --git a/gym_pybullet_drones/envs/LeaderFollowerAviary.py b/gym_pybullet_drones/envs/LeaderFollowerAviary.py index 171b641ba..ad7143679 100644 --- a/gym_pybullet_drones/envs/LeaderFollowerAviary.py +++ b/gym_pybullet_drones/envs/LeaderFollowerAviary.py @@ -55,7 +55,7 @@ def __init__(self, """ self.TARGET_POS = np.array([0,0,1]) - self.EPISODE_LEN_SEC = 5 + self.EPISODE_LEN_SEC = 8 super().__init__(drone_model=drone_model, num_drones=num_drones, neighbourhood_radius=neighbourhood_radius, @@ -82,9 +82,9 @@ def _computeReward(self): """ states = np.array([self._getDroneStateVector(i) for i in range(self.NUM_DRONES)]) - ret = max(0, 10 - np.linalg.norm(self.TARGET_POS-states[0, 0:3])**4) + ret = max(0, 2 - np.linalg.norm(self.TARGET_POS-states[0, 0:3])**4) for i in range(1, self.NUM_DRONES): - ret += max(0, 10 - np.linalg.norm(states[i-1, 3]-states[i, 3])**4) + ret += max(0, 2 - np.linalg.norm(states[i-1, 3]-states[i, 3])**4) return ret ################################################################################ diff --git a/gym_pybullet_drones/examples/learn.py b/gym_pybullet_drones/examples/learn.py index 397d5fbf6..fe512cf61 100644 --- a/gym_pybullet_drones/examples/learn.py +++ b/gym_pybullet_drones/examples/learn.py @@ -88,7 +88,7 @@ def run(multiagent=DEFAULT_MA, output_folder=DEFAULT_OUTPUT_FOLDER, gui=DEFAULT_ if not multiagent: steps = 2 * int(1e5) else: - steps = int(1e6) + steps = int(1e4) model.learn(total_timesteps=steps, callback=eval_callback, log_interval=100) @@ -131,7 +131,7 @@ def run(multiagent=DEFAULT_MA, output_folder=DEFAULT_OUTPUT_FOLDER, gui=DEFAULT_ record=record_video) test_env_nogui = LeaderFollowerAviary(num_drones=DEFAULT_AGENTS, obs=DEFAULT_OBS, act=DEFAULT_ACT) logger = Logger(logging_freq_hz=int(test_env.CTRL_FREQ), - num_drones=DEFAULT_AGENTS if DEFAULT_MA else 1, + num_drones=DEFAULT_AGENTS if multiagent else 1, output_folder=output_folder, colab=colab )