def _create_resource(self, uri): # Create a resource to request resource = scheduler_msgs.Resource() resource.id = unique_id.toMsg(unique_id.fromRandom()) resource.rapp = self.resource_type resource.uri = uri resource.remappings = [] map_remapped, waypoints_remapped = self._get_remapped_topic( rocon_uri.parse(resource.uri).name.string) resource.remappings = [ rocon_std_msgs.Remapping(self._default_map_topic, map_remapped), rocon_std_msgs.Remapping(self._default_waypoints_topic, waypoints_remapped) ] return resource
def _create_resource(self, uri): # Create a resource to request resource = scheduler_msgs.Resource() resource.id = unique_id.toMsg(unique_id.fromRandom()) resource.rapp = self.resource_type resource.uri = uri cmd_vel_remapped, compressed_image_topic_remapped = self._get_remapped_topic( rocon_uri.parse(resource.uri).name.string) resource.remappings = [ rocon_std_msgs.Remapping(self._default_cmd_vel_topic, cmd_vel_remapped), rocon_std_msgs.Remapping(self._default_compressed_image_topic, compressed_image_topic_remapped) ] return resource
def _node_to_resource(node, linkgraph): ''' Convert linkgraph information for a particular node to a scheduler_msgs.Resource type. @param node : a node from the linkgraph @type concert_msgs.LinkNode @param linkgraph : the entire linkgraph (used to lookup the node's edges) @type concert_msgs.LinkGraph @return resource @rtype scheduler_msgs.Resource ''' resource = scheduler_msgs.Resource() resource.rapp = rocon_uri.parse(node.resource).rapp resource.uri = node.resource resource.remappings = [rocon_std_msgs.Remapping(e.remap_from, e.remap_to) for e in linkgraph.edges if e.start == node.id or e.finish == node.id] resource.parameters = [rocon_std_msgs.KeyValue(key,str(val)) for key, val in node.parameters.items()] return resource