Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <boost/python.hpp>
00021 #include <boost/python/stl_iterator.hpp>
00022 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
00023
00024 #include <octomap_msgs/conversions.h>
00025
00026 template<class T>
00027 boost::python::list std_vector_to_py_list(const std::vector<T>& vec)
00028 {
00029 typename std::vector<T>::const_iterator iter;
00030 boost::python::list res;
00031 for (iter = vec.begin(); iter != vec.end(); ++iter) {
00032 res.append(*iter);
00033 }
00034 return res;
00035 }
00036
00038 boost::python::tuple octomap_str_to_tuple(const std::string &str_msg)
00039 {
00040 std::stringstream ss;
00041 ss << str_msg;
00042 ss.seekg(0);
00043 octomap::OcTree* octree = dynamic_cast<octomap::OcTree*>(octomap::OcTree::read(ss));
00044
00045 octomap_msgs::Octomap msg;
00046 bool res = octomap_msgs::fullMapToMsg(*octree, msg);
00047
00048 return boost::python::make_tuple(msg.binary, msg.id, msg.resolution, std_vector_to_py_list(msg.data));
00049 }
00050
00051 BOOST_PYTHON_MODULE(octomap_python)
00052 {
00053 boost::python::def("octomap_str_to_tuple", octomap_str_to_tuple);
00054 }
naoqi_sensors
Author(s): Séverin Lemaignan, Vincent Rabaud, Karsten Knese, Jack O'Quin, Ken Tossell, Patrick Beeson, Nate Koenig, Andrew Howard, Damien Douxchamps, Dan Dennedy, Daniel Maier
autogenerated on Fri Jul 3 2015 12:51:48