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

Editor add agent and move target error fixed

parent 4e1b3855
No related branches found
No related tags found
No related merge requests found
...@@ -96,6 +96,7 @@ class Demo: ...@@ -96,6 +96,7 @@ class Demo:
for iAgent in range(self.env.get_num_agents()): for iAgent in range(self.env.get_num_agents()):
# allways walk straight forward # allways walk straight forward
action = 2 action = 2
action = np.random.choice([0, 1, 2, 3], 1, p=[0.0, 0.5, 0.5, 0.0])[0]
# update the actions # update the actions
action_dict.update({iAgent: action}) action_dict.update({iAgent: action})
...@@ -161,7 +162,7 @@ class Demo: ...@@ -161,7 +162,7 @@ class Demo:
@staticmethod @staticmethod
def run_complex_scene(): def run_complex_scene():
demo_001 = Demo(Scenario_Generator.load_scenario('complex_scene.pkl')) demo_001 = Demo(Scenario_Generator.load_scenario('demo_001.pkl'))
demo_001.set_record_frames(os.path.join(__file_dirname__, '..', 'rendering', 'frame_{:04d}.bmp')) demo_001.set_record_frames(os.path.join(__file_dirname__, '..', 'rendering', 'frame_{:04d}.bmp'))
demo_001.run_demo(120) demo_001.run_demo(120)
......
...@@ -722,6 +722,7 @@ class EditorModel(object): ...@@ -722,6 +722,7 @@ class EditorModel(object):
agent_static = EnvAgentStatic(rcCell, 0, rcCell, moving=False) agent_static = EnvAgentStatic(rcCell, 0, rcCell, moving=False)
self.iSelectedAgent = self.env.add_agent_static(agent_static) self.iSelectedAgent = self.env.add_agent_static(agent_static)
self.player = None # will need to start a new player self.player = None # will need to start a new player
self.view.oRT.update_background()
else: else:
# Move the selected agent to this cell # Move the selected agent to this cell
agent_static = self.env.agents_static[self.iSelectedAgent] agent_static = self.env.agents_static[self.iSelectedAgent]
...@@ -745,6 +746,7 @@ class EditorModel(object): ...@@ -745,6 +746,7 @@ class EditorModel(object):
if self.iSelectedAgent is not None: if self.iSelectedAgent is not None:
self.env.agents_static[self.iSelectedAgent].target = rcCell self.env.agents_static[self.iSelectedAgent].target = rcCell
self.init_agents_static = None self.init_agents_static = None
self.view.oRT.update_background()
self.redraw() self.redraw()
def step(self): def step(self):
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
{ {
"data": { "data": {
"application/vnd.jupyter.widget-view+json": { "application/vnd.jupyter.widget-view+json": {
"model_id": "140f16d2c9a643e39d68c6421e50b9bd", "model_id": "485775e396784212ae3b33c820f3ec25",
"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