51 for (
unsigned c = 0; c < msg.controls.size(); c++)
54 for (
unsigned m = 0; m < msg.controls[c].markers.size(); m++)
59 valid = valid &&
validateFloats(msg.controls[c].markers[m].points);
69 for (
size_t c = 0; c < marker.controls.size(); ++c)
73 for (
size_t m = 0; m < marker.controls[c].markers.size(); ++m)
87 "Update Topic",
"", ros::message_traits::datatype<visualization_msgs::InteractiveMarkerUpdate>(),
88 "visualization_msgs::InteractiveMarkerUpdate topic to subscribe to.",
this, SLOT(
updateTopic()));
92 "Whether or not to show the descriptions of each Interactive Marker.",
this,
96 new BoolProperty(
"Show Axes",
false,
"Whether or not to show the axes of each Interactive Marker.",
100 "Show Visual Aids",
false,
101 "Whether or not to show visual helpers while moving/rotating Interactive Markers.",
this,
104 "Enable Transparency",
true,
105 "Whether or not to allow transparency for auto-completed markers (e.g. rings and arrows).",
this,
113 #pragma GCC diagnostic push 114 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 120 #pragma GCC diagnostic pop 155 size_t idx = update_topic.find(
"/update");
156 if (idx != std::string::npos)
173 std::string feedback_topic =
topic_ns_ +
"/feedback";
175 update_nh_.
advertise<visualization_msgs::InteractiveMarkerFeedback>(feedback_topic, 100,
false);
186 const std::string& name,
187 const std::string& text)
206 M_StringToStringToIMPtr::iterator server_it;
209 M_StringToIMPtr::iterator im_it;
210 for (im_it = server_it->second.begin(); im_it != server_it->second.end(); im_it++)
212 im_it->second->update(wall_dt);
226 return im_map_it->second;
230 const std::string& server_id,
231 const std::vector<visualization_msgs::InteractiveMarker>& markers)
235 for (
size_t i = 0; i < markers.size(); i++)
237 const visualization_msgs::InteractiveMarker& marker = markers[i];
250 "Interactive marker '%s' contains unnormalized quaternions. " 251 "This warning will only be output once but may be true for others; " 252 "enable DEBUG messages for ros.rviz.quaternions to see more details.",
253 marker.name.c_str());
254 ROS_DEBUG_NAMED(
"quaternions",
"Interactive marker '%s' contains unnormalized quaternions.",
255 marker.name.c_str());
257 ROS_DEBUG(
"Processing interactive marker '%s'. %d", marker.name.c_str(), (int)marker.controls.size());
259 std::map<std::string, IMPtr>::iterator int_marker_entry = im_map.find(marker.name);
261 if (int_marker_entry == im_map.end())
267 connect(int_marker_entry->second.get(),
268 SIGNAL(userFeedback(visualization_msgs::InteractiveMarkerFeedback&)),
this,
269 SLOT(
publishFeedback(visualization_msgs::InteractiveMarkerFeedback&)));
270 connect(int_marker_entry->second.get(),
275 if (int_marker_entry->second->processMessage(marker))
290 const std::vector<std::string>& erases)
294 for (
size_t i = 0; i < erases.size(); i++)
296 im_map.erase(erases[i]);
302 const std::string& server_id,
303 const std::vector<visualization_msgs::InteractiveMarkerPose>& marker_poses)
307 for (
size_t i = 0; i < marker_poses.size(); i++)
309 const visualization_msgs::InteractiveMarkerPose& marker_pose = marker_poses[i];
320 "Pose message contains invalid quaternions (length not equal to 1)!");
324 std::map<std::string, IMPtr>::iterator int_marker_entry = im_map.find(marker_pose.name);
326 if (int_marker_entry != im_map.end())
328 int_marker_entry->second->processMessage(marker_pose);
333 "Pose received for non-existing marker '" + marker_pose.name);
360 const std::string& server_id,
361 const std::string& msg)
363 setStatusStd(static_cast<StatusProperty::Level>(status), server_id, msg);
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->setShowDescription(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->setShowAxes(show);
414 M_StringToStringToIMPtr::iterator server_it;
417 M_StringToIMPtr::iterator im_it;
418 for (im_it = server_it->second.begin(); im_it != server_it->second.end(); im_it++)
420 im_it->second->setShowVisualAids(show);
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.
void updateShowVisualAids()
virtual void setString(const QString &str)
void updateMarkers(const std::string &server_id, const std::vector< visualization_msgs::InteractiveMarker > &markers)
void setTopic(const QString &topic, const QString &datatype) override
Set the ROS topic to listen to for this display.
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...
void fixedFrameChanged() override
Called by setFixedFrame(). Override to respond to changes to fixed_frame_.
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).
void onEnable() override
Derived classes override this to do the actual work of enabling themselves.
BoolProperty * show_descriptions_property_
ROSCPP_DECL const std::string & getName()
void onDisable() override
Derived classes override this to do the actual work of disabling themselves.
BoolProperty * enable_transparency_property_
boost::shared_ptr< interactive_markers::InteractiveMarkerClient > im_client_
std::string getTopicStd() const
void statusCb(interactive_markers::InteractiveMarkerClient::StatusT status, const std::string &server_id, const std::string &msg)
void updatePoses(const std::string &server_id, const std::vector< visualization_msgs::InteractiveMarkerPose > &marker_poses)
QString fixed_frame_
A convenience variable equal to context_->getFixedFrame().
#define ROS_DEBUG_NAMED(name,...)
void publish(const boost::shared_ptr< M > &message) const
std::map< std::string, IMPtr > M_StringToIMPtr
void publishFeedback(visualization_msgs::InteractiveMarkerFeedback &feedback)
bool validateFloats(const sensor_msgs::CameraInfo &msg)
BoolProperty * show_axes_property_
Ogre::SceneNode * getSceneNode() const
Return the Ogre::SceneNode holding all 3D scene elements shown by this Display.
virtual void reset()
Called to tell the display to clear its state.
void show()
Show this Property in any PropertyTreeWidgets.
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_
std::string getNameStd() const
Return the name of this Property as a std::string.
RosTopicProperty * marker_update_topic_property_
BoolProperty(const QString &name=QString(), bool default_value=false, const QString &description=QString(), Property *parent=nullptr, const char *changed_slot=nullptr, QObject *receiver=nullptr)
Displays Interactive Markers.
bool isEnabled() const
Return true if this Display is enabled, false if not.
void reset() override
Called to tell the display to clear its state.
void updateEnableTransparency()
bool validateQuaternions(const visualization_msgs::InteractiveMarker &marker)
ros::Publisher feedback_pub_
M_StringToStringToIMPtr interactive_markers_
void update(float wall_dt, float ros_dt) override
Called periodically by the visualization manager.
void onStatusUpdate(StatusProperty::Level level, const std::string &name, const std::string &text)
virtual bool getBool() const
void resetCb(std::string server_id)
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void onInitialize() override
Override this function to do subclass-specific initialization.
InteractiveMarkerDisplay()