def remove_remote_service(self, msg): for i, service in enumerate(self._instances['services']): if msg.conn_name in service: service[msg.conn_name]['bridgeservserver'].unregister() del self._instances['services'][i] break return ROSDuctConnectionResponse()
def remove_remote_topic(self, msg): for i, topic in enumerate(self._instances['topics']): if msg.conn_name in topic: topic[msg.conn_name]['rospub'].unregister() del self._instances['topics'][i] break return ROSDuctConnectionResponse()
def add_local_service(self, msg): rosservprox = rospy.ServiceProxy( msg.conn_name, get_ROS_class(msg.conn_type, srv=True)) l_to_r_srv_cv = self.create_callback_from_local_to_remote_srv( msg.conn_name, msg.conn_type, rosservprox) remote_service_server = self.client.service_server( msg.alias_name, msg.conn_type, l_to_r_srv_cv) self._instances['services'].append({ msg.conn_name: { 'rosservprox': rosservprox, 'bridgeservserver': remote_service_server } }) return ROSDuctConnectionResponse()
def add_remote_service(self, msg): remote_service_client = self.client.service_client( msg.conn_name, msg.conn_type) r_to_l_serv_cb = self.create_callback_from_remote_to_local_srv( remote_service_client, msg.conn_name, msg.conn_type) rosserv = rospy.Service(msg.alias_name, get_ROS_class(msg.conn_type, srv=True), r_to_l_serv_cb) self._instances['services'].append({ msg.conn_name: { 'rosserv': rosserv, 'bridgeservclient': remote_service_client } }) return ROSDuctConnectionResponse()
def add_local_topic(self, msg): bridgepub = self.client.publisher(msg.alias_name, msg.conn_type, latch=msg.latch) cb_l_to_r = self.create_callback_from_local_to_remote( msg.conn_name, msg.conn_type, bridgepub) rossub = rospy.Subscriber(msg.conn_name, get_ROS_class(msg.conn_type), cb_l_to_r) self._instances['topics'].append( {msg.conn_name: { 'rossub': rossub, 'bridgepub': bridgepub }}) return ROSDuctConnectionResponse()
def add_remote_topic(self, msg): rospub = rospy.Publisher( msg.alias_name, get_ROS_class(msg.conn_type), # SubscribeListener added later queue_size=1, latch=msg.latch) cb_r_to_l = self.create_callback_from_remote_to_local( msg.conn_name, msg.conn_type, rospub) subl = self.create_subscribe_listener(msg.conn_name, msg.conn_type, cb_r_to_l) rospub.impl.add_subscriber_listener(subl) self._instances['topics'].append( {msg.conn_name: { 'rospub': rospub, 'bridgesub': None }}) return ROSDuctConnectionResponse()