ambient_sound_display_groovy.h
Go to the documentation of this file.
1 #ifndef __AMBIENT_SOUND_DISPLAY__
2 #define __AMBIENT_SOUND_DISPLAY__
3 
4 #ifndef Q_MOC_RUN // See: https://bugreports.qt-project.org/browse/QTBUG-22829
6 #include <tf/message_filter.h>
7 #include <jsk_hark_msgs/HarkPower.h>
8 #include <ambient_sound_visual.h>
9 #include <boost/circular_buffer.hpp>
11 #endif
12 
13 #include <ros/ros.h>
14 
15 namespace Ogre
16 {
17 class SceneNode;
18 }
19 
20 namespace rviz
21 {
22  class ColorProperty;
23  class FloatProperty;
24  class IntProperty;
25  class ROSTopicStringProperty;
26 }
27 
28 // All the source in this plugin is in its own namespace. This is not
29 // required but is good practice.
30 namespace jsk_rviz_plugins
31 {
32 
33 class AmbientSoundVisual;
34 
35 //class AmbientSoundDisplay: public rviz::Display
36 class AmbientSoundDisplay: public rviz::MessageFilterDisplay<jsk_hark_msgs::HarkPower>
37 {
38 Q_OBJECT
39 public:
40  // Constructor. pluginlib::ClassLoader creates instances by calling
41  // the default constructor, so make sure you have one.
42  AmbientSoundDisplay();
43  virtual ~AmbientSoundDisplay();
44 
45  // Overrides of public virtual functions from the Display class.
46  virtual void onInitialize();
47  //virtual void fixedFrameChanged();
48  virtual void reset();
49  //virtual void createProperties();
50 
51  // Setter and getter functions for user-editable properties.
52 /*
53  void setTopic(const std::string& topic);
54  const std::string& getTopic() { return topic_; }
55 
56  void setColor( const rviz::Color& color );
57  const rviz::Color& getColor() { return color_; }
58 
59  void setAlpha( float alpha );
60  float getAlpha() { return alpha_; }
61 
62  void setHistoryLength( int history_length );
63  int getHistoryLength() const { return history_length_; }
64 
65  void setWidth( float width );
66  float getWidth() const { return width_; }
67 
68  void setScale( float scale );
69  float getScale() const { return scale_; }
70 
71  void setBias( float bias );
72  float getBias() const { return bias_; }
73 
74  void setGrad( float grad );
75  float getGrad() const { return grad_; }
76 */
77 
78  // Overrides of protected virtual functions from Display. As much
79  // as possible, when Displays are not enabled, they should not be
80  // subscribed to incoming data and should not show anything in the
81  // 3D view. These functions are where these connections are made
82  // and broken.
83 /*
84  protected:
85  virtual void onEnable();
86  virtual void onDisable();
87 */
88 
89 private Q_SLOTS:
90  void updateColorAndAlpha();
91  void updateAppearance();
92  void updateHistoryLength();
93  bool validateFloats( const jsk_hark_msgs::HarkPower& );
94 
95  // Function to handle an incoming ROS message.
96 private:
97  //void incomingMessage( const jsk_hark_msgs::HarkPower::ConstPtr& msg );
98  void processMessage( const jsk_hark_msgs::HarkPower::ConstPtr& msg );
99 
100  // Internal helpers which do the work of subscribing and
101  // unsubscribing from the ROS topic.
102 // void subscribe();
103 // void unsubscribe();
104 
105  // A helper to clear this display back to the initial state.
106  //void clear();
107 
108  // Helper function to apply color and alpha to all visuals.
109 
110  // Storage for the list of visuals. This display supports an
111  // adjustable history length, so we need one visual per history
112  // item.
113  //boost::circular_buffer<AmbientSoundVisual*> visuals_;
114 #if ROS_VERSION_MINIMUM(1,12,0)
115  boost::circular_buffer<std::shared_ptr<AmbientSoundVisual> > visuals_;
116 #else
117  boost::circular_buffer<boost::shared_ptr<AmbientSoundVisual> > visuals_;
118 #endif
119 
120  // A node in the Ogre scene tree to be the parent of all our visuals.
121  //Ogre::SceneNode* scene_node_;
122 
123  // Data input: Subscriber and tf message filter.
124  //message_filters::Subscriber<jsk_hark_msgs::HarkPower> sub_;
125  //tf::MessageFilter<jsk_hark_msgs::HarkPower>* tf_filter_;
126  //int messages_received_;
127 
128  // User-editable property variables.
129 /*
130  rviz::Color color_;
131  std::string topic_;
132  float alpha_;
133  int history_length_;
134  float width_,scale_,bias_,grad_;
135 */
136 
137  // Property objects for user-editable properties.
139  rviz::ROSTopicStringProperty *topic_property_;
146 };
147 // END_TUTORIAL
148 
149 } // end namespace jsk_rviz_plugins
150 
151 #endif // __AMBIENT_SOUND_DISPLAY__
152 // %EndTag(FULL_SOURCE)%
bool validateFloats(const sensor_msgs::CameraInfo &msg)
boost::circular_buffer< boost::shared_ptr< AmbientSoundVisual > > visuals_


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Thu Jun 1 2023 02:45:58