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.
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)%
jsk_rviz_plugins::AmbientSoundDisplay::topic_property_
rviz::ROSTopicStringProperty * topic_property_
Definition: ambient_sound_display_groovy.h:139
jsk_rviz_plugins::AmbientSoundDisplay::updateColorAndAlpha
void updateColorAndAlpha()
Definition: ambient_sound_display.cpp:155
jsk_rviz_plugins::AmbientSoundDisplay::color_property_
rviz::ColorProperty * color_property_
Definition: ambient_sound_display_groovy.h:138
rviz::MessageFilterDisplay
Ogre
jsk_rviz_plugins::AmbientSoundDisplay::onInitialize
virtual void onInitialize()
Definition: ambient_sound_display.cpp:35
ros.h
jsk_rviz_plugins::AmbientSoundDisplay::history_length_property_
rviz::IntProperty * history_length_property_
Definition: ambient_sound_display_groovy.h:141
jsk_rviz_plugins::AmbientSoundDisplay::validateFloats
bool validateFloats(const jsk_hark_msgs::HarkPower &)
Definition: ambient_sound_display_groovy.cpp:147
jsk_rviz_plugins::AmbientSoundDisplay::scale_property_
rviz::FloatProperty * scale_property_
Definition: ambient_sound_display_groovy.h:143
jsk_rviz_plugins::AmbientSoundDisplay::visuals_
boost::circular_buffer< boost::shared_ptr< AmbientSoundVisual > > visuals_
Definition: ambient_sound_display_groovy.h:117
rviz::ColorProperty
rviz::FloatProperty
jsk_rviz_plugins::AmbientSoundDisplay::visuals_
std::vector< AmbientSoundVisual * > visuals_
Definition: ambient_sound_display.h:87
message_filter.h
rviz
ambient_sound_visual.h
subscriber.h
message_filter_display.h
jsk_rviz_plugins::AmbientSoundDisplay::reset
virtual void reset()
Definition: ambient_sound_display.cpp:306
jsk_rviz_plugins::AmbientSoundDisplay::~AmbientSoundDisplay
virtual ~AmbientSoundDisplay()
Definition: ambient_sound_display.cpp:60
jsk_rviz_plugins::AmbientSoundDisplay::width_property_
rviz::FloatProperty * width_property_
Definition: ambient_sound_display_groovy.h:142
jsk_rviz_plugins::AmbientSoundDisplay::AmbientSoundDisplay
AmbientSoundDisplay()
Definition: ambient_sound_display.cpp:21
jsk_rviz_plugins::AmbientSoundDisplay::processMessage
void processMessage(const jsk_hark_msgs::HarkPower::ConstPtr &msg)
Definition: ambient_sound_display_groovy.cpp:213
jsk_rviz_plugins::AmbientSoundDisplay::updateHistoryLength
void updateHistoryLength()
Definition: ambient_sound_display_groovy.cpp:143
jsk_rviz_plugins::AmbientSoundDisplay::updateAppearance
void updateAppearance()
Definition: ambient_sound_display_groovy.cpp:124
jsk_rviz_plugins::AmbientSoundDisplay::grad_property_
rviz::FloatProperty * grad_property_
Definition: ambient_sound_display_groovy.h:145
jsk_rviz_plugins::AmbientSoundDisplay::bias_property_
rviz::FloatProperty * bias_property_
Definition: ambient_sound_display_groovy.h:144
jsk_rviz_plugins::AmbientSoundDisplay::alpha_property_
rviz::FloatProperty * alpha_property_
Definition: ambient_sound_display_groovy.h:140
jsk_rviz_plugins
Definition: __init__.py:1
rviz::IntProperty


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Fri Dec 13 2024 03:49:56