Commit 29fbda64 authored by Ibrahim Ahmed's avatar Ibrahim Ahmed
Browse files

bugfix in from_space()

parent 0786a06c
Loading
Loading
Loading
Loading
+11 −3
Changes for env.py: 11 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -118,12 +118,20 @@ class BOPTestEnv(gym.Env):
            of the dimension in state or action space.
        """
        if which in ('state', self.states, self.observation_space):
            return {name: value for name, value in zip(self.states.keys(), action)}
            return {name: value for name, value in zip(self.states.keys(), s)}
        elif which in('action', self.actions, self.action_space):
            return {name: value for name, value in zip(self.actions.keys(), action)}
            return {name: value for name, value in zip(self.actions.keys(), s)}

    
    def reset(self):
    def reset(self) -> np.ndarray:
        """
        Resets the environment and returns its state.
        
        Returns
        -------
        np.ndarray
            The state vector of the system.
        """
        requests.put(self.url + 'reset')
        self.time_ = 0
        self.state_, _, _, _ = self.step(action=self.action_space.sample())