Skip to content

vrabaud/boost_python_ros

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]: 

About

Boost Python bindings for ROS message types

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.2%
  • C++ 3.8%