Skip to content

Commit

Permalink
Bug fix in logging
Browse files Browse the repository at this point in the history
  • Loading branch information
JacopoPan committed Nov 26, 2023
1 parent 2348440 commit c7bc897
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gym_pybullet_drones/envs/LeaderFollowerAviary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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

################################################################################
Expand Down
4 changes: 2 additions & 2 deletions gym_pybullet_drones/examples/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
)
Expand Down

0 comments on commit c7bc897

Please sign in to comment.