You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the ir-sim to randomize the environment on every restart. There is some functionality that really helps with that, like setting goal and state functions. Especially useful is the random_obstacle_position() that randomizes the positions of the obstacles. However, there are some obstacles that I would like to remain in constant position throughout the execution. Currently the random_obstacle_position() does not take in arguments that would help to set position for some obstacles but not others. My proposal is to pass in a list of IDs of obstacles for which to randomize the position. I think this could be quite useful to others as well. Locally, I have implemented it as follows:
defrandom_obstacle_position(
self, range_low=[0, 0, -3.14], range_high=[10, 10, 3.14], ids= []
):
""" Random obstacle positions in the environment. Args: range_low (list [x, y, theta]): Lower bound of the random range for the obstacle states. Default is [0, 0, -3.14]. range_high (list [x, y, theta]): Upper bound of the random range for the obstacle states. Default is [10, 10, 3.14]. ids (list): A list of IDs of objects for which to set random positions """ifnotlen(ids):
ids= [obs._idforobsinself.obstacle_list]
ifisinstance(range_low, list):
range_low=np.c_[range_low]
ifisinstance(range_high, list):
range_high=np.c_[range_high]
random_states=np.random.uniform(
range_low, range_high, (3, self.obstacle_number)
)
fori, objinenumerate(self.obstacle_list):
ifobj._idinids:
obj.set_state(random_states[:, i].reshape(3, 1), init=True)
self._env_plot.clear_components("all", self.obstacle_list)
self._env_plot.draw_components("all", self.obstacle_list)
The text was updated successfully, but these errors were encountered:
Hi,
I am using the ir-sim to randomize the environment on every restart. There is some functionality that really helps with that, like setting goal and state functions. Especially useful is the
random_obstacle_position()
that randomizes the positions of the obstacles. However, there are some obstacles that I would like to remain in constant position throughout the execution. Currently therandom_obstacle_position()
does not take in arguments that would help to set position for some obstacles but not others. My proposal is to pass in a list of IDs of obstacles for which to randomize the position. I think this could be quite useful to others as well. Locally, I have implemented it as follows:The text was updated successfully, but these errors were encountered: