From 29854b2b5cf4af47959d77e5640198ac098c61b6 Mon Sep 17 00:00:00 2001 From: Dominik Roth Date: Wed, 29 Jun 2022 12:42:49 +0200 Subject: [PATCH] Extended output of StateObservable --- columbus/observables.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/columbus/observables.py b/columbus/observables.py index a2d3b18..fc6130b 100644 --- a/columbus/observables.py +++ b/columbus/observables.py @@ -209,7 +209,7 @@ class StateObservable(Observable): return self._entities def get_observation_space(self): - self.env.setup() + self.env.reset() num = len(self.entities)*2+len(self._timeoutEntities) + \ self.speedAgent + self.include_rand return spaces.Box(low=0-1*self.coordsRelativeToAgent, high=1, @@ -241,10 +241,17 @@ class StateObservable(Observable): return np.array(obs) def draw(self): + ofs = (0 + self.env.height/2*self.coordsRelativeToAgent, + 0 + self.env.width/2*self.coordsRelativeToAgent) + if self.coordsRelativeToAgent: + pygame.draw.circle(self.env.screen, self.env.agent.col, + (0, self.env.height/2), 3, width=0) + pygame.draw.circle(self.env.screen, self.env.agent.col, + (self.env.width/2, 0), 3, width=0) for i in range(int(len(self.obs)/2)): x, y = self.obs[i*2], self.obs[i*2+1] col = self.entities[i].col pygame.draw.circle(self.env.screen, col, - (0, y*self.env.height), 1, width=0) + (0, y*self.env.height+ofs[0]), 1, width=0) pygame.draw.circle(self.env.screen, col, - (x*self.env.width, 0), 1, width=0) + (x*self.env.width+ofs[1], 0), 1, width=0)