#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 | |
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. | |
void | setResetCb (const ResetCallback &cb) |
Set callback for resetting one server connection. | |
void | setStatusCb (const StatusCallback &cb) |
Set callback for status updates. | |
void | setTargetFrame (std::string target_frame) |
Change the target frame and reset the connection. | |
void | setUpdateCb (const UpdateCallback &cb) |
Set callback for update messages. | |
void | shutdown () |
Unsubscribe, clear queues & call reset callbacks. | |
void | subscribe (std::string topic_ns) |
Subscribe to the topics topic_ns/update and topic_ns/init. | |
void | update () |
Update tf info, call callbacks. | |
~InteractiveMarkerClient () | |
Will cause a 'reset' call for all server ids. | |
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_ |
int | last_num_publishers_ |
ros::NodeHandle | nh_ |
M_SingleClient | publisher_contexts_ |
StateMachine< StateT > | state_ |
StatusCallback | status_cb_ |
std::string | target_frame_ |
tf::Transformer & | 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 66 of file interactive_marker_client.h.
typedef boost::function< void ( const InitConstPtr& ) > interactive_markers::InteractiveMarkerClient::InitCallback |
Definition at line 80 of file interactive_marker_client.h.
typedef visualization_msgs::InteractiveMarkerInitConstPtr interactive_markers::InteractiveMarkerClient::InitConstPtr |
Definition at line 77 of file interactive_marker_client.h.
typedef boost::unordered_map<std::string, SingleClientPtr> interactive_markers::InteractiveMarkerClient::M_SingleClient [private] |
Definition at line 151 of file interactive_marker_client.h.
typedef boost::function< void ( const std::string& ) > interactive_markers::InteractiveMarkerClient::ResetCallback |
Definition at line 81 of file interactive_marker_client.h.
typedef boost::shared_ptr<SingleClient> interactive_markers::InteractiveMarkerClient::SingleClientPtr [private] |
Definition at line 150 of file interactive_marker_client.h.
typedef boost::function< void ( StatusT, const std::string&, const std::string& ) > interactive_markers::InteractiveMarkerClient::StatusCallback |
Definition at line 82 of file interactive_marker_client.h.
typedef boost::function< void ( const UpdateConstPtr& ) > interactive_markers::InteractiveMarkerClient::UpdateCallback |
Definition at line 79 of file interactive_marker_client.h.
typedef visualization_msgs::InteractiveMarkerUpdateConstPtr interactive_markers::InteractiveMarkerClient::UpdateConstPtr |
Definition at line 76 of file interactive_marker_client.h.
enum interactive_markers::InteractiveMarkerClient::StateT [private] |
Definition at line 128 of file interactive_marker_client.h.
Definition at line 70 of file interactive_marker_client.h.
interactive_markers::InteractiveMarkerClient::InteractiveMarkerClient | ( | tf::Transformer & | 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.
Will cause a 'reset' call for all server ids.
Definition at line 62 of file interactive_marker_client.cpp.
void interactive_markers::InteractiveMarkerClient::process | ( | const MsgConstPtrT & | msg | ) | [private] |
Definition at line 168 of file interactive_marker_client.cpp.
void interactive_markers::InteractiveMarkerClient::processInit | ( | const InitConstPtr & | msg | ) |
Definition at line 199 of file interactive_marker_client.cpp.
void interactive_markers::InteractiveMarkerClient::processUpdate | ( | const UpdateConstPtr & | msg | ) |
Definition at line 204 of file interactive_marker_client.cpp.
void interactive_markers::InteractiveMarkerClient::setEnableAutocompleteTransparency | ( | bool | enable | ) | [inline] |
Definition at line 118 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.
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 263 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 150 of file interactive_marker_client.cpp.
void interactive_markers::InteractiveMarkerClient::subscribeUpdate | ( | ) | [private] |
Definition at line 132 of file interactive_marker_client.cpp.
Update tf info, call callbacks.
Definition at line 209 of file interactive_marker_client.cpp.
Definition at line 197 of file interactive_marker_client.h.
Definition at line 206 of file interactive_marker_client.h.
Definition at line 140 of file interactive_marker_client.h.
Definition at line 203 of file interactive_marker_client.h.
Definition at line 126 of file interactive_marker_client.h.
Definition at line 152 of file interactive_marker_client.h.
Definition at line 135 of file interactive_marker_client.h.
Definition at line 200 of file interactive_marker_client.h.
std::string interactive_markers::InteractiveMarkerClient::target_frame_ [private] |
Definition at line 155 of file interactive_marker_client.h.
Definition at line 154 of file interactive_marker_client.h.
std::string interactive_markers::InteractiveMarkerClient::topic_ns_ [private] |
Definition at line 137 of file interactive_marker_client.h.
Definition at line 139 of file interactive_marker_client.h.