def __init__( self, config, device=torch.device("cuda:0"), monocheckpoint="habitat_baselines/slambased/data/mp3d_resnet50.pth", ): super(ORBSLAM2MonodepthAgent, self).__init__(config) self.num_actions = config.NUM_ACTIONS self.dist_threshold_to_stop = config.DIST_TO_STOP self.slam_vocab_path = config.SLAM_VOCAB_PATH assert os.path.isfile(self.slam_vocab_path) self.slam_settings_path = config.SLAM_SETTINGS_PATH assert os.path.isfile(self.slam_settings_path) self.slam = orbslam2.System( self.slam_vocab_path, self.slam_settings_path, orbslam2.Sensor.RGBD ) self.slam.set_use_viewer(False) self.slam.initialize() self.device = device self.map_size_meters = config.MAP_SIZE self.map_cell_size = config.MAP_CELL_SIZE self.pos_th = config.DIST_REACHED_TH self.next_wp_th = config.NEXT_WAYPOINT_TH self.angle_th = config.ANGLE_TH self.obstacle_th = config.MIN_PTS_IN_OBSTACLE self.depth_denorm = config.DEPTH_DENORM self.planned_waypoints = [] self.mapper = DirectDepthMapper( camera_height=config.CAMERA_HEIGHT, near_th=config.D_OBSTACLE_MIN, far_th=config.D_OBSTACLE_MAX, h_min=config.H_OBSTACLE_MIN, h_max=config.H_OBSTACLE_MAX, map_size=config.MAP_SIZE, map_cell_size=config.MAP_CELL_SIZE, device=device, ) self.planner = DifferentiableStarPlanner( max_steps=config.PLANNER_MAX_STEPS, preprocess=config.PREPROCESS_MAP, beta=config.BETA, device=device, ) self.slam_to_world = 1.0 self.timestep = 0.1 self.timing = False self.checkpoint = monocheckpoint if not os.path.isfile(self.checkpoint): mp3d_url = "http://cmp.felk.cvut.cz/~mishkdmy/navigation/mp3d_ft_monodepth_resnet50.pth" # suncg_me_url = "http://cmp.felk.cvut.cz/~mishkdmy/navigation/suncg_me_resnet.pth" # suncg_mf_url = "http://cmp.felk.cvut.cz/~mishkdmy/navigation/suncg_mf_resnet.pth" url = mp3d_url print("No monodepth checkpoint found. Downloading...", url) download(url, self.checkpoint) self.monodepth = MonoDepthEstimator(self.checkpoint) self.reset() return
def __init__(self, config, device=torch.device("cuda:0")): self.num_actions = config.NUM_ACTIONS self.dist_threshold_to_stop = config.DIST_TO_STOP self.slam_vocab_path = config.SLAM_VOCAB_PATH assert os.path.isfile(self.slam_vocab_path) self.slam_settings_path = config.SLAM_SETTINGS_PATH assert os.path.isfile(self.slam_settings_path) self.slam = orbslam2.System(self.slam_vocab_path, self.slam_settings_path, orbslam2.Sensor.RGBD) self.slam.set_use_viewer(False) self.slam.initialize() self.device = device self.map_size_meters = config.MAP_SIZE self.map_cell_size = config.MAP_CELL_SIZE self.pos_th = config.DIST_REACHED_TH self.next_wp_th = config.NEXT_WAYPOINT_TH self.angle_th = config.ANGLE_TH self.obstacle_th = config.MIN_PTS_IN_OBSTACLE self.depth_denorm = config.DEPTH_DENORM self.planned_waypoints = [] self.mapper = DirectDepthMapper( camera_height=config.CAMERA_HEIGHT, near_th=config.D_OBSTACLE_MIN, far_th=config.D_OBSTACLE_MAX, h_min=config.H_OBSTACLE_MIN, h_max=config.H_OBSTACLE_MAX, map_size=config.MAP_SIZE, map_cell_size=config.MAP_CELL_SIZE, device=device, ) self.planner = DifferentiableStarPlanner( max_steps=config.PLANNER_MAX_STEPS, preprocess=config.PREPROCESS_MAP, beta=config.BETA, device=device, ) self.slam_to_world = 1.0 self.timestep = 0.1 self.timing = False self.reset() # print('self', self, dir(self)) for attr_name in dir(self): if '__' not in attr_name: print(attr_name, getattr(self, attr_name), type(getattr(self, attr_name))) type_name = str(type(getattr(self, attr_name))) if 'numpy' in type_name or 'ensor' in type_name: print(getattr(getattr(self, attr_name), 'shape')) return
def __init__(self, config, follower, device=torch.device("cuda:0")): self.slam_vocab_path = config.SLAM_VOCAB_PATH assert os.path.isfile(self.slam_vocab_path) self.slam_settings_path = config.SLAM_SETTINGS_PATH assert os.path.isfile(self.slam_settings_path) self.slam = orbslam2.System(self.slam_vocab_path, self.slam_settings_path, orbslam2.Sensor.RGBD) self.slam.set_use_viewer(False) self.slam.initialize() self.device = device self.map_size_meters = config.MAP_SIZE self.map_cell_size = config.MAP_CELL_SIZE self.obstacle_th = config.MIN_PTS_IN_OBSTACLE self.depth_denorm = config.DEPTH_DENORM self.mapper = DirectDepthMapper( camera_height=config.CAMERA_HEIGHT, near_th=config.D_OBSTACLE_MIN, far_th=config.D_OBSTACLE_MAX, h_min=config.H_OBSTACLE_MIN, h_max=config.H_OBSTACLE_MAX, map_size=config.MAP_SIZE, map_cell_size=config.MAP_CELL_SIZE, device=device, ) self.slam_to_world = 1.0 self.timestep = 0.1 self.timing = False self.follower = follower self.reset() return