Skip to content

Commit

Permalink
reward for being in flight zone
Browse files Browse the repository at this point in the history
  • Loading branch information
jjshoots committed Sep 19, 2024
1 parent 2258985 commit 32fdfc1
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions PyFlyt/pz_envs/fixedwing_envs/ma_fixedwing_dogfight_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,18 +615,16 @@ def _compute_boundary_rewards(self) -> np.ndarray:
boundary_rewards = np.zeros((self.num_possible_agents,), dtype=np.float32)

if not self.sparse_reward:
# too close to floor
boundary_rewards -= (
3.0
* (self.attitudes[:, -1, -1] < 10.0)
* (10.0 - self.attitudes[:, -1, -1])
# too close to floor, add reward to encourage being above flight floor
boundary_rewards += (
2.0
* (self.attitudes[:, -1, -1] > 10.0)
)

# too close to out of bounds
boundary_rewards -= (
0.02
* (self.distances_from_origin > (0.75 * self.flight_dome_size))
* (self.distances_from_origin - (0.75 * self.flight_dome_size))
# too close to out of bounds, add reward to encourage being near center
boundary_rewards += (
2.0
* (self.distances_from_origin < (0.75 * self.flight_dome_size))
)

# reward for being too close to anyone, minus diagonal to ignore self
Expand Down

0 comments on commit 32fdfc1

Please sign in to comment.