def __init__(self, config, gpu_count=0, texture=True, valid_locations=None, render_map=True, fixed_endpoints=False): HuskyNavigateEnv.__init__(self, config, gpu_count) self.use_valid_locations = valid_locations is not None self.fixed_endpoints = fixed_endpoints if self.use_valid_locations: print("Using valid locations!") self.valid_locations = self.get_valid_locations(valid_locations) self.n_locations = self.valid_locations.shape[0] self.target_distance_mu = self.config["target_distance_mu"] self.target_distance_sigma = self.config["target_distance_sigma"] self.min_target_x, self.max_target_x = self.config["x_target_range"] self.min_target_y, self.max_target_y = self.config["y_target_range"] self.min_agent_x, self.max_agent_x = self.config["x_boundary"] self.min_agent_y, self.max_agent_y = self.config["y_boundary"] self.min_spawn_x, self.max_spawn_x = self.config["x_spawn_range"] self.min_spawn_y, self.max_spawn_y = self.config["y_spawn_range"] self.default_z = self.config["initial_pos"][2] self.cube_size = 0.2 self.target_radius = 0.5 self.resolution = self.config["resolution"] self.cube_image = np.zeros((self.config["resolution"], self.config["resolution"], 3), np.uint32) self.target_x = np.random.uniform(self.min_target_x, self.max_target_x) self.target_y = np.random.uniform(self.min_target_y, self.max_target_y) self.min_target_distance = self.config["min_target_distance"] self.max_target_distance = self.config["max_target_distance"] self.use_texture = False if texture: self.use_texture = True self.texture_path = os.path.join(os.path.dirname(os.path.abspath(assets.__file__)), "wood.jpg") self.load_texture(self.texture_path) self.render_map = render_map if render_map: mesh_file = os.path.join(get_model_path(self.config["model_id"]), "mesh_z_up.obj") self.map_renderer = NavigationMapRenderer(mesh_file, self.default_z, 0.1, render_resolution=self.resolution)
def __init__(self, config, gpu_count=0, start_locations=None, render_map=True, fixed_endpoints=False): HuskyNavigateEnv.__init__(self, config, gpu_count) self.fixed_endpoints = fixed_endpoints self.default_z = self.config["initial_pos"][2] self.target_mu = self.config["target_distance_mu"] self.target_sigma = self.config["target_distance_sigma"] self.locations = self.get_valid_locations(start_locations) self.n_locations = self.locations.shape[0] self.start_location = self.select_agent_location() self.config["initial_pos"] = [ self.start_location[0], self.start_location[1], self.default_z ] self.target_location = self.select_target() self.target_radius = 0.5 self.render_map = render_map self.render_resolution = 256 if render_map: mesh_file = os.path.join(get_model_path(self.config["model_id"]), "mesh_z_up.obj") self.map_renderer = NavigationMapRenderer( mesh_file, self.default_z, 0.1, render_resolution=self.render_resolution)
def __init__(self, config, gpu_count=0, start_locations_file=None, fixed_endpoints=False): HuskyNavigateEnv.__init__(self, config, gpu_count) self.fixed_endpoints = fixed_endpoints self.cell_size = self.config["cell_size"] self.map_x_range = self.config["map_x_range"] self.map_y_range = self.config["map_y_range"] self.default_z = self.config["initial_pos"][2] self.x_vals = np.arange(self.map_x_range[0], self.map_x_range[1], self.cell_size) self.y_vals = np.arange(self.map_y_range[0], self.map_y_range[1], self.cell_size) self.occupancy_map = np.zeros((self.x_vals.shape[0], self.y_vals.shape[0])) self.start_locations_file = start_locations_file self.use_valid_locations = False if self.start_locations_file is not None: self.valid_locations = np.loadtxt(self.start_locations_file, delimiter=',') self.n_points = self.valid_locations.shape[0] self.use_valid_locations = True