#include <interactive_marker_server.h>
Classes | |
struct | MarkerContext |
struct | UpdateContext |
Public Types | |
typedef boost::function< void(const FeedbackConstPtr &) > | FeedbackCallback |
typedef visualization_msgs::InteractiveMarkerFeedbackConstPtr | FeedbackConstPtr |
Public Member Functions | |
INTERACTIVE_MARKERS_PUBLIC void | applyChanges () |
INTERACTIVE_MARKERS_PUBLIC void | clear () |
INTERACTIVE_MARKERS_PUBLIC bool | empty () const |
INTERACTIVE_MARKERS_PUBLIC bool | erase (const std::string &name) |
INTERACTIVE_MARKERS_PUBLIC bool | get (std::string name, visualization_msgs::InteractiveMarker &int_marker) const |
INTERACTIVE_MARKERS_PUBLIC void | insert (const visualization_msgs::InteractiveMarker &int_marker) |
INTERACTIVE_MARKERS_PUBLIC void | insert (const visualization_msgs::InteractiveMarker &int_marker, FeedbackCallback feedback_cb, uint8_t feedback_type=DEFAULT_FEEDBACK_CB) |
INTERACTIVE_MARKERS_PUBLIC | InteractiveMarkerServer (const std::string &topic_ns, const std::string &server_id="", bool spin_thread=false) |
INTERACTIVE_MARKERS_PUBLIC bool | setCallback (const std::string &name, FeedbackCallback feedback_cb, uint8_t feedback_type=DEFAULT_FEEDBACK_CB) |
INTERACTIVE_MARKERS_PUBLIC bool | setPose (const std::string &name, const geometry_msgs::Pose &pose, const std_msgs::Header &header=std_msgs::Header()) |
INTERACTIVE_MARKERS_PUBLIC std::size_t | size () const |
INTERACTIVE_MARKERS_PUBLIC | ~InteractiveMarkerServer () |
Destruction of the interface will lead to all managed markers being cleared. More... | |
Static Public Attributes | |
static const uint8_t | DEFAULT_FEEDBACK_CB = 255 |
Private Types | |
typedef boost::unordered_map< std::string, MarkerContext > | M_MarkerContext |
typedef boost::unordered_map< std::string, UpdateContext > | M_UpdateContext |
Private Member Functions | |
void | doSetPose (M_UpdateContext::iterator update_it, const std::string &name, const geometry_msgs::Pose &pose, const std_msgs::Header &header) |
void | keepAlive () |
void | processFeedback (const FeedbackConstPtr &feedback) |
void | publish (visualization_msgs::InteractiveMarkerUpdate &update) |
void | publishInit () |
void | spinThread () |
Private Attributes | |
ros::CallbackQueue | callback_queue_ |
ros::Subscriber | feedback_sub_ |
ros::Publisher | init_pub_ |
ros::Timer | keep_alive_timer_ |
M_MarkerContext | marker_contexts_ |
boost::recursive_mutex | mutex_ |
volatile bool | need_to_terminate_ |
ros::NodeHandle | node_handle_ |
M_UpdateContext | pending_updates_ |
uint64_t | seq_num_ |
std::string | server_id_ |
boost::scoped_ptr< boost::thread > | spin_thread_ |
std::string | topic_ns_ |
ros::Publisher | update_pub_ |
Acts as a server to one or many GUIs (e.g. rviz) displaying a set of interactive markers
Note: Keep in mind that changes made by calling insert(), erase(), setCallback() etc. are not applied until calling applyChanges().
Definition at line 57 of file interactive_marker_server.h.
typedef boost::function< void ( const FeedbackConstPtr& ) > interactive_markers::InteractiveMarkerServer::FeedbackCallback |
Definition at line 62 of file interactive_marker_server.h.
typedef visualization_msgs::InteractiveMarkerFeedbackConstPtr interactive_markers::InteractiveMarkerServer::FeedbackConstPtr |
Definition at line 61 of file interactive_marker_server.h.
|
private |
Definition at line 170 of file interactive_marker_server.h.
|
private |
Definition at line 185 of file interactive_marker_server.h.
interactive_markers::InteractiveMarkerServer::InteractiveMarkerServer | ( | const std::string & | topic_ns, |
const std::string & | server_id = "" , |
||
bool | spin_thread = false |
||
) |
topic_ns | The interface will use the topics topic_ns/update and topic_ns/feedback for communication. |
server_id | If you run multiple servers on the same topic from within the same node, you will need to assign different names to them. Otherwise, leave this empty. |
spin_thread | If set to true, will spin up a thread for message handling. All callbacks will be called from that thread. |
Definition at line 42 of file interactive_marker_server.cpp.
interactive_markers::InteractiveMarkerServer::~InteractiveMarkerServer | ( | ) |
Destruction of the interface will lead to all managed markers being cleared.
Definition at line 81 of file interactive_marker_server.cpp.
void interactive_markers::InteractiveMarkerServer::applyChanges | ( | ) |
Apply changes made since the last call to this method & broadcast an update to all clients.
Definition at line 110 of file interactive_marker_server.cpp.
void interactive_markers::InteractiveMarkerServer::clear | ( | ) |
Clear all markers. Note: This change will not take effect until you call applyChanges().
Definition at line 205 of file interactive_marker_server.cpp.
|
private |
Definition at line 479 of file interactive_marker_server.cpp.
bool interactive_markers::InteractiveMarkerServer::empty | ( | ) | const |
Return whether the server contains any markers. Note: Does not include markers inserted since the last applyChanges().
Definition at line 219 of file interactive_marker_server.cpp.
bool interactive_markers::InteractiveMarkerServer::erase | ( | const std::string & | name | ) |
Erase the marker with the specified name Note: This change will not take effect until you call applyChanges().
name | Name of the interactive marker |
Definition at line 192 of file interactive_marker_server.cpp.
bool interactive_markers::InteractiveMarkerServer::get | ( | std::string | name, |
visualization_msgs::InteractiveMarker & | int_marker | ||
) | const |
Get marker by name
name | Name of the interactive marker | |
[out] | int_marker | Output message |
Definition at line 347 of file interactive_marker_server.cpp.
void interactive_markers::InteractiveMarkerServer::insert | ( | const visualization_msgs::InteractiveMarker & | int_marker | ) |
Add or replace a marker without changing its callback functions. Note: Changes to the marker will not take effect until you call applyChanges(). The callback changes immediately.
int_marker | The marker to be added or replaced |
Definition at line 325 of file interactive_marker_server.cpp.
void interactive_markers::InteractiveMarkerServer::insert | ( | const visualization_msgs::InteractiveMarker & | int_marker, |
FeedbackCallback | feedback_cb, | ||
uint8_t | feedback_type = DEFAULT_FEEDBACK_CB |
||
) |
Add or replace a marker and its callback functions Note: Changes to the marker will not take effect until you call applyChanges(). The callback changes immediately.
int_marker | The marker to be added or replaced |
feedback_cb | Function to call on the arrival of a feedback message. |
feedback_type | Type of feedback for which to call the feedback. |
Definition at line 339 of file interactive_marker_server.cpp.
|
private |
Definition at line 463 of file interactive_marker_server.cpp.
|
private |
Definition at line 410 of file interactive_marker_server.cpp.
|
private |
Definition at line 471 of file interactive_marker_server.cpp.
|
private |
Definition at line 391 of file interactive_marker_server.cpp.
bool interactive_markers::InteractiveMarkerServer::setCallback | ( | const std::string & | name, |
FeedbackCallback | feedback_cb, | ||
uint8_t | feedback_type = DEFAULT_FEEDBACK_CB |
||
) |
Add or replace a callback function for the specified marker. Note: This change will not take effect until you call applyChanges(). The server will try to call any type-specific callback first. If none is set, it will call the default callback. If a callback for the given type already exists, it will be replaced. To unset a type-specific callback, pass in an empty one.
name | Name of the interactive marker |
feedback_cb | Function to call on the arrival of a feedback message. |
feedback_type | Type of feedback for which to call the feedback. Leave this empty to make this the default callback. |
Definition at line 269 of file interactive_marker_server.cpp.
bool interactive_markers::InteractiveMarkerServer::setPose | ( | const std::string & | name, |
const geometry_msgs::Pose & | pose, | ||
const std_msgs::Header & | header = std_msgs::Header() |
||
) |
Update the pose of a marker with the specified name Note: This change will not take effect until you call applyChanges()
name | Name of the interactive marker |
pose | The new pose |
header | Header replacement. Leave this empty to use the previous one. |
Definition at line 231 of file interactive_marker_server.cpp.
std::size_t interactive_markers::InteractiveMarkerServer::size | ( | ) | const |
Return the number of markers contained in the server Note: Does not include markers inserted since the last applyChanges().
Definition at line 225 of file interactive_marker_server.cpp.
|
private |
Definition at line 97 of file interactive_marker_server.cpp.
|
private |
Definition at line 224 of file interactive_marker_server.h.
|
static |
Definition at line 64 of file interactive_marker_server.h.
|
private |
Definition at line 232 of file interactive_marker_server.h.
|
private |
Definition at line 230 of file interactive_marker_server.h.
|
private |
Definition at line 228 of file interactive_marker_server.h.
|
private |
Definition at line 211 of file interactive_marker_server.h.
|
mutableprivate |
Definition at line 219 of file interactive_marker_server.h.
|
private |
Definition at line 225 of file interactive_marker_server.h.
|
private |
Definition at line 223 of file interactive_marker_server.h.
|
private |
Definition at line 214 of file interactive_marker_server.h.
|
private |
Definition at line 234 of file interactive_marker_server.h.
|
private |
Definition at line 236 of file interactive_marker_server.h.
|
private |
Definition at line 222 of file interactive_marker_server.h.
|
private |
Definition at line 217 of file interactive_marker_server.h.
|
private |
Definition at line 231 of file interactive_marker_server.h.