diff --git a/src/ros_tf_listener-python-module-py.cc b/src/ros_tf_listener-python-module-py.cc new file mode 100644 index 0000000000000000000000000000000000000000..3815f4530df6fe81bc1f273b3bdc777dca061f6a --- /dev/null +++ b/src/ros_tf_listener-python-module-py.cc @@ -0,0 +1,18 @@ +#include <dynamic-graph/python/module.hh> +#include "ros_tf_listener.hh" + +namespace dg = dynamicgraph; + +BOOST_PYTHON_MODULE(wrap) +{ + bp::import("dynamic_graph"); + + dg::python::exposeEntity<dg::RosTfListener, bp::bases<dg::Entity>, dg::python::AddCommands>() + .def("add", &dg::RosTfListener::add, + "Add a signal containing the transform between two frames.", + bp::args( "to_frame_name", "from_frame_name", "out_signal_name")) + .def("setMaximumDelay", &dg::RosTfListener::setMaximumDelay, + "Set the maximum time delay of the transform obtained from tf.", + bp::args("signal_name", "delay_seconds")) + ; +} diff --git a/src/ros_tf_listener-python.hh b/src/ros_tf_listener-python.hh deleted file mode 100644 index 492d61ffbcaa383d36ecc7d7fd56a89f1bbcf56c..0000000000000000000000000000000000000000 --- a/src/ros_tf_listener-python.hh +++ /dev/null @@ -1,3 +0,0 @@ -#include "ros_tf_listener.hh" - -typedef boost::mpl::vector< dynamicgraph::RosTfListener > entities_t; diff --git a/src/ros_tf_listener.hh b/src/ros_tf_listener.hh index a95907a097aa2d5d732476ecebba5c270bb68b83..778c812a1bfd42b67a6c95687000e568a162e8e2 100644 --- a/src/ros_tf_listener.hh +++ b/src/ros_tf_listener.hh @@ -72,31 +72,11 @@ class RosTfListener : public Entity { : Entity(_name) , buffer() , listener(buffer, rosInit(), false) - { - std::string docstring = - "\n" - " Add a signal containing the transform between two frames.\n" - "\n" - " Input:\n" - " - to : frame name\n" - " - from: frame name,\n" - " - signalName: the signal name in dynamic-graph" - "\n"; - addCommand("add", command::makeCommandVoid3(*this, &RosTfListener::add, docstring)); - docstring = - "\n" - " Set the maximum time delay of the transform obtained from tf.\n" - "\n" - " Input:\n" - " - signalName: the signal name,\n" - " - delay : in seconds\n" - "\n"; - addCommand("setMaximumDelay", command::makeCommandVoid2(*this, &RosTfListener::setMaximumDelay, docstring)); - } + {} ~RosTfListener() { - for (Map_t::const_iterator _it = listenerDatas.begin(); _it != listenerDatas.end(); ++_it) delete _it->second; + for (const auto& pair : listenerDatas) delete pair.second; } void add(const std::string& to, const std::string& from, const std::string& signame)