示例#1
0
    def _ros_service_set_interactions(self, request):
        '''
          Add or remove interactions from the interactions table.

          Note: uniquely identifying apps by name (not very sane).

          @param request list of roles-apps to set
          @type concert_srvs.SetInteractionsRequest
        '''
        if request.load:
            interactions = self._bind_dynamic_symbols(request.interactions)
            (new_interactions,
             invalid_interactions) = self.interactions_table.load(interactions)
            for i in new_interactions:
                rospy.loginfo("Interactions : loading %s [%s-%s-%s]" %
                              (i.display_name, i.name, i.role, i.namespace))
            for i in invalid_interactions:
                rospy.logwarn("Interactions : failed to load %s [%s-%s-%s]" (
                    i.display_name, i.name, i.role, i.namespace))
        else:
            removed_interactions = self.interactions_table.unload(
                request.interactions)
            for i in removed_interactions:
                rospy.loginfo("Interactions : unloading %s [%s-%s-%s]" %
                              (i.display_name, i.name, i.role, i.namespace))
        # could check explicitly if roles were added/removed, but this isn't called often, so it's not expensive
        # just to republish the list (so long as nothing is assuming there HAS to be state changes this is ok.
        self._publish_roles()
        # send response
        response = interaction_srvs.SetInteractionsResponse()
        response.result = True
        return response
示例#2
0
    def _ros_service_set_interactions(self, request):
        '''
          Add or remove interactions from the interactions table.

          Note: uniquely identifying apps by name (not very sane).

          @param request list of roles-apps to set
          @type concert_srvs.SetInteractionsRequest
        '''
        if request.load:
            interactions = self._bind_dynamic_symbols(request.interactions)
            (new_interactions, invalid_interactions
             ) = self._interactions_table.load(interactions)
            for i in new_interactions:
                rospy.loginfo("Interactions : loading %s [%s-%s-%s]" %
                              (i.display_name, i.name, i.role, i.namespace))
            for i in invalid_interactions:
                rospy.logwarn("Interactions : failed to load %s [%s-%s-%s]" (
                    i.display_name, i.name, i.role, i.namespace))
        else:
            removed_interactions = self._interactions_table.unload(
                request.interactions)
            for i in removed_interactions:
                rospy.loginfo("Interactions : unloading %s [%s-%s-%s]" %
                              (i.display_name, i.name, i.role, i.namespace))
        # send response
        response = interaction_srvs.SetInteractionsResponse()
        response.result = True
        return response
示例#3
0
    def _ros_service_set_interactions(self, request):
        '''
          Add or remove interactions from the interactions table.
          Note: uniquely identifying apps by name (not very sane).

          @param request list of roles-apps to set
          @type concert_srvs.SetInteractionsRequest
        '''
        if request.load:
            (new_pairings,
             invalid_pairings) = self.pairings_table.load(request.pairings)
            (new_interactions,
             invalid_interactions) = self.interactions_table.load(
                 request.interactions)
            for p in new_pairings:
                rospy.loginfo("Interactions : loading %s [%s]" %
                              (p.name, p.rapp))
            for p in invalid_pairings:
                rospy.logwarn("Interactions : failed to load %s [%s]" (p.name,
                                                                       p.rapp))
            for i in new_interactions:
                rospy.loginfo("Interactions : loading %s [%s-%s-%s]" %
                              (i.name, i.command, i.group, i.namespace))
            for i in invalid_interactions:
                rospy.logwarn("Interactions : failed to load %s [%s-%s-%s]" (
                    i.name, i.command, i.group, i.namespace))
        else:
            removed_pairings = self._pairings_table.unload(request.pairings)
            removed_interactions = self._interactions_table.unload(
                request.interactions)
            for p in removed_pairings:
                rospy.loginfo("Interactions : unloading %s [%s]" %
                              (p.name, p.rapp))
            for i in removed_interactions:
                rospy.loginfo("Interactions : unloading %s [%s-%s-%s]" %
                              (i.name, i.command, i.group, i.namespace))
        # send response
        response = interaction_srvs.SetInteractionsResponse()
        response.result = True
        return response