Skip to content
Snippets Groups Projects
Commit c4e002cc authored by Erik Nygren's avatar Erik Nygren
Browse files

fixed rendering bug where position was not updated

parent 1a3fc65e
No related branches found
No related tags found
No related merge requests found
......@@ -195,6 +195,8 @@ class RailEnv(Environment):
# for i in range(len(self.agents_handles)):
for iAgent in range(self.get_num_agents()):
agent = self.agents[iAgent]
agent.old_direction = agent.direction
agent.old_position = agent.position
if self.dones[iAgent]: # this agent has already completed...
continue
......@@ -283,8 +285,6 @@ class RailEnv(Environment):
self._check_action_on_agent(agent.speed_data['transition_action_on_cellexit'], agent)
if all([new_cell_isValid, transition_isValid, cell_isFree]):
agent.old_direction = agent.direction
agent.old_position = agent.position
agent.position = new_position
agent.direction = new_direction
agent.speed_data['position_fraction'] = 0.0
......
......@@ -38,7 +38,7 @@ class RenderTool(object):
gTheta = np.linspace(0, np.pi / 2, 5)
gArc = array([np.cos(gTheta), np.sin(gTheta)]).T # from [1,0] to [0,1]
def __init__(self, env, gl="PILSVG", jupyter=False, agentRenderVariant=AgentRenderVariant.AGENT_SHOWS_OPTIONS):
def __init__(self, env, gl="PILSVG", jupyter=False, agentRenderVariant=AgentRenderVariant.ONE_STEP_BEHIND):
self.env = env
self.iFrame = 0
self.time1 = time.time()
......
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