2 make_libraries generates the rosserial library files. It
3 is passed the output folder. This version does not copy a ros.h,
4 as that is provided by the test harnesses. For use only by the
5 rosserial_test CMake setup.
10 from shutil
import copytree
11 from os
import path, sep, walk
14 ROS_TO_EMBEDDED_TYPES = {
15 'bool' : (
'bool', 1, PrimitiveDataType, []),
16 'byte' : (
'int8_t', 1, PrimitiveDataType, []),
17 'int8' : (
'int8_t', 1, PrimitiveDataType, []),
18 'char' : (
'uint8_t', 1, PrimitiveDataType, []),
19 'uint8' : (
'uint8_t', 1, PrimitiveDataType, []),
20 'int16' : (
'int16_t', 2, PrimitiveDataType, []),
21 'uint16' : (
'uint16_t', 2, PrimitiveDataType, []),
22 'int32' : (
'int32_t', 4, PrimitiveDataType, []),
23 'uint32' : (
'uint32_t', 4, PrimitiveDataType, []),
24 'int64' : (
'int64_t', 8, PrimitiveDataType, []),
25 'uint64' : (
'uint64_t', 4, PrimitiveDataType, []),
26 'float32' : (
'float', 4, PrimitiveDataType, []),
27 'float64' : (
'double', 4, PrimitiveDataType, []),
28 'time' : (
'ros::Time', 8, TimeDataType, [
'ros/time']),
29 'duration': (
'ros::Duration', 8, TimeDataType, [
'ros/duration']),
30 'string' : (
'char*', 0, StringDataType, []),
31 'Header' : (
'std_msgs::Header', 0, MessageDataType, [
'std_msgs/Header'])
35 if (len(sys.argv) < 2):
40 path = path.join(sys.argv[1],
'rosserial')
41 print(
"\nExporting to %s" % path)
43 rospack = rospkg.RosPack()
44 rosserial_client_copy_files(rospack, path + sep)
45 rosserial_generate(rospack, path, ROS_TO_EMBEDDED_TYPES)
50 for dname, dirs, files
in walk(path):
52 fpath = os.path.join(dname, fname)
53 with open(fpath)
as f:
55 with open(fpath,
"w")
as f:
56 f.write(re.sub(
'^#include "([^"]+)"',
57 '#include "rosserial/\\1"',
58 s, flags=re.MULTILINE))