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/or 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 #include <QPainterPath>
46 
53 
54 #include <diagnostic_msgs/DiagnosticArray.h>
55 
56 #include "overlay_utils.h"
57 #endif
58 
59 namespace jsk_rviz_plugins
60 {
62  {
63  Q_OBJECT
64  public:
67  virtual ~OverlayDiagnosticDisplay();
68 
69  // methods for OverlayPickerTool
70  virtual bool isInRegion(int x, int y);
71  virtual void movePosition(int x, int y);
72  virtual void setPosition(int x, int y);
73  virtual int getX() { return left_; };
74  virtual int getY() { return top_; };
75 
76  protected:
77  virtual bool isStalled();
78  virtual void processMessage(
79  const diagnostic_msgs::DiagnosticArray::ConstPtr& msg);
80  virtual void update(float wall_dt, float ros_dt);
81  virtual void onEnable();
82  virtual void onDisable();
83  virtual void onInitialize();
84  virtual void subscribe();
85  virtual void unsubscribe();
86  virtual void redraw();
87  virtual State getLatestState();
88  virtual void drawSAC(QImage& Hud);
89  virtual void drawEVA(QImage& Hud);
90  virtual void drawEVAConnectedRectangle(QPainter& painter,
91  QColor color,
92  QColor small_color,
93  int width);
94  virtual void drawEVANonConnectedRectangle(QPainter& painter,
95  QColor color,
96  QColor small_color,
97  int width,
98  double gap);
99  virtual void fillNamespaceList();
100  virtual QColor foregroundColor();
101  virtual QColor textColor();
102  virtual double textWidth(QPainter& painter, double font_size, const std::string& text);
103  virtual double textHeight(QPainter& painter, double font_size);
104  virtual QColor blendColor(QColor a, QColor b, double a_rate);
105  virtual void drawText(QPainter& painter, QColor fg_color,
106  const std::string& text);
107  virtual double drawAnimatingText(QPainter& painter,
108  QColor fg_color,
109  const double height,
110  const double font_size,
111  const std::string text);
112  // return true if plugin needs to animate
113  virtual bool isAnimating();
114  virtual double animationRate();
115  virtual std::string statusText();
116  boost::mutex mutex_;
118 
119 #if ROS_VERSION_MINIMUM(1,12,0)
120  std::shared_ptr<diagnostic_msgs::DiagnosticStatus> latest_status_;
121 #else
123 #endif
127  int size_;
129  int type_;
130  std::set<std::string> namespaces_;
131  double alpha_;
132  int top_, left_;
133  double t_;
144 
146  protected Q_SLOTS:
147  virtual void updateType();
148  virtual void updateRosTopic();
149  virtual void updateDiagnosticsNamespace();
150  virtual void updateSize();
151  virtual void updateAlpha();
152  virtual void updateTop();
153  virtual void updateLeft();
154  virtual void updateStallDuration();
155  private:
156 
157  };
158 }
159 
160 #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)
x
y
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 Thu Jun 1 2023 02:45:58