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

INTERACTIVE_MARKERS_PUBLIC InteractiveMarkerClient (tf2_ros::Buffer &tf, const std::string &target_frame="", const std::string &topic_ns="")
 
void processInit (const InitConstPtr &msg)
 
void processUpdate (const UpdateConstPtr &msg)
 
INTERACTIVE_MARKERS_PUBLIC void setEnableAutocompleteTransparency (bool enable)
 
INTERACTIVE_MARKERS_PUBLIC void setInitCb (const InitCallback &cb)
 Set callback for init messages. More...
 
INTERACTIVE_MARKERS_PUBLIC void setResetCb (const ResetCallback &cb)
 Set callback for resetting one server connection. More...
 
INTERACTIVE_MARKERS_PUBLIC void setStatusCb (const StatusCallback &cb)
 Set callback for status updates. More...
 
INTERACTIVE_MARKERS_PUBLIC void setTargetFrame (std::string target_frame)
 Change the target frame and reset the connection. More...
 
INTERACTIVE_MARKERS_PUBLIC void setUpdateCb (const UpdateCallback &cb)
 Set callback for update messages. More...
 
INTERACTIVE_MARKERS_PUBLIC void shutdown ()
 Unsubscribe, clear queues & call reset callbacks. More...
 
INTERACTIVE_MARKERS_PUBLIC void subscribe (std::string topic_ns)
 Subscribe to the topics topic_ns/update and topic_ns/init. More...
 
INTERACTIVE_MARKERS_PUBLIC void update ()
 Update tf info, call callbacks. More...
 
INTERACTIVE_MARKERS_PUBLIC ~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_
 
uint32_t last_num_publishers_
 
ros::NodeHandle nh_
 
M_SingleClient publisher_contexts_
 
boost::recursive_mutex publisher_contexts_mutex_
 
StateMachine< StateTstate_
 
StatusCallback status_cb_
 
std::string target_frame_
 
tf2_ros::Buffertf_
 
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 69 of file interactive_marker_client.h.

Member Typedef Documentation

◆ InitCallback

Definition at line 83 of file interactive_marker_client.h.

◆ InitConstPtr

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

Definition at line 80 of file interactive_marker_client.h.

◆ M_SingleClient

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

Definition at line 165 of file interactive_marker_client.h.

◆ ResetCallback

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

Definition at line 84 of file interactive_marker_client.h.

◆ SingleClientPtr

Definition at line 164 of file interactive_marker_client.h.

◆ StatusCallback

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

Definition at line 85 of file interactive_marker_client.h.

◆ UpdateCallback

Definition at line 82 of file interactive_marker_client.h.

◆ UpdateConstPtr

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

Definition at line 79 of file interactive_marker_client.h.

Member Enumeration Documentation

◆ StateT

Enumerator
IDLE 
INIT 
RUNNING 

Definition at line 142 of file interactive_marker_client.h.

◆ StatusT

Enumerator
OK 
WARN 
ERROR 

Definition at line 73 of file interactive_marker_client.h.

Constructor & Destructor Documentation

◆ InteractiveMarkerClient()

interactive_markers::InteractiveMarkerClient::InteractiveMarkerClient ( tf2_ros::Buffer 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.

◆ ~InteractiveMarkerClient()

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

◆ process()

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

Definition at line 169 of file interactive_marker_client.cpp.

◆ processInit()

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

Definition at line 208 of file interactive_marker_client.cpp.

◆ processUpdate()

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

Definition at line 213 of file interactive_marker_client.cpp.

◆ setEnableAutocompleteTransparency()

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

Definition at line 132 of file interactive_marker_client.h.

◆ setInitCb()

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

Set callback for init messages.

Definition at line 75 of file interactive_marker_client.cpp.

◆ setResetCb()

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.

◆ setStatusCb()

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

Set callback for status updates.

Definition at line 90 of file interactive_marker_client.cpp.

◆ setTargetFrame()

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.

◆ setUpdateCb()

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

Set callback for update messages.

Definition at line 80 of file interactive_marker_client.cpp.

◆ shutdown()

void interactive_markers::InteractiveMarkerClient::shutdown ( )

Unsubscribe, clear queues & call reset callbacks.

Definition at line 114 of file interactive_marker_client.cpp.

◆ statusCb()

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.

◆ subscribe()

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.

◆ subscribeInit()

void interactive_markers::InteractiveMarkerClient::subscribeInit ( )
private

Definition at line 151 of file interactive_marker_client.cpp.

◆ subscribeUpdate()

void interactive_markers::InteractiveMarkerClient::subscribeUpdate ( )
private

Definition at line 133 of file interactive_marker_client.cpp.

◆ update()

void interactive_markers::InteractiveMarkerClient::update ( )

Update tf info, call callbacks.

Definition at line 218 of file interactive_marker_client.cpp.

Member Data Documentation

◆ callbacks_

CbCollection interactive_markers::InteractiveMarkerClient::callbacks_
private

Definition at line 212 of file interactive_marker_client.h.

◆ enable_autocomplete_transparency_

bool interactive_markers::InteractiveMarkerClient::enable_autocomplete_transparency_
private

Definition at line 221 of file interactive_marker_client.h.

◆ init_sub_

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

Definition at line 154 of file interactive_marker_client.h.

◆ last_num_publishers_

uint32_t interactive_markers::InteractiveMarkerClient::last_num_publishers_
private

Definition at line 218 of file interactive_marker_client.h.

◆ nh_

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

Definition at line 140 of file interactive_marker_client.h.

◆ publisher_contexts_

M_SingleClient interactive_markers::InteractiveMarkerClient::publisher_contexts_
private

Definition at line 166 of file interactive_marker_client.h.

◆ publisher_contexts_mutex_

boost::recursive_mutex interactive_markers::InteractiveMarkerClient::publisher_contexts_mutex_
private

Definition at line 167 of file interactive_marker_client.h.

◆ state_

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

Definition at line 149 of file interactive_marker_client.h.

◆ status_cb_

StatusCallback interactive_markers::InteractiveMarkerClient::status_cb_
private

Definition at line 215 of file interactive_marker_client.h.

◆ target_frame_

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

Definition at line 170 of file interactive_marker_client.h.

◆ tf_

tf2_ros::Buffer& interactive_markers::InteractiveMarkerClient::tf_
private

Definition at line 169 of file interactive_marker_client.h.

◆ topic_ns_

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

Definition at line 151 of file interactive_marker_client.h.

◆ update_sub_

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

Definition at line 153 of file interactive_marker_client.h.


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


interactive_markers
Author(s): David Gossow, William Woodall
autogenerated on Fri Oct 27 2023 02:31:54