overlay_diagnostic_display.h
Go to the documentation of this file.
1 // -*- mode: c++; -*-
2 /*********************************************************************
3  * Software License Agreement (BSD License)
4  *
5  * Copyright (c) 2014, JSK Lab
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * * Redistributions of source code must retain the above copyright
13  * notice, this list of conditions and the following disclaimer.
14  * * Redistributions in binary form must reproduce the above
15  * copyright notice, this list of conditions and the following
16  * disclaimer in the documentation and/o2r other materials provided
17  * with the distribution.
18  * * Neither the name of the JSK Lab nor the names of its
19  * contributors may be used to endorse or promote products derived
20  * from this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
32  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  *********************************************************************/
35 #ifndef JSK_RVIZ_PLUGIN_OVERLAY_DIAGNOSTIC_DISPLAY_H_
36 #define JSK_RVIZ_PLUGIN_OVERLAY_DIAGNOSTIC_DISPLAY_H_
37 
38 #ifndef Q_MOC_RUN
39 #include <rviz/display.h>
40 #include <OGRE/OgreTexture.h>
41 #include <OGRE/OgreColourValue.h>
42 #include <OGRE/OgreMaterial.h>
43 
44 #include <QPainter>
45 
52 
53 #include <diagnostic_msgs/DiagnosticArray.h>
54 
55 #include "overlay_utils.h"
56 #endif
57 
58 namespace jsk_rviz_plugins
59 {
61  {
62  Q_OBJECT
63  public:
66  virtual ~OverlayDiagnosticDisplay();
67 
68  // methods for OverlayPickerTool
69  virtual bool isInRegion(int x, int y);
70  virtual void movePosition(int x, int y);
71  virtual void setPosition(int x, int y);
72  virtual int getX() { return left_; };
73  virtual int getY() { return top_; };
74 
75  protected:
76  virtual bool isStalled();
77  virtual void processMessage(
78  const diagnostic_msgs::DiagnosticArray::ConstPtr& msg);
79  virtual void update(float wall_dt, float ros_dt);
80  virtual void onEnable();
81  virtual void onDisable();
82  virtual void onInitialize();
83  virtual void subscribe();
84  virtual void unsubscribe();
85  virtual void redraw();
86  virtual State getLatestState();
87  virtual void drawSAC(QImage& Hud);
88  virtual void drawEVA(QImage& Hud);
89  virtual void drawEVAConnectedRectangle(QPainter& painter,
90  QColor color,
91  QColor small_color,
92  int width);
93  virtual void drawEVANonConnectedRectangle(QPainter& painter,
94  QColor color,
95  QColor small_color,
96  int width,
97  double gap);
98  virtual void fillNamespaceList();
99  virtual QColor foregroundColor();
100  virtual QColor textColor();
101  virtual double textWidth(QPainter& painter, double font_size, const std::string& text);
102  virtual double textHeight(QPainter& painter, double font_size);
103  virtual QColor blendColor(QColor a, QColor b, double a_rate);
104  virtual void drawText(QPainter& painter, QColor fg_color,
105  const std::string& text);
106  virtual double drawAnimatingText(QPainter& painter,
107  QColor fg_color,
108  const double height,
109  const double font_size,
110  const std::string text);
111  // return true if plugin needs to animate
112  virtual bool isAnimating();
113  virtual double animationRate();
114  virtual std::string statusText();
115  boost::mutex mutex_;
117 
118 #if ROS_VERSION_MINIMUM(1,12,0)
119  std::shared_ptr<diagnostic_msgs::DiagnosticStatus> latest_status_;
120 #else
122 #endif
126  int size_;
128  int type_;
129  std::set<std::string> namespaces_;
130  double alpha_;
131  int top_, left_;
132  double t_;
143 
145  protected Q_SLOTS:
146  virtual void updateType();
147  virtual void updateRosTopic();
148  virtual void updateDiagnosticsNamespace();
149  virtual void updateSize();
150  virtual void updateAlpha();
151  virtual void updateTop();
152  virtual void updateLeft();
153  virtual void updateStallDuration();
154  private:
155 
156  };
157 }
158 
159 #endif
msg
virtual double textWidth(QPainter &painter, double font_size, const std::string &text)
virtual void processMessage(const diagnostic_msgs::DiagnosticArray::ConstPtr &msg)
virtual double drawAnimatingText(QPainter &painter, QColor fg_color, const double height, const double font_size, const std::string text)
boost::shared_ptr< diagnostic_msgs::DiagnosticStatus > latest_status_
virtual void update(float wall_dt, float ros_dt)
virtual QColor blendColor(QColor a, QColor b, double a_rate)
width
virtual void drawEVANonConnectedRectangle(QPainter &painter, QColor color, QColor small_color, int width, double gap)
virtual double textHeight(QPainter &painter, double font_size)
virtual void drawEVAConnectedRectangle(QPainter &painter, QColor color, QColor small_color, int width)
rviz::EditableEnumProperty * diagnostics_namespace_property_
virtual void drawText(QPainter &painter, QColor fg_color, const std::string &text)
height


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Sat Mar 20 2021 03:03:18