Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
interactive_markers::InteractiveMarkerClient Class Reference

#include <interactive_marker_client.h>

Inheritance diagram for interactive_markers::InteractiveMarkerClient:
Inheritance graph
[legend]

Classes

struct  CbCollection
 

Public Types

typedef boost::function< void(const InitConstPtr &) > InitCallback
 
typedef visualization_msgs::InteractiveMarkerInitConstPtr InitConstPtr
 
typedef boost::function< void(const std::string &) > ResetCallback
 
typedef boost::function< void(StatusT, const std::string &, const std::string &) > StatusCallback
 
enum  StatusT { OK = 0, WARN = 1, ERROR = 2 }
 
typedef boost::function< void(const UpdateConstPtr &) > UpdateCallback
 
typedef visualization_msgs::InteractiveMarkerUpdateConstPtr UpdateConstPtr
 

Public Member Functions

 InteractiveMarkerClient (tf::Transformer &tf, const std::string &target_frame="", const std::string &topic_ns="")
 
void processInit (const InitConstPtr &msg)
 
void processUpdate (const UpdateConstPtr &msg)
 
void setEnableAutocompleteTransparency (bool enable)
 
void setInitCb (const InitCallback &cb)
 Set callback for init messages. More...
 
void setResetCb (const ResetCallback &cb)
 Set callback for resetting one server connection. More...
 
void setStatusCb (const StatusCallback &cb)
 Set callback for status updates. More...
 
void setTargetFrame (std::string target_frame)
 Change the target frame and reset the connection. More...
 
void setUpdateCb (const UpdateCallback &cb)
 Set callback for update messages. More...
 
void shutdown ()
 Unsubscribe, clear queues & call reset callbacks. More...
 
void subscribe (std::string topic_ns)
 Subscribe to the topics topic_ns/update and topic_ns/init. More...
 
void update ()
 Update tf info, call callbacks. More...
 
 ~InteractiveMarkerClient ()
 Will cause a 'reset' call for all server ids. More...
 

Private Types

typedef boost::unordered_map< std::string, SingleClientPtrM_SingleClient
 
typedef boost::shared_ptr< SingleClientSingleClientPtr
 
enum  StateT { IDLE, INIT, RUNNING }
 

Private Member Functions

template<class MsgConstPtrT >
void process (const MsgConstPtrT &msg)
 
void statusCb (StatusT status, const std::string &server_id, const std::string &msg)
 
void subscribeInit ()
 
void subscribeUpdate ()
 

Private Attributes

CbCollection callbacks_
 
bool enable_autocomplete_transparency_
 
ros::Subscriber init_sub_
 
int last_num_publishers_
 
ros::NodeHandle nh_
 
M_SingleClient publisher_contexts_
 
boost::mutex publisher_contexts_mutex_
 
StateMachine< StateTstate_
 
StatusCallback status_cb_
 
std::string target_frame_
 
tf::Transformertf_
 
std::string topic_ns_
 
ros::Subscriber update_sub_
 

Detailed Description

Acts as a client to one or multiple Interactive Marker servers. Handles topic subscription, error detection and tf transformations.

The output is an init message followed by a stream of updates for each server. In case of an error (e.g. message loss, tf failure), the connection to the sending server is reset.

All timestamped messages are being transformed into the target frame, while for non-timestamped messages it is ensured that the necessary tf transformation will be available.

Definition at line 67 of file interactive_marker_client.h.

Member Typedef Documentation

Definition at line 81 of file interactive_marker_client.h.

typedef visualization_msgs::InteractiveMarkerInitConstPtr interactive_markers::InteractiveMarkerClient::InitConstPtr

Definition at line 78 of file interactive_marker_client.h.

typedef boost::unordered_map<std::string, SingleClientPtr> interactive_markers::InteractiveMarkerClient::M_SingleClient
private

Definition at line 152 of file interactive_marker_client.h.

typedef boost::function< void ( const std::string& ) > interactive_markers::InteractiveMarkerClient::ResetCallback

Definition at line 82 of file interactive_marker_client.h.

Definition at line 151 of file interactive_marker_client.h.

typedef boost::function< void ( StatusT, const std::string&, const std::string& ) > interactive_markers::InteractiveMarkerClient::StatusCallback

Definition at line 83 of file interactive_marker_client.h.

Definition at line 80 of file interactive_marker_client.h.

typedef visualization_msgs::InteractiveMarkerUpdateConstPtr interactive_markers::InteractiveMarkerClient::UpdateConstPtr

Definition at line 77 of file interactive_marker_client.h.

Member Enumeration Documentation

