def create_dock_mission(self, dock_name): """Create, POST, and populate MiR docking mission, then save it.""" mission_name = f'dock_to_{dock_name}' mission = PostMissions( # mir const, retrieved with GET /mission_groups group_id='mirconst-guid-0000-0001-missiongroup', name=mission_name, description='automatically created by mir fleet handler', ) response = self.mir_api.missions_post(mission) action = PostMissionActions(action_type='docking', mission_id=response.guid, parameters=[ { 'id': 'marker', 'value': dock_name }, ], priority=1) self.mir_api.missions_mission_id_actions_post(mission_id=response.guid, body=action) self.node.get_logger().info( f'created mission to move and dock to: "{dock_name}"') # NOTE(CH3): Unsure if I should be doing this self.missions[mission_name] = response.guid return response.guid
def create_move_mission(self, robot, place_name, retries=10): ''' creates a mission to move to metamap place ''' mission = PostMissions( # mir const, retrieved with GET /mission_groups group_id='mirconst-guid-0000-0001-missiongroup', name=f'move_to_{place_name}', description='automatically created by mir fleet adapter', ) response = robot.api.missions_post(mission) dist_threshold = 0.1 action = PostMissionActions(action_type='move', mission_id=response.guid, parameters=[ { 'id': 'position', 'value': robot.positions[place_name].guid }, { 'id': 'retries', 'value': retries }, { 'id': 'distance_threshold', 'value': dist_threshold }, ], priority=1) response2 = robot.api.missions_mission_id_actions_post( mission_id=response.guid, body=action) self.get_logger().info(f'created mission to move to "{place_name}"') return response.guid
def create_move_coordinate_mission(self, mir_location, retries=10): mission_name = ('move_coordinate_to' f'_{mir_location.x:.3f}', f'_{mir_location.y:.3f}', f'_{mir_location.yaw:.3f}') mission = PostMissions( group_id='mirconst-guid-0000-0001-missiongroup', name=mission_name, description='automatically created by mir fleet adapter', ) response = self.mir_api.missions_post(mission) action = PostMissionActions(action_type='move_to_position', mission_id=response.guid, parameters=[ { 'id': 'x', 'value': mir_location.x }, { 'id': 'y', 'value': mir_location.y }, { 'id': 'orientation', 'value': mir_location.yaw }, { 'id': 'retries', 'value': retries }, { 'id': 'distance_threshold', 'value': 0.1 }, ], priority=1) self.mir_api.missions_mission_id_actions_post(mission_id=response.guid, body=action) self.node.get_logger().info( f'{self.name}: ' f'Created mission to move coordinate to "{mir_location}"') # NOTE(CH3): Unsure if I should be doing this self.missions[mission_name] = response.guid return response.guid
def create_dock_mission(self, robot, dock_name): mission = PostMissions( # mir const, retrieved with GET /mission_groups group_id='mirconst-guid-0000-0001-missiongroup', name=f'dock_to_{dock_name}', description='automatically created by mir fleet adapter', ) response = robot.api.missions_post(mission) action = PostMissionActions(action_type='docking', mission_id=response.guid, parameters=[ { 'id': 'marker', 'value': dock_name }, ], priority=1) response2 = robot.api.missions_mission_id_actions_post( mission_id=response.guid, body=action) self.get_logger().info(f'created mission to move to "{dock_name}"') return response.guid
def create_move_coordinate_mission(self, robot, location, retries=10): mission = PostMissions( group_id='mirconst-guid-0000-0001-missiongroup', name=f'move_coordinate_to_{location.x:.3f}_{location.y:.3f}', description='automatically created by mir fleet adapter', ) response = robot.api.missions_post(mission) action = PostMissionActions(action_type='move_to_position', mission_id=response.guid, parameters=[ { 'id': 'x', 'value': location.x }, { 'id': 'y', 'value': location.y }, { 'id': 'orientation', 'value': location.yaw }, { 'id': 'retries', 'value': retries }, { 'id': 'distance_threshold', 'value': 0.1 }, ], priority=1) response2 = robot.api.missions_mission_id_actions_post( mission_id=response.guid, body=action) self.get_logger().info( f'created mission to move coordinate to "{location}"') return response.guid