1 from abc
import ABCMeta, abstractmethod
5 from rospy_message_converter
import message_converter
8 service_class = roslib.message.get_service_class(service_type)
9 request = service_class._request_class()
10 request_fields = dict(message_converter._get_message_fields(request))
12 for field_name, field_value
in dictionary.items():
13 if field_name
in request_fields:
14 field_type = request_fields[field_name]
15 field_value = message_converter._convert_to_ros_type(field_type, field_value)
16 setattr(request, field_name, field_value)
18 error_message =
'ROS message type "{0}" has no field named "{1}"'\
19 .format(message_type, field_name)
20 raise ValueError(error_message)
24 """ base class for specifying the command at the time of menu click. """ 25 __metaclass__ = ABCMeta
39 rospy.loginfo(
'topic pub: ' + str(args))
43 if not name
in self.
_pubs:
44 self.
_pubs[name] = rospy.Publisher(name,
45 roslib.message.get_message_class(mtype),
48 if not name
in self.
_msgs:
49 self.
_msgs[name] = message_converter.convert_dictionary_to_ros_message(mtype, msg)
58 rospy.loginfo(
'service call: ' + str(args))
62 if not name
in self.
_srvs:
63 self.
_srvs[name] = rospy.ServiceProxy(name,
64 roslib.message.get_service_class(mtype))
65 if not name
in self.
_reqs:
70 """ Call python function """ 74 rospy.loginfo(
'python function: ' + str(args))
78 if not mod
in self.
_mods:
79 self.
_mods[mod] = importlib.import_module(mod)
80 getattr(self.
_mods[mod], func)(**fa)
def __call__(self, args, feedback=None)
def __call__(self, args, feedback=None)
def __call__(self, args, feedback=None)
def convert_dictionary_to_ros_request(service_type, dictionary)
def __call__(self, args, feedback=None)