Skip to content
Snippets Groups Projects
Commit fd1eafda authored by Egli Adrian (IT-SCI-API-PFI)'s avatar Egli Adrian (IT-SCI-API-PFI)
Browse files

scene more railway realistic

parent 9efa12c2
No related branches found
No related tags found
No related merge requests found
No preview for this file type
...@@ -140,9 +140,14 @@ class Demo: ...@@ -140,9 +140,14 @@ class Demo:
# Action # Action
for iAgent in range(self.env.get_num_agents()): for iAgent in range(self.env.get_num_agents()):
action = 2 action = 2
agent = self.env.agents[iAgent] if False:
if not self.env.check_action(agent, action)[1]: agent = self.env.agents[iAgent]
action = np.random.choice(self.action_size) trial = 0
while not self.env.check_action(agent, action)[1]:
action = np.random.choice(self.action_size)
trial += 1
if trial > 10:
break
action_dict.update({iAgent: action}) action_dict.update({iAgent: action})
self.renderer.renderEnv(show=True, action_dict=action_dict) self.renderer.renderEnv(show=True, action_dict=action_dict)
......
...@@ -769,7 +769,7 @@ class RenderTool(object): ...@@ -769,7 +769,7 @@ class RenderTool(object):
self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor) self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction, color=oColor)
else: else:
print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction) print("invalid action - agent ", iAgent, " bend ", agent.direction, new_direction)
self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction) # self.gl.setAgentAt(iAgent, *agent.position, agent.direction, new_direction)
self.gl.show() self.gl.show()
for i in range(3): for i in range(3):
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "71dda738592e49abafe596b348dfc3a1", "model_id": "e86e118aa3dc4387857ec6bd80a1966b",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
...@@ -132,7 +132,7 @@ ...@@ -132,7 +132,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "b7c1f13e789747b5ac7b65eba3584752", "model_id": "48a4f97d8d1446f48314d9d72d733d98",
"version_major": 2, "version_major": 2,
"version_minor": 0 "version_minor": 0
}, },
......
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