Environment/LASROMEnv.py
def step(self, action):
        """
        Take one step of interaction.

        Parameters
        ----------
        action:  x,y,z,radius,threshold,intensity
        range:
        x [-7.5 7.5]
        y [-5, 5]
        z   [0 2]
        radius = [0 2]
        threshold = [0,5]
        intensity = [0,1]

        Returns
        -------
        observation: ndarray
            obervation of environment after taking an action
        reward: float
            reward after taking an action
        done: bool
            whether simulation is done or not.
        info:
            some information for debugging
        """

        # Action is performed through Behaviour
        x = action[0]*7.5
        y = action[1]*5.0
        z = action[2] + 1.0
        radius = action[3] + 1.0
        threshold = action[4]*2.5 + 2.5
        intensity = action[5]*0.5 + 0.5

        self.behaviour.act([x,y,z,radius,threshold,max(intensity,radius)]) # taking max() here is to make it consistant with the Behaviour class

        # Visualize excitor
        # self._set_excitor_pos_and_size("Excitor", threshold, [x,y,z])

        # move the visitor based on observations one step ago
        # self._move_single_to_excitor_location(self.observation, isBody=True)
        self._move_to_excitor_location(self.observation)

        time.sleep(0.01)
        # Observe current state
        try:
            self.observation = self._self_observe()
        except ValueError:
            self._nanObervationFlag = 1
            print("Observation has NAN value.")
       # Caculate reward
       # self.reward = self._reward(self.observation)

        # Therefore, it's only used for tunning hyper-parameters of LASAgent
        if self.reward_function_type == 'ir':
            self.reward = self._reward_ir(self.observation)
        elif self.reward_function_type == 'actuator_intensity':
            self.reward = self._reward_actuator_intensity(self.observation)
        else:
            raise ValueError('No reward function: {}'.format(self.reward_function_type))


        done = False
        info = []
        observation = self.observation[0:self.prox_sensor_num] # return only proximity sensor
        return observation, self.reward, done, info

        Take one step of interaction.

        Parameters
        ----------
        action:  x,y,z,radius,threshold,intensity
        range:
        x [-7.5 7.5]
        y [-5, 5]
        z   [0 2]
        radius = [0 2]
        threshold = [0,5]
        intensity = [0,1]

        Returns
        -------
        observation: ndarray
            obervation of environment after taking an action
        reward: float
            reward after taking an action
        done: bool
            whether simulation is done or not.
        info:
            some information for debugging
        
Take one step of interaction.
Parameters



Returns

ndarray
obervation of environment after taking an action
reward: float
reward after taking an action
done: bool
whether simulation is done or not.
info:
some information for debugging
Take one step of interaction . Parameters Returns ndarray obervation of environment after taking an action reward : float reward after taking an action done : bool whether simulation is done or not . info : some information for debugging
def step(self, action):
        x = action[0]*7.5
        y = action[1]*5.0
        z = action[2] + 1.0
        radius = action[3] + 1.0
        threshold = action[4]*2.5 + 2.5
        intensity = action[5]*0.5 + 0.5
        self.behaviour.act([x,y,z,radius,threshold,max(intensity,radius)]) 
        self._move_to_excitor_location(self.observation)
        time.sleep(0.01)
        try:
            self.observation = self._self_observe()
        except ValueError:
            self._nanObervationFlag = 1
            print("Observation has NAN value.")
        if self.reward_function_type == 'ir':
            self.reward = self._reward_ir(self.observation)
        elif self.reward_function_type == 'actuator_intensity':
            self.reward = self._reward_actuator_intensity(self.observation)
        else:
            raise ValueError('No reward function: {}'.format(self.reward_function_type))
        done = False
        info = []
        observation = self.observation[0:self.prox_sensor_num] 
        return observation, self.reward, done, info
def step ( self , action ) : x = action [ 0 ] * 7.5 y = action [ 1 ] * 5.0 z = action [ 2 ] + 1.0 radius = action [ 3 ] + 1.0 threshold = action [ 4 ] * 2.5 + 2.5 intensity = action [ 5 ] * 0.5 + 0.5 self . behaviour . act ( [ x , y , z , radius , threshold , max ( intensity , radius ) ] ) self . _move_to_excitor_location ( self . observation ) time . sleep ( 0.01 ) try : self . observation = self . _self_observe ( ) except ValueError : self . _nanObervationFlag = 1 print ( "Observation has NAN value." ) if self . reward_function_type == 'ir' : self . reward = self . _reward_ir ( self . observation ) elif self . reward_function_type == 'actuator_intensity' : self . reward = self . _reward_actuator_intensity ( self . observation ) else : raise ValueError ( 'No reward function: {}' . format ( self . reward_function_type ) ) done = False info = [ ] observation = self . observation [ 0 : self . prox_sensor_num ] return observation , self . reward , done , info
Take one step of interaction.
Take one step of interaction .
"""
        Take one step of interaction.

        Parameters
        ----------
        action:  x,y,z,radius,threshold,intensity
        range:
        x [-7.5 7.5]
        y [-5, 5]
        z   [0 2]
        radius = [0 2]
        threshold = [0,5]
        intensity = [0,1]

        Returns
        -------
        observation: ndarray
            obervation of environment after taking an action
        reward: float
            reward after taking an action
        done: bool
            whether simulation is done or not.
        info:
            some information for debugging
        """ # Action is performed through Behaviour # taking max() here is to make it consistant with the Behaviour class # Visualize excitor # self._set_excitor_pos_and_size("Excitor", threshold, [x,y,z]) # move the visitor based on observations one step ago # self._move_single_to_excitor_location(self.observation, isBody=True) # Observe current state # Caculate reward # self.reward = self._reward(self.observation) # Therefore, it's only used for tunning hyper-parameters of LASAgent # return only proximity sensor
self
action