Пример #1
0
def get_service_response_typedef_recursive(servicetype):
    """ Returns a list of typedef dicts for this type and all contained type fields """
    # Get an instance of the service response class and get its typedef
    instance = ros_loader.get_service_response_instance(servicetype)
    typedef = _get_typedef(instance)
    
    # Return the list of sub-typedefs
    return _get_subtypedefs_recursive(typedef, [])
Пример #2
0
def get_service_response_typedef_recursive(servicetype):
    """ Returns a list of typedef dicts for this type and all contained type fields """
    # Get an instance of the service response class and get its typedef
    instance = ros_loader.get_service_response_instance(servicetype)
    typedef = _get_typedef(instance)

    # Return the list of sub-typedefs
    return _get_subtypedefs_recursive(typedef, [])
 def test_irregular_servicenames(self):
     irregular = ["roscpp//GetLoggers", "/roscpp/GetLoggers/",
     "/roscpp/GetLoggers", "//roscpp/GetLoggers", "/roscpp//GetLoggers",
     "roscpp/GetLoggers//", "/roscpp/GetLoggers//", "roscpp/GetLoggers/",
     "roscpp//GetLoggers//"]
     for x in irregular:
         self.assertNotEqual(ros_loader.get_service_class(x), None)
         self.assertNotEqual(ros_loader.get_service_instance(x), None)
         self.assertNotEqual(ros_loader.get_service_request_instance(x), None)
         self.assertNotEqual(ros_loader.get_service_response_instance(x), None)
Пример #4
0
 def test_irregular_servicenames(self):
     irregular = ["roscpp//GetLoggers", "/roscpp/GetLoggers/",
                  "/roscpp/GetLoggers", "//roscpp/GetLoggers", "/roscpp//GetLoggers",
                  "roscpp/GetLoggers//", "/roscpp/GetLoggers//", "roscpp/GetLoggers/",
                  "roscpp//GetLoggers//"]
     for x in irregular:
         self.assertNotEqual(ros_loader.get_service_class(x), None)
         self.assertNotEqual(ros_loader.get_service_instance(x), None)
         self.assertNotEqual(
             ros_loader.get_service_request_instance(x), None)
         self.assertNotEqual(
             ros_loader.get_service_response_instance(x), None)
 def test_srv_cache(self):
     common = ["roscpp/GetLoggers", "roscpp/SetLoggerLevel",
     "std_srvs/Empty", "nav_msgs/GetMap", "nav_msgs/GetPlan",
     "sensor_msgs/SetCameraInfo", "topic_tools/MuxAdd",
     "topic_tools/MuxSelect", "tf2_msgs/FrameGraph",
     "rospy_tutorials/BadTwoInts", "rospy_tutorials/AddTwoInts"]
     for x in common:
         self.assertNotEqual(ros_loader.get_service_class(x), None)
         self.assertNotEqual(ros_loader.get_service_instance(x), None)
         self.assertNotEqual(ros_loader.get_service_request_instance(x), None)
         self.assertNotEqual(ros_loader.get_service_response_instance(x), None)
         self.assertTrue(x in ros_loader._loaded_srvs)
Пример #6
0
 def test_srv_cache(self):
     common = ["roscpp/GetLoggers", "roscpp/SetLoggerLevel",
               "std_srvs/Empty", "nav_msgs/GetMap", "nav_msgs/GetPlan",
               "sensor_msgs/SetCameraInfo", "topic_tools/MuxAdd",
               "topic_tools/MuxSelect", "tf2_msgs/FrameGraph",
               "rospy_tutorials/BadTwoInts", "rospy_tutorials/AddTwoInts"]
     for x in common:
         self.assertNotEqual(ros_loader.get_service_class(x), None)
         self.assertNotEqual(ros_loader.get_service_instance(x), None)
         self.assertNotEqual(
             ros_loader.get_service_request_instance(x), None)
         self.assertNotEqual(
             ros_loader.get_service_response_instance(x), None)
         self.assertTrue(x in ros_loader._loaded_srvs)
Пример #7
0
 def service_response(self, message):
     # check for the service
     service_name = message["service"]
     if service_name in self.protocol.external_service_list:
         service_handler = self.protocol.external_service_list[service_name]
         # parse the message
         request_id = message["id"]
         values = message["values"]
         # create a message instance
         resp = ros_loader.get_service_response_instance(service_handler.service_type)
         message_conversion.populate_instance(values, resp)
         # pass along the response
         service_handler.responses[request_id] = resp
     else:
         self.protocol.log("error", "Service %s has no been advertised externally." % service_name)
    def service_response(self, message):
        # convert the message into according response instance
        # then just put response into singleton list for responses.. the requesting process will find it there and clean up after delivery to client

        # get information about the request with the same id as the incoming response
        # ..this information gets written into "request_list" by advertise_service.py within "handle_service_request()"
        request = self.protocol.request_list[message["request_id"]]

        # get module and type
        service_module = request["service_module"]
        service_type = request["service_type"]

        ## Create a message instance
        inst = ros_loader.get_service_response_instance(service_module+"/"+service_type)
        
        # Populate the instance, propagating any exceptions that may be thrown
        message_conversion.populate_instance(message["data"], inst)

        # add response instance to response_list
        self.response_list[message["request_id"]] = inst
Пример #9
0
    def service_response(self, message):
        # convert the message into according response instance
        # then just put response into singleton list for responses.. the requesting process will find it there and clean up after delivery to client

        # get information about the request with the same id as the incoming response
        # ..this information gets written into "request_list" by advertise_service.py within "handle_service_request()"
        request = self.protocol.request_list[message["request_id"]]

        # get module and type
        service_module = request["service_module"]
        service_type = request["service_type"]

        ## Create a message instance
        inst = ros_loader.get_service_response_instance(service_module + "/" +
                                                        service_type)

        # Populate the instance, propagating any exceptions that may be thrown
        message_conversion.populate_instance(message["data"], inst)

        # add response instance to response_list
        self.response_list[message["request_id"]] = inst
Пример #10
0
def get_service_response_typedef(servicetype):
    """ Returns a typedef dict for the service response class for the specified service type """
    # Get an instance of the service response class and return its typedef
    instance = ros_loader.get_service_response_instance(servicetype)
    return _get_typedef(instance)
Пример #11
0
def get_service_response_typedef(servicetype):
    """ Returns a typedef dict for the service response class for the specified service type """
    # Get an instance of the service response class and return its typedef 
    instance = ros_loader.get_service_response_instance(servicetype)
    return _get_typedef(instance)