make_libraries.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 #####################################################################
4 # Software License Agreement (BSD License)
5 #
6 # Copyright (c) 2014, Willow Garage, Inc.
7 # All rights reserved.
8 #
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
12 #
13 # * Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # * Redistributions in binary form must reproduce the above
16 # copyright notice, this list of conditions and the following
17 # disclaimer in the documentation and/or other materials provided
18 # with the distribution.
19 # * Neither the name of Willow Garage, Inc. nor the names of its
20 # contributors may be used to endorse or promote products derived
21 # from this software without specific prior written permission.
22 #
23 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 # POSSIBILITY OF SUCH DAMAGE.
35 
36 THIS_PACKAGE = "rosserial_windows"
37 
38 __usage__ = """
39 make_libraries.py generates the Windows rosserial library files. It
40 requires the location of your project's ros_lib folder.
41 
42 rosrun rosserial_windows make_libraries.py <output_path>
43 """
44 
45 import rospkg
46 import rosserial_client
48 
49 # for copying files
50 import shutil
51 
52 ROS_TO_EMBEDDED_TYPES = {
53  'bool' : ('bool', 1, PrimitiveDataType, []),
54  'byte' : ('int8_t', 1, PrimitiveDataType, []),
55  'int8' : ('int8_t', 1, PrimitiveDataType, []),
56  'char' : ('uint8_t', 1, PrimitiveDataType, []),
57  'uint8' : ('uint8_t', 1, PrimitiveDataType, []),
58  'int16' : ('int16_t', 2, PrimitiveDataType, []),
59  'uint16' : ('uint16_t', 2, PrimitiveDataType, []),
60  'int32' : ('int32_t', 4, PrimitiveDataType, []),
61  'uint32' : ('uint32_t', 4, PrimitiveDataType, []),
62  'int64' : ('int64_t', 8, PrimitiveDataType, []),
63  'uint64' : ('uint64_t', 4, PrimitiveDataType, []),
64  'float32' : ('float', 4, PrimitiveDataType, []),
65  'float64' : ('double', 8, PrimitiveDataType, []),
66  'time' : ('ros::Time', 8, TimeDataType, ['ros/time']),
67  'duration': ('ros::Duration', 8, TimeDataType, ['ros/duration']),
68  'string' : ('char*', 0, StringDataType, []),
69  'Header' : ('std_msgs::Header', 0, MessageDataType, ['std_msgs/Header'])
70 }
71 
72 # need correct inputs
73 if (len(sys.argv) < 2):
74  print __usage__
75  exit()
76 
77 # get output path
78 path = sys.argv[1]
79 if path[-1] == "/":
80  path = path[0:-1]
81 print "\nExporting to %s" % path
82 
83 rospack = rospkg.RosPack()
84 
85 # copy ros_lib stuff in
86 rosserial_arduino_dir = rospack.get_path(THIS_PACKAGE)
87 shutil.copytree(rosserial_arduino_dir+"/src/ros_lib", path+"/ros_lib")
88 rosserial_client_copy_files(rospack, path+"/ros_lib/")
89 
90 # generate messages
91 rosserial_generate(rospack, path+"/ros_lib", ROS_TO_EMBEDDED_TYPES)
92 


rosserial_windows
Author(s): Kareem Shehata
autogenerated on Mon Jun 10 2019 14:53:50