Skip to content

Commit

Permalink
fix some bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackory committed Jun 12, 2022
1 parent b9349f1 commit 046106d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions envs/JSBSim/core/simulatior.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,11 +445,11 @@ def run(self):
action, distance = self._guidance()
self._distance_increment.append(distance > self._distance_pre)
self._distance_pre = distance
if distance < self._Rc:
if distance < self._Rc and self.target_aircraft.is_alive:
self.__status = MissileSimulator.HIT
self.target_aircraft.shotdown()
elif (self._t > self._t_max) or (np.linalg.norm(self.get_velocity()) < self._v_min) \
or np.sum(self._distance_increment) >= self._distance_increment.maxlen:
or np.sum(self._distance_increment) >= self._distance_increment.maxlen or not self.target_aircraft.is_alive:
self.__status = MissileSimulator.MISS
else:
self._state_trans(action)
Expand Down
3 changes: 2 additions & 1 deletion test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ def test_env():
parallel_num = 1
envs = DummyVecEnv([lambda: SingleCombatEnv("1v1/ShootMissile/HierarchySelfplay") for _ in range(parallel_num)])

envs.reset()
# DataType test
obs_shape = (parallel_num, envs.num_agents, *envs.observation_space.shape)
# act_shape = (parallel_num, envs.num_agents, *envs.action_space.shape)
Expand Down Expand Up @@ -58,4 +59,4 @@ def test_multi_env():

envs.close()

test_env()
test_multi_env()

0 comments on commit 046106d

Please sign in to comment.