#include <interactive_marker_client.h>
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, SingleClientPtr > | M_SingleClient |
typedef boost::shared_ptr< SingleClient > | SingleClientPtr |
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< StateT > | state_ |
StatusCallback | status_cb_ |
std::string | target_frame_ |
tf2_ros::Buffer & | tf_ |
std::string | topic_ns_ |
ros::Subscriber | update_sub_ |
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.
typedef boost::function< void ( const InitConstPtr& ) > interactive_markers::InteractiveMarkerClient::InitCallback |
Definition at line 83 of file interactive_marker_client.h.
typedef visualization_msgs::InteractiveMarkerInitConstPtr interactive_markers::InteractiveMarkerClient::InitConstPtr |
Definition at line 80 of file interactive_marker_client.h.
|
private |
Definition at line 165 of file interactive_marker_client.h.
typedef boost::function< void ( const std::string& ) > interactive_markers::InteractiveMarkerClient::ResetCallback |
Definition at line 84 of file interactive_marker_client.h.
|
private |
Definition at line 164 of file interactive_marker_client.h.
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.
typedef boost::function< void ( const UpdateConstPtr& ) > interactive_markers::InteractiveMarkerClient::UpdateCallback |
Definition at line 82 of file interactive_marker_client.h.
typedef visualization_msgs::InteractiveMarkerUpdateConstPtr interactive_markers::InteractiveMarkerClient::UpdateConstPtr |
Definition at line 79 of file interactive_marker_client.h.
|
private |
Enumerator | |
---|---|
IDLE | |
INIT | |
RUNNING |
Definition at line 142 of file interactive_marker_client.h.
Enumerator | |
---|---|
OK | |
WARN | |
ERROR |
Definition at line 73 of file interactive_marker_client.h.
interactive_markers::InteractiveMarkerClient::InteractiveMarkerClient | ( | tf2_ros::Buffer & | tf, |
const std::string & | target_frame = "" , |
||
const std::string & | topic_ns = "" |
||
) |
tf | The tf transformer to use. |
target_frame | tf frame to transform timestamped messages into. |
topic_ns | The 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.
|
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.
|
inline |
Definition at line 132 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.
|
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.
|
private |
Definition at line 151 of file interactive_marker_client.cpp.
|
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.
|
private |
Definition at line 212 of file interactive_marker_client.h.
|
private |
Definition at line 221 of file interactive_marker_client.h.
|
private |
Definition at line 154 of file interactive_marker_client.h.
|
private |
Definition at line 218 of file interactive_marker_client.h.
|
private |
Definition at line 140 of file interactive_marker_client.h.
|
private |
Definition at line 166 of file interactive_marker_client.h.
|
private |
Definition at line 167 of file interactive_marker_client.h.
|
private |
Definition at line 149 of file interactive_marker_client.h.
|
private |
Definition at line 215 of file interactive_marker_client.h.
|
private |
Definition at line 170 of file interactive_marker_client.h.
|
private |
Definition at line 169 of file interactive_marker_client.h.
|
private |
Definition at line 151 of file interactive_marker_client.h.
|
private |
Definition at line 153 of file interactive_marker_client.h.