21 import rosserial_client
26 output_path = output_path +
"/" + package
27 if not os.path.exists(output_path):
28 os.makedirs(output_path)
29 with open(output_path +
"/" + msg.name +
".h",
"w")
as header:
30 msg.make_header(header)
33 path = rospack.get_path(package) +
"/msg/" + message +
".msg" 35 definition = f.readlines()
36 md5sum = roslib.message.get_message_class(package+
'/'+message)._md5sum
37 write_header(dest, package, Message(message, package, definition, md5sum))
40 path = rospack.get_path(package) +
"/srv/" + service +
".srv" 42 definition = f.readlines()
43 md5req = roslib.message.get_service_class(package+
'/'+service)._request_class._md5sum
44 md5res = roslib.message.get_service_class(package+
'/'+service)._response_class._md5sum
45 write_header(dest, package, Service(service, package, definition, md5req, md5res ) )
48 ROS_TO_EMBEDDED_TYPES = {
49 'bool' : (
'bool', 1, PrimitiveDataType, []),
50 'byte' : (
'int8_t', 1, PrimitiveDataType, []),
51 'int8' : (
'int8_t', 1, PrimitiveDataType, []),
52 'char' : (
'uint8_t', 1, PrimitiveDataType, []),
53 'uint8' : (
'uint8_t', 1, PrimitiveDataType, []),
54 'int16' : (
'int16_t', 2, PrimitiveDataType, []),
55 'uint16' : (
'uint16_t', 2, PrimitiveDataType, []),
56 'int32' : (
'int32_t', 4, PrimitiveDataType, []),
57 'uint32' : (
'uint32_t', 4, PrimitiveDataType, []),
58 'int64' : (
'int64_t', 8, PrimitiveDataType, []),
59 'uint64' : (
'uint64_t', 4, PrimitiveDataType, []),
60 'float32' : (
'float', 4, PrimitiveDataType, []),
61 'float64' : (
'double', 8, PrimitiveDataType, []),
62 'time' : (
'ros::Time', 8, TimeDataType, [
'ros/time']),
63 'duration': (
'ros::Duration', 8, TimeDataType, [
'ros/duration']),
64 'string' : (
'char*', 0, StringDataType, []),
65 'Header' : (
'std_msgs::Header', 0, MessageDataType, [
'std_msgs/Header'])
68 rospack = rospkg.RosPack()
69 rospack.list =
lambda: []
70 rosserial_generate(rospack,
"ros_lib", ROS_TO_EMBEDDED_TYPES)
72 shutil.rmtree(
"ros_lib",
True)
73 shutil.copytree(rospack.get_path(
"rosserial_embeddedlinux")+
"/src/ros_lib",
"ros_lib")
75 rosserial_client_copy_files(rospack,
"ros_lib/")
81 MakeLibrary(
"rosserial_msgs",
"ros_lib", rospack)
82 MakeLibrary(
"cob_hand_bridge",
"ros_lib", rospack)
def make_message(rospack, package, message, dest)
def write_header(output_path, package, msg)
def make_service(rospack, package, service, dest)