Enumerator
IDLE 
INIT 
RUNNING 

Definition at line 129 of file interactive_marker_client.h.

Enumerator
OK 
WARN 
ERROR 

Definition at line 71 of file interactive_marker_client.h.

Constructor & Destructor Documentation

interactive_markers::InteractiveMarkerClient::InteractiveMarkerClient ( tf::Transformer tf,
const std::string &  target_frame = "",
const std::string &  topic_ns = "" 
)
Parameters
tfThe tf transformer to use.
target_frametf frame to transform timestamped messages into.
topic_nsThe topic namespace (will subscribe to topic_ns/update, topic_ns/init)

Definition at line 45 of file interactive_marker_client.cpp.

interactive_markers::InteractiveMarkerClient::~InteractiveMarkerClient ( )

Will cause a 'reset' call for all server ids.

Definition at line 62 of file interactive_marker_client.cpp.

Member Function Documentation

template<class MsgConstPtrT >
void interactive_markers::InteractiveMarkerClient::process ( const MsgConstPtrT &  msg)
private

Definition at line 169 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::processInit ( const InitConstPtr msg)

Definition at line 208 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::processUpdate ( const UpdateConstPtr msg)

Definition at line 213 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::setEnableAutocompleteTransparency ( bool  enable)
inline

Definition at line 119 of file interactive_marker_client.h.

void interactive_markers::InteractiveMarkerClient::setInitCb ( const InitCallback cb)

Set callback for init messages.

Definition at line 75 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::setResetCb ( const ResetCallback cb)

Set callback for resetting one server connection.

Definition at line 85 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::setStatusCb ( const StatusCallback cb)

Set callback for status updates.

Definition at line 90 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::setTargetFrame ( std::string  target_frame)

Change the target frame and reset the connection.

Definition at line 95 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::setUpdateCb ( const UpdateCallback cb)

Set callback for update messages.

Definition at line 80 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::shutdown ( )

Unsubscribe, clear queues & call reset callbacks.

Definition at line 114 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::statusCb ( StatusT  status,
const std::string &  server_id,
const std::string &  msg 
)
private

Definition at line 273 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::subscribe ( std::string  topic_ns)

Subscribe to the topics topic_ns/update and topic_ns/init.

Subscribe to given topic.

Definition at line 68 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::subscribeInit ( )
private

Definition at line 151 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::subscribeUpdate ( )
private

Definition at line 133 of file interactive_marker_client.cpp.

void interactive_markers::InteractiveMarkerClient::update ( )

Update tf info, call callbacks.

Definition at line 218 of file interactive_marker_client.cpp.

Member Data Documentation

CbCollection interactive_markers::InteractiveMarkerClient::callbacks_
private

Definition at line 199 of file interactive_marker_client.h.

bool interactive_markers::InteractiveMarkerClient::enable_autocomplete_transparency_
private

Definition at line 208 of file interactive_marker_client.h.

ros::Subscriber interactive_markers::InteractiveMarkerClient::init_sub_
private

Definition at line 141 of file interactive_marker_client.h.

int interactive_markers::InteractiveMarkerClient::last_num_publishers_
private

Definition at line 205 of file interactive_marker_client.h.

ros::NodeHandle interactive_markers::InteractiveMarkerClient::nh_
private

Definition at line 127 of file interactive_marker_client.h.

M_SingleClient interactive_markers::InteractiveMarkerClient::publisher_contexts_
private

Definition at line 153 of file interactive_marker_client.h.

boost::mutex interactive_markers::InteractiveMarkerClient::publisher_contexts_mutex_
private

Definition at line 154 of file interactive_marker_client.h.

StateMachine<StateT> interactive_markers::InteractiveMarkerClient::state_
private

Definition at line 136 of file interactive_marker_client.h.

StatusCallback interactive_markers::InteractiveMarkerClient::status_cb_
private

Definition at line 202 of file interactive_marker_client.h.

std::string interactive_markers::InteractiveMarkerClient::target_frame_
private

Definition at line 157 of file interactive_marker_client.h.

tf::Transformer& interactive_markers::InteractiveMarkerClient::tf_
private

Definition at line 156 of file interactive_marker_client.h.

std::string interactive_markers::InteractiveMarkerClient::topic_ns_
private

Definition at line 138 of file interactive_marker_client.h.

ros::Subscriber interactive_markers::InteractiveMarkerClient::update_sub_
private

Definition at line 140 of file interactive_marker_client.h.


The documentation for this class was generated from the following files:


interactive_markers
Author(s): David Gossow
autogenerated on Tue Apr 17 2018 03:27:50