def _init_gateway_services(self): self._gateway_services = {} self._gateway_services['gateway_info'] = rocon_utilities.SubscriberProxy('~gateway_info', gateway_msgs.GatewayInfo) self._gateway_services['flip'] = rospy.ServiceProxy('~flip', gateway_srvs.Remote) self._gateway_services['advertise'] = rospy.ServiceProxy('~advertise', gateway_srvs.Advertise) self._gateway_services['pull'] = rospy.ServiceProxy('~pull', gateway_srvs.Remote) self._gateway_publishers = {} self._gateway_publishers['force_update'] = rospy.Publisher("~force_update", std_msgs.Empty)
def _init_gateway_services(self): self._gateway_services = {} self._gateway_services[ 'gateway_info'] = rocon_utilities.SubscriberProxy( '~gateway_info', gateway_msgs.GatewayInfo) self._gateway_services['flip'] = rospy.ServiceProxy( '~flip', gateway_srvs.Remote) self._gateway_services['advertise'] = rospy.ServiceProxy( '~advertise', gateway_srvs.Advertise) self._gateway_services['pull'] = rospy.ServiceProxy( '~pull', gateway_srvs.Remote)
def local_gateway_name(): gateway_name = None gateway_info_service = rocon_utilities.SubscriberProxy( '~gateway_info', gateway_msgs.GatewayInfo) while not rospy.is_shutdown(): gateway_info = gateway_info_service(timeout=rospy.Duration(0.2)) if gateway_info: if gateway_info.connected: gateway_name = gateway_info.name break rospy.sleep(1.0) return gateway_name
def wait_for_gateway(ns=_gateway_namespace, timeout=rospy.Duration(5.0)): ''' Slowly loop (and block) until the gateway is connected to a hub. ''' gateway_info_service = rocon_utilities.SubscriberProxy( ns + '/gateway_info', gateway_msgs.GatewayInfo) start_time = rospy.Time.now() while not rospy.is_shutdown(): gateway_info = gateway_info_service() if gateway_info.connected: break if rospy.Time.now() - start_time > timeout: raise GatewaySampleRuntimeError( "timed out waiting for the gateway to connect to a hub") rospy.sleep(0.5)
def configure(self): self._gateway_info = rocon_utilities.SubscriberProxy(self.gateway_namespace + '/gateway_info', gateway_msgs.GatewayInfo) self._remote_gateway_info = rospy.ServiceProxy(self.gateway_namespace + '/remote_gateway_info', gateway_srvs.RemoteGatewayInfo)
def test_subscriber_proxy(self): talker_data = rocon_utilities.SubscriberProxy('chatter', String)() self.assertEquals("dude", talker_data.data)