52 for (
unsigned c=0; c<msg.controls.size(); c++)
55 for (
unsigned m=0; m<msg.controls[c].markers.size(); m++ )
60 valid = valid &&
validateFloats(msg.controls[c].markers[m].points);
69 for (
int c = 0; c < marker.controls.size(); ++c )
72 for (
int m = 0; m < marker.controls[c].markers.size(); ++m )
87 ros::message_traits::datatype<visualization_msgs::InteractiveMarkerUpdate>(),
88 "visualization_msgs::InteractiveMarkerUpdate topic to subscribe to.",
92 "Whether or not to show the descriptions of each Interactive Marker.",
96 "Whether or not to show the axes of each Interactive Marker.",
100 "Whether or not to show visual helpers while moving/rotating Interactive Markers.",
103 "Whether or not to allow transparency for auto-completed markers (e.g. rings and arrows).",
143 size_t idx = update_topic.find(
"/update" );
144 if ( idx != std::string::npos )
146 topic_ns_ = update_topic.substr( 0, idx );
162 std::string feedback_topic =
topic_ns_+
"/feedback";
192 M_StringToStringToIMPtr::iterator server_it;
195 M_StringToIMPtr::iterator im_it;
196 for ( im_it = server_it->second.begin(); im_it != server_it->second.end(); im_it++ )
198 im_it->second->update( wall_dt );
212 return im_map_it->second;
216 const std::string& server_id,
217 const std::vector<visualization_msgs::InteractiveMarker>& markers
222 for (
size_t i=0; i<markers.size(); i++ )
224 const visualization_msgs::InteractiveMarker& marker = markers[i];
235 ROS_WARN_ONCE_NAMED(
"quaternions",
"Interactive marker '%s' contains unnormalized quaternions. " 236 "This warning will only be output once but may be true for others; " 237 "enable DEBUG messages for ros.rviz.quaternions to see more details.",
238 marker.name.c_str() );
239 ROS_DEBUG_NAMED(
"quaternions",
"Interactive marker '%s' contains unnormalized quaternions.",
240 marker.name.c_str() );
242 ROS_DEBUG(
"Processing interactive marker '%s'. %d", marker.name.c_str(), (int)marker.controls.size() );
244 std::map< std::string, IMPtr >::iterator int_marker_entry = im_map.find( marker.name );
246 if ( int_marker_entry == im_map.end() )
249 connect( int_marker_entry->second.get(),
250 SIGNAL( userFeedback(visualization_msgs::InteractiveMarkerFeedback&) ),
252 SLOT(
publishFeedback(visualization_msgs::InteractiveMarkerFeedback&) ));
253 connect( int_marker_entry->second.get(),
259 if ( int_marker_entry->second->processMessage( marker ) )
274 const std::string& server_id,
275 const std::vector<std::string>& erases )
279 for (
size_t i=0; i<erases.size(); i++ )
281 im_map.erase( erases[i] );
287 const std::string& server_id,
288 const std::vector<visualization_msgs::InteractiveMarkerPose>& marker_poses )
292 for (
size_t i=0; i<marker_poses.size(); i++ )
294 const visualization_msgs::InteractiveMarkerPose& marker_pose = marker_poses[i];
305 "Pose message contains invalid quaternions (length not equal to 1)!" );
309 std::map< std::string, IMPtr >::iterator int_marker_entry = im_map.find( marker_pose.name );
311 if ( int_marker_entry != im_map.end() )
313 int_marker_entry->second->processMessage( marker_pose );
345 const std::string& server_id,
346 const std::string& msg )
348 setStatusStd( static_cast<StatusProperty::Level>(status), server_id, msg );
369 M_StringToStringToIMPtr::iterator server_it;
372 M_StringToIMPtr::iterator im_it;
373 for ( im_it = server_it->second.begin(); im_it != server_it->second.end(); im_it++ )
375 im_it->second->setShowDescription( show );
384 M_StringToStringToIMPtr::iterator server_it;
387 M_StringToIMPtr::iterator im_it;
388 for ( im_it = server_it->second.begin(); im_it != server_it->second.end(); im_it++ )
390 im_it->second->setShowAxes( show );
399 M_StringToStringToIMPtr::iterator server_it;
402 M_StringToIMPtr::iterator im_it;
403 for ( im_it = server_it->second.begin(); im_it != server_it->second.end(); im_it++ )
405 im_it->second->setShowVisualAids( show );
std::map< std::string, IMPtr > M_StringToIMPtr
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 deleteStatusStd(const std::string &name)
Delete the status entry with the given std::string name. This is thread-safe.
std::string getNameStd() const
Return the name of this Property as a std::string.
void updateShowVisualAids()
virtual void setString(const QString &str)
virtual void reset()
Called to tell the display to clear its state.
void updateMarkers(const std::string &server_id, const std::vector< visualization_msgs::InteractiveMarker > &markers)
void publish(const boost::shared_ptr< M > &message) const
void statusCb(interactive_markers::InteractiveMarkerClient::StatusT, const std::string &server_id, const std::string &msg)
void initCb(visualization_msgs::InteractiveMarkerInitConstPtr msg)
M_StringToIMPtr & getImMap(std::string server_id)
DisplayContext * context_
This DisplayContext pointer is the main connection a Display has into the rest of rviz...
Ogre::SceneNode * getSceneNode() const
Return the Ogre::SceneNode holding all 3D scene elements shown by this Display.
void eraseMarkers(const std::string &server_id, const std::vector< std::string > &names)
void updateCb(visualization_msgs::InteractiveMarkerUpdateConstPtr msg)
ros::NodeHandle update_nh_
A NodeHandle whose CallbackQueue is run from the main GUI thread (the "update" thread).
BoolProperty * show_descriptions_property_
ROSCPP_DECL const std::string & getName()
BoolProperty * enable_transparency_property_
boost::shared_ptr< interactive_markers::InteractiveMarkerClient > im_client_
void updatePoses(const std::string &server_id, const std::vector< visualization_msgs::InteractiveMarkerPose > &marker_poses)
bool isEnabled() const
Return true if this Display is enabled, false if not.
virtual bool getBool() const
QString fixed_frame_
A convenience variable equal to context_->getFixedFrame().
virtual void onDisable()
Derived classes override this to do the actual work of disabling themselves.
#define ROS_DEBUG_NAMED(name,...)
virtual void setTopic(const QString &topic, const QString &datatype)
Set the ROS topic to listen to for this display.
void publishFeedback(visualization_msgs::InteractiveMarkerFeedback &feedback)
bool validateFloats(const sensor_msgs::CameraInfo &msg)
BoolProperty * show_axes_property_
virtual void reset()
Called to tell the display to clear its state.
void show()
Show this Property in any PropertyTreeWidgets.
virtual void onInitialize()
Override this function to do subclass-specific initialization.
virtual FrameManager * getFrameManager() const =0
Return the FrameManager instance.
void updateShowDescriptions()
tf::TransformListener * getTFClient()
Return the tf::TransformListener used to receive transform data.
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
#define ROS_WARN_ONCE_NAMED(name,...)
BoolProperty * show_visual_aids_property_
RosTopicProperty * marker_update_topic_property_
virtual void onEnable()
Derived classes override this to do the actual work of enabling themselves.
Displays Interactive Markers.
void updateEnableTransparency()
bool validateQuaternions(const visualization_msgs::InteractiveMarker &marker)
ros::Publisher feedback_pub_
virtual void update(float wall_dt, float ros_dt)
Called periodically by the visualization manager.
M_StringToStringToIMPtr interactive_markers_
virtual void fixedFrameChanged()
Called by setFixedFrame(). Override to respond to changes to fixed_frame_.
std::string getTopicStd() const
void onStatusUpdate(StatusProperty::Level level, const std::string &name, const std::string &text)
void resetCb(std::string server_id)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
BoolProperty(const QString &name=QString(), bool default_value=false, const QString &description=QString(), Property *parent=0, const char *changed_slot=0, QObject *receiver=0)
InteractiveMarkerDisplay()