Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef RVIZ_INTERACTIVE_MARKER_DISPLAY_H
00031 #define RVIZ_INTERACTIVE_MARKER_DISPLAY_H
00032
00033 #include <map>
00034 #include <set>
00035
00036 #include <visualization_msgs/InteractiveMarker.h>
00037 #include <visualization_msgs/InteractiveMarkerUpdate.h>
00038 #include <visualization_msgs/InteractiveMarkerInit.h>
00039
00040 #ifndef Q_MOC_RUN
00041 #include <message_filters/subscriber.h>
00042 #include <tf/message_filter.h>
00043 #include <interactive_markers/interactive_marker_client.h>
00044 #endif
00045
00046 #include "rviz/display.h"
00047 #include "rviz/selection/forwards.h"
00048
00049 #include "rviz/default_plugin/interactive_markers/interactive_marker.h"
00050
00051 namespace rviz
00052 {
00053 class BoolProperty;
00054 class Object;
00055 class RosTopicProperty;
00056 class MarkerBase;
00057
00058 typedef boost::shared_ptr<MarkerBase> MarkerBasePtr;
00059 typedef std::pair<std::string, int32_t> MarkerID;
00060
00065 class InteractiveMarkerDisplay : public Display
00066 {
00067 Q_OBJECT
00068 public:
00069 InteractiveMarkerDisplay();
00070
00071 virtual void onInitialize();
00072
00073 virtual void update(float wall_dt, float ros_dt);
00074
00075 virtual void fixedFrameChanged();
00076
00077 virtual void reset();
00078
00079 virtual void setTopic( const QString &topic, const QString &datatype );
00080
00081 protected:
00082 virtual void onEnable();
00083 virtual void onDisable();
00084
00085 protected Q_SLOTS:
00086 void updateTopic();
00087 void updateShowDescriptions();
00088 void updateShowAxes();
00089 void updateShowVisualAids();
00090 void updateEnableTransparency();
00091 void publishFeedback(visualization_msgs::InteractiveMarkerFeedback &feedback);
00092 void onStatusUpdate( StatusProperty::Level level, const std::string& name, const std::string& text );
00093
00094 private:
00095
00096
00097 void subscribe();
00098
00099
00100 void unsubscribe();
00101
00102 void initCb( visualization_msgs::InteractiveMarkerInitConstPtr msg );
00103 void updateCb( visualization_msgs::InteractiveMarkerUpdateConstPtr msg );
00104
00105 void resetCb( std::string server_id );
00106
00107 void statusCb( interactive_markers::InteractiveMarkerClient::StatusT,
00108 const std::string& server_id,
00109 const std::string& msg );
00110
00111 void updateMarkers(
00112 const std::string& server_id,
00113 const std::vector<visualization_msgs::InteractiveMarker>& markers );
00114
00115 void updatePoses(
00116 const std::string& server_id,
00117 const std::vector<visualization_msgs::InteractiveMarkerPose>& marker_poses );
00118
00119 void eraseMarkers(
00120 const std::string& server_id,
00121 const std::vector<std::string>& names );
00122
00123
00124 void processMarkerChanges( const std::vector<visualization_msgs::InteractiveMarker>* markers = NULL,
00125 const std::vector<visualization_msgs::InteractiveMarkerPose>* poses = NULL,
00126 const std::vector<std::string>* erases = NULL );
00127
00128 typedef boost::shared_ptr<InteractiveMarker> IMPtr;
00129 typedef std::map< std::string, IMPtr > M_StringToIMPtr;
00130 typedef std::map< std::string, M_StringToIMPtr > M_StringToStringToIMPtr;
00131 M_StringToStringToIMPtr interactive_markers_;
00132
00133 M_StringToIMPtr& getImMap( std::string server_id );
00134
00135 std::string client_id_;
00136
00137
00138 RosTopicProperty* marker_update_topic_property_;
00139 BoolProperty* show_descriptions_property_;
00140 BoolProperty* show_axes_property_;
00141 BoolProperty* show_visual_aids_property_;
00142 BoolProperty* enable_transparency_property_;
00143
00144 boost::shared_ptr<interactive_markers::InteractiveMarkerClient> im_client_;
00145
00146 ros::Publisher feedback_pub_;
00147
00148 std::string topic_ns_;
00149 };
00150
00151 }
00152
00153 #endif