forked from bhaskara/boost_python_ros
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
51 lines (36 loc) · 2.08 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Contains scripts for generating Boost Python bindings for ROS (www.ros.org) message types. Uses the roslib libraries for parsing the ROS message IDL. It does two things:
* Defines code generation and CMake macros for exporting any ROS package's roscpp message definitions into Boost Python. For each ROS package, these produce:
* Boost Python wrappers of the autogenerated C++ message classes
* Functions to convert between the Boost Python wrapped classes and the existing autogenerated ROS python message classes.
* Calls those macros for a few specific ROS packages: std_msgs, geometry_msgs, sensor_msgs, nav_msgs.
Example usage of the exported messages from Python (note rosh is basically an Ipython shell with ROS-related helper functions):
$ rosh
In [1]: roslib.load_manifest('boost_python_ros')
In [2]: import geometry_msgs_boost as gmb
~/dev/world_model/boost_python_ros/munged/std_msgs_boost.py:5: RuntimeWarning: to-Python converter for std::vector<signed char, std::allocator<signed char> > already regis
tered; second conversion method ignored.
~/dev/world_model/boost_python_ros/munged/geometry_msgs_boost.py:5: RuntimeWarning: to-Python converter for std::vector<double, std::allocator<double> > already registered
; second conversion method ignored.
In [3]: p = gmb.cpp.Pose()
In [4]: p
Out[4]: <geometry_msgs_cpp.Pose object at 0x8f3766c>
In [5]: p.position.x = 42
In [6]: p.orientation.w = 24
In [7]: p2 = p.to_ros()
In [8]: print p2
position:
x: 42.0
y: 0.0
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.0
w: 24.0
In [9]: p2.position.x = 1000
In [10]: p3 = p2.to_boost()
In [11]: p3.position.x
Out[11]: 1000.0
In [12]: p3.orientation.w
Out[12]: 24.0
In [13]: