10 #ifndef DYNAMIC_GRAPH_ROS_PUBLISH_HXX 11 #define DYNAMIC_GRAPH_ROS_PUBLISH_HXX 12 #include <std_msgs/Float64.h> 15 #include "dynamic_graph_manager/Matrix.h" 16 #include "dynamic_graph_manager/Vector.h" 25 inline void RosPublish::sendData<std::pair<MatrixHomogeneous, Vector> >(
26 boost::shared_ptr<realtime_tools::RealtimePublisher<
27 DgToRos<std::pair<MatrixHomogeneous, Vector> >::ros_t> > publisher,
29 DgToRos<std::pair<MatrixHomogeneous, Vector> >::signalIn_t> signal,
32 DgToRos<std::pair<MatrixHomogeneous, Vector> >::ros_t result;
33 if (publisher->trylock())
35 publisher->msg_.child_frame_id =
"/dynamic_graph/world";
36 converter(publisher->msg_, signal->access(time));
37 publisher->unlockAndPublish();
42 void RosPublish::sendData(
43 boost::shared_ptr<realtime_tools::RealtimePublisher<
44 typename DgToRos<T>::ros_t> > publisher,
45 boost::shared_ptr<
typename DgToRos<T>::signalIn_t> signal,
48 typename DgToRos<T>::ros_t result;
49 if (publisher->trylock())
51 converter(publisher->msg_, signal->access(time));
52 publisher->unlockAndPublish();
57 void RosPublish::add(
const std::string& signal,
const std::string& topic)
59 typedef typename DgToRos<T>::ros_t ros_t;
60 typedef typename DgToRos<T>::signalIn_t signal_t;
63 bindedSignal_t bindedSignal;
66 boost::shared_ptr<realtime_tools::RealtimePublisher<ros_t> > pubPtr =
67 boost::make_shared<realtime_tools::RealtimePublisher<ros_t> >(
71 boost::shared_ptr<signal_t> signalPtr(
new signal_t(
72 0, MAKE_SIGNAL_STRING(name,
true, DgToRos<T>::signalTypeName, signal)));
73 boost::get<0>(bindedSignal) = signalPtr;
74 DgToRos<T>::setDefault(*signalPtr);
75 signalRegistration(*boost::get<0>(bindedSignal));
79 boost::bind(&RosPublish::sendData<T>,
this, pubPtr, signalPtr, _1);
80 boost::get<1>(bindedSignal) = callback;
82 bindedSignal_[signal] = bindedSignal;
this is this package namespace in order to avoid naming conflict
Definition: device.hh:22
void converter(D &dst, const S &src)
Handle ROS <-> dynamic-graph conversion.