Skip to content
Snippets Groups Projects
Commit 0b18e5ed authored by Erik Nygren's avatar Erik Nygren :bullettrain_front:
Browse files

this adresses isse #264.

Fixed how we handle agents off the grid with the observation example
parent 49bda6d3
No related branches found
No related tags found
2 merge requests!251264 fixed examples branch 2,!249264 fixing examples
Pipeline #2626 passed
......@@ -34,8 +34,11 @@ class SingleAgentNavigationObs(ObservationBuilder):
def get(self, handle: int = 0) -> List[int]:
agent = self.env.agents[handle]
if agent.position:
possible_transitions = self.env.rail.get_transitions(*agent.position, agent.direction)
else:
possible_transitions = self.env.rail.get_transitions(*agent.initial_position, agent.direction)
possible_transitions = self.env.rail.get_transitions(*agent.position, agent.direction)
num_transitions = np.count_nonzero(possible_transitions)
# Start from the current orientation, and see which transitions are available;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment