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 protected:
00080 virtual void onEnable();
00081 virtual void onDisable();
00082
00083 protected Q_SLOTS:
00084 void updateTopic();
00085 void updateShowDescriptions();
00086 void updateShowAxes();
00087 void updateShowVisualAids();
00088 void updateEnableTransparency();
00089 void publishFeedback(visualization_msgs::InteractiveMarkerFeedback &feedback);
00090 void onStatusUpdate( StatusProperty::Level level, const std::string& name, const std::string& text );
00091
00092 private:
00093
00094
00095 void subscribe();
00096
00097
00098 void unsubscribe();
00099
00100 void initCb( visualization_msgs::InteractiveMarkerInitConstPtr msg );
00101 void updateCb( visualization_msgs::InteractiveMarkerUpdateConstPtr msg );
00102
00103 void resetCb( std::string server_id );
00104
00105 void statusCb( interactive_markers::InteractiveMarkerClient::StatusT,
00106 const std::string& server_id,
00107 const std::string& msg );
00108
00109 void updateMarkers(
00110 const std::string& server_id,
00111 const std::vector<visualization_msgs::InteractiveMarker>& markers );
00112
00113 void updatePoses(
00114 const std::string& server_id,
00115 const std::vector<visualization_msgs::InteractiveMarkerPose>& marker_poses );
00116
00117 void eraseMarkers(
00118 const std::string& server_id,
00119 const std::vector<std::string>& names );
00120
00121
00122 void processMarkerChanges( const std::vector<visualization_msgs::InteractiveMarker>* markers = NULL,
00123 const std::vector<visualization_msgs::InteractiveMarkerPose>* poses = NULL,
00124 const std::vector<std::string>* erases = NULL );
00125
00126 typedef boost::shared_ptr<InteractiveMarker> IMPtr;
00127 typedef std::map< std::string, IMPtr > M_StringToIMPtr;
00128 typedef std::map< std::string, M_StringToIMPtr > M_StringToStringToIMPtr;
00129 M_StringToStringToIMPtr interactive_markers_;
00130
00131 M_StringToIMPtr& getImMap( std::string server_id );
00132
00133 std::string client_id_;
00134
00135
00136 RosTopicProperty* marker_update_topic_property_;
00137 BoolProperty* show_descriptions_property_;
00138 BoolProperty* show_axes_property_;
00139 BoolProperty* show_visual_aids_property_;
00140 BoolProperty* enable_transparency_property_;
00141
00142 boost::shared_ptr<interactive_markers::InteractiveMarkerClient> im_client_;
00143
00144 ros::Publisher feedback_pub_;
00145
00146 std::string topic_ns_;
00147 };
00148
00149 }
00150
00151 #endif