58 QString::fromStdString( ros::message_traits::datatype<visualization_msgs::Marker>() ),
59 "visualization_msgs::Marker topic to subscribe to. <topic>_array will also" 60 " automatically be subscribed with type visualization_msgs::MarkerArray.",
64 "Advanced: set the size of the incoming Marker message queue. Increasing this is" 65 " useful if your incoming TF data is delayed significantly from your Marker data, " 66 "but it can greatly increase memory usage if the messages are big.",
106 QString key = iter.currentKey();
107 const Config& child = iter.currentChild();
154 if( !marker_topic.empty() )
182 M_IDToMarker::iterator it =
markers_.find(
id );
193 std::vector<MarkerID> to_delete;
196 M_IDToMarker::iterator marker_it =
markers_.begin();
197 M_IDToMarker::iterator marker_end =
markers_.end();
198 for (; marker_it != marker_end; ++marker_it)
200 if (marker_it->first.first == ns)
202 to_delete.push_back(marker_it->first);
207 std::vector<MarkerID>::iterator it = to_delete.begin();
208 std::vector<MarkerID>::iterator end = to_delete.end();
209 for (; it != end; ++it)
218 std::vector<MarkerID> to_delete;
219 M_IDToMarker::iterator marker_it =
markers_.begin();
220 for (; marker_it !=
markers_.end(); ++marker_it)
222 to_delete.push_back(marker_it->first);
225 for (std::vector<MarkerID>::iterator it = to_delete.begin(); it != to_delete.end(); ++it)
233 std::stringstream ss;
234 ss <<
id.first <<
"/" <<
id.second;
235 std::string marker_name = ss.str();
241 std::stringstream ss;
242 ss <<
id.first <<
"/" <<
id.second;
243 std::string marker_name = ss.str();
250 for (
const visualization_msgs::Marker& marker : array->markers)
252 tf_filter_->
add(visualization_msgs::Marker::Ptr(
new visualization_msgs::Marker(marker)));
266 visualization_msgs::Marker::ConstPtr marker = marker_evt.
getConstMessage();
267 if (marker->action == visualization_msgs::Marker::DELETE ||
292 "Contains invalid floating point values (nans or infs)" );
296 switch ( message->action )
298 case visualization_msgs::Marker::ADD:
302 case visualization_msgs::Marker::DELETE:
311 ROS_ERROR(
"Unknown marker action: %d\n", message->action );
317 QString namespace_name = QString::fromStdString( message->ns );
318 M_Namespace::iterator ns_it =
namespaces_.find( namespace_name );
327 ns_it.value()->setValue(
false);
331 if( !ns_it.value()->isEnabled() )
339 M_IDToMarker::iterator it =
markers_.find(
MarkerID(message->ns, message->id) );
344 if ( message->type == marker->getMessage()->type )
359 markers_.insert(std::make_pair(
MarkerID(message->ns, message->id), marker));
365 marker->setMessage(message);
367 if (message->lifetime.toSec() > 0.0001f)
372 if (message->frame_locked)
398 if ( !local_queue.empty() )
400 V_MarkerMessage::iterator message_it = local_queue.begin();
401 V_MarkerMessage::iterator message_end = local_queue.end();
402 for ( ; message_it != message_end; ++message_it )
404 visualization_msgs::Marker::ConstPtr& marker = *message_it;
416 if (marker->expired())
431 for (; it != end; ++it)
434 marker->updateFrameLocked();
462 "Enable/disable all markers in this namespace.",
void setStatusStd(StatusProperty::Level level, const std::string &name, const std::string &text)
Show status level and text, using a std::string. Convenience function which converts std::string to Q...
void processMessage(const visualization_msgs::Marker::ConstPtr &message)
Processes a marker message.
void deleteStatusStd(const std::string &name)
Delete the status entry with the given std::string name. This is thread-safe.
virtual void update(float wall_dt, float ros_dt)
Called periodically by the visualization manager.
virtual void setString(const QString &str)
void processAdd(const visualization_msgs::Marker::ConstPtr &message)
Processes an "Add" marker message.
std::string discoverFailureReason(const std::string &frame_id, const ros::Time &stamp, const std::string &caller_id, tf::FilterFailureReason reason)
Create a description of a transform problem.
void processDelete(const visualization_msgs::Marker::ConstPtr &message)
Processes a "Delete" marker message.
S_MarkerBase frame_locked_markers_
void setMarkerStatus(MarkerID id, StatusLevel level, const std::string &text)
RosTopicProperty * marker_topic_property_
virtual tf::TransformListener * getTFClient() const =0
Convenience function: returns getFrameManager()->getTFClient().
MarkerNamespace(const QString &name, Property *parent_property, MarkerDisplay *owner)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz...
void changed()
Emitted by setValue() just after the value has changed.
void add(const MEvent &evt)
std::vector< visualization_msgs::Marker::ConstPtr > V_MarkerMessage
virtual int getInt() const
Return the internal property value as an integer.
ros::NodeHandle update_nh_
A NodeHandle whose CallbackQueue is run from the main GUI thread (the "update" thread).
A single element of a property tree, with a name, value, description, and possibly children...
IntProperty * queue_size_property_
boost::mutex queue_mutex_
virtual void reset()
Called to tell the display to clear its state.
void incomingMarker(const visualization_msgs::Marker::ConstPtr &marker)
ROS callback notifying us of a new marker.
bool checkMarkerMsg(const visualization_msgs::Marker &marker, MarkerDisplay *owner)
bool isValid()
Return true if the iterator currently points to a valid entry, false if not.
virtual void unsubscribe()
Unsubscribes from the "visualization_marker" "visualization_marker_array" topics. ...
Property specialized to provide max/min enforcement for integers.
Ogre::SceneNode * scene_node_
The Ogre::SceneNode to hold all 3D scene elements shown by this Display.
M_EnabledState namespace_config_enabled_state_
void deleteMarker(MarkerID id)
bool isEnabled() const
Return true if this Display is enabled, false if not.
Configuration data storage class.
Property * namespaces_category_
void incomingMarkerArray(const visualization_msgs::MarkerArray::ConstPtr &array)
Process a MarkerArray message.
QString fixed_frame_
A convenience variable equal to context_->getFixedFrame().
virtual void setQueueSize(uint32_t new_queue_size)
const std::string & getPublisherName() const
MarkerBase * createMarker(int marker_type, MarkerDisplay *owner, DisplayContext *context, Ogre::SceneNode *parent_node)
void deleteMarkersInNamespace(const std::string &ns)
Delete all the markers within the given namespace.
std::pair< std::string, int32_t > MarkerID
bool checkMarkerArrayMsg(const visualization_msgs::MarkerArray &array, MarkerDisplay *owner)
const boost::shared_ptr< ConstMessage > & getConstMessage() const
M_IDToMarker markers_
Map of marker id to the marker info structure.
virtual void removeChildren(int start_index=0, int count=-1)
Remove and delete some or all child Properties. Does not change the value of this Property...
bool validateFloats(const sensor_msgs::CameraInfo &msg)
virtual void reset()
Called to tell the display to clear its state.
V_MarkerMessage message_queue_
virtual void load(const Config &config)
Load the settings for this display from the given Config node, which must be a map.
virtual void onDisable()
Derived classes override this to do the actual work of disabling themselves.
QVariant getValue() const
If this config object is valid and is a Value type, this returns its value. Otherwise it returns an i...
void deleteMarkerStatus(MarkerID id)
virtual void fixedFrameChanged()
Called by setFixedFrame(). Override to respond to changes to fixed_frame_.
Iterator class for looping over all entries in a Map type Config Node.
message_filters::Connection registerFailureCallback(const FailureCallback &callback)
virtual FrameManager * getFrameManager() const =0
Return the FrameManager instance.
ros::Subscriber array_sub_
message_filters::Subscriber< visualization_msgs::Marker > sub_
friend class MarkerNamespace
tf::MessageFilter< visualization_msgs::Marker > * tf_filter_
void failedMarker(const ros::MessageEvent< visualization_msgs::Marker > &marker_evt, tf::FilterFailureReason reason)
S_MarkerBase markers_with_expiration_
virtual void subscribe()
Subscribes to the "visualization_marker" and "visualization_marker_array" topics. ...
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
virtual void load(const Config &config)
Load the settings for this display from the given Config node, which must be a map.
virtual void onEnable()
Derived classes override this to do the actual work of enabling themselves.
MapIterator mapIterator() const
Return a new iterator for looping over key/value pairs.
virtual void setTopic(const QString &topic, const QString &datatype)
Set the ROS topic to listen to for this display.
void deleteAllMarkers()
Delete all known markers to this plugin, regardless of id or namespace.
void subscribe(ros::NodeHandle &nh, const std::string &topic, uint32_t queue_size, const ros::TransportHints &transport_hints=ros::TransportHints(), ros::CallbackQueueInterface *callback_queue=0)
Property(const QString &name=QString(), const QVariant default_value=QVariant(), const QString &description=QString(), Property *parent=0, const char *changed_slot=0, QObject *receiver=0)
Constructor.
Property specialized to provide getter for booleans.
void setTargetFrame(const std::string &target_frame)
Config mapGetChild(const QString &key) const
If the referenced Node is a Map and it has a child with the given key, return a reference to the chil...
bool initialized() const
Returns true if the display has been initialized.
std::string getTopicStd() const
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
Displays "markers" sent in by other ROS nodes on the "visualization_marker" topic.
void clearMarkers()
Removes all the markers.
virtual void setStatus(StatusProperty::Level level, const QString &name, const QString &text)
Show status level and text. This is thread-safe.
virtual QString getName() const
Return the name of this Property as a QString.
Connection registerCallback(const C &callback)
virtual void onInitialize()
Override this function to do subclass-specific initialization.