aidudezzz / deepworlds

Examples and use cases using the deepbots framework (https://github.com/aidudezzz/deepbots) with the Webots robot simulator.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A thinking of observation window

speedhawk opened this issue · comments

Hi, I am learning the 'finding and avoiding v2' implementation to improve my own project. I notice that there are two variables 'step window' and 'second window' and this is the original code for what it should be:

...
:param step_window: How many steps of observations to add in the observation window, defaults to 1
:type step_window: int, optional
:param seconds_window: How many seconds of observations to add in the observation window, defaults to 1
:type seconds_window: int, optional
...

And how the maximum and minimum vector of observation should be defined based on these two variables:

...
self.single_obs_size = len(single_obs_low)
obs_low = []
obs_high = []
for _ in range(self.step_window + self.seconds_window):
    obs_low.extend(single_obs_low)
    obs_high.extend(single_obs_high)
    self.obs_list.extend([0.0 for _ in range(self.single_obs_size)])
# Memory is used for creating the windows in get_observation()
self.obs_memory = [[0.0 for _ in range(self.single_obs_size)]
                   for _ in range((self.seconds_window * int(np.ceil(1000 / self.timestep))) +
                                  self.step_window)]
self.observation_counter_limit = int(np.ceil(1000 / self.timestep))
self.observation_counter = self.observation_counter_limit
...

According to the comment and the corresponding code, it seems that the two 'window' variable can be used to expand memory batch size or even expend the size of the two assignment vectors (obs_low and obs_high) of the space class Box(). However, I still have no idea about why it is necessary for expanding the vector size and acheiving the batch size like this. Therefore, could you please enlighten me on the correct perceptive to construct these two variables and deploy them? Many thanks!