35 #include <boost/bind.hpp> 36 #include <boost/make_shared.hpp> 39 #define DBG_MSG( ... ) ROS_DEBUG( __VA_ARGS__ ); 48 const std::string &topic_ns )
49 : state_(
"InteractiveMarkerClient",IDLE)
51 , last_num_publishers_(0)
52 , enable_autocomplete_transparency_(true)
55 if ( !topic_ns.empty() )
158 DBG_MSG(
"Subscribed to init topic: %s", (
topic_ns_+
"/update_full").c_str() );
168 template<
class MsgConstPtrT>
174 if ( msg->server_id.empty() )
191 DBG_MSG(
"New publisher detected: %s", msg->server_id.c_str() );
201 client = context_it->second;
210 process<InitConstPtr>(msg);
215 process<UpdateConstPtr>(msg);
240 bool initialized =
true;
242 M_SingleClient::iterator it;
250 single_client->update();
251 if ( !single_client->isInitialized() )
278 DBG_MSG(
"%s: %s (Status: OK)", server_id.c_str(), msg.c_str() );
281 DBG_MSG(
"%s: %s (Status: WARNING)", server_id.c_str(), msg.c_str() );
284 DBG_MSG(
"%s: %s (Status: ERROR)", server_id.c_str(), msg.c_str() );
visualization_msgs::InteractiveMarkerInitConstPtr InitConstPtr
void setResetCb(ResetCallback reset_cb)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
void processInit(const InitConstPtr &msg)
INTERACTIVE_MARKERS_PUBLIC void shutdown()
Unsubscribe, clear queues & call reset callbacks.
std::string target_frame_
StatusCallback status_cb_
INTERACTIVE_MARKERS_PUBLIC void setInitCb(const InitCallback &cb)
Set callback for init messages.
boost::function< void(StatusT, const std::string &, const std::string &) > StatusCallback
boost::function< void(const InitConstPtr &) > InitCallback
INTERACTIVE_MARKERS_PUBLIC void setResetCb(const ResetCallback &cb)
Set callback for resetting one server connection.
INTERACTIVE_MARKERS_PUBLIC void subscribe(std::string topic_ns)
Subscribe to the topics topic_ns/update and topic_ns/init.
INTERACTIVE_MARKERS_PUBLIC void setUpdateCb(const UpdateCallback &cb)
Set callback for update messages.
INTERACTIVE_MARKERS_PUBLIC void setStatusCb(const StatusCallback &cb)
Set callback for status updates.
INTERACTIVE_MARKERS_PUBLIC InteractiveMarkerClient(tf::Transformer &tf, const std::string &target_frame="", const std::string &topic_ns="")
uint32_t getNumPublishers() const
StateMachine< StateT > state_
boost::mutex publisher_contexts_mutex_
INTERACTIVE_MARKERS_PUBLIC ~InteractiveMarkerClient()
Will cause a 'reset' call for all server ids.
void setInitCb(InitCallback init_cb)
void processUpdate(const UpdateConstPtr &msg)
bool enable_autocomplete_transparency_
ros::Subscriber init_sub_
ros::Subscriber update_sub_
boost::function< void(const std::string &) > ResetCallback
visualization_msgs::InteractiveMarkerUpdateConstPtr UpdateConstPtr
void statusCb(StatusT status, const std::string &server_id, const std::string &msg)
void process(const MsgConstPtrT &msg)
INTERACTIVE_MARKERS_PUBLIC void update()
Update tf info, call callbacks.
M_SingleClient publisher_contexts_
void setUpdateCb(UpdateCallback update_cb)
boost::function< void(const UpdateConstPtr &) > UpdateCallback
void setStatusCb(StatusCallback status_cb)
void statusCb(StatusT s, const std::string &id, const std::string &m) const
INTERACTIVE_MARKERS_PUBLIC void setTargetFrame(std::string target_frame)
Change the target frame and reset the connection.