45 width_padding_(5), height_padding_(5)
49 ros::message_traits::datatype<std_msgs::Float32>(),
50 "std_msgs::Float32 topic to subscribe to.",
54 "Show value on plotter",
58 "Vertical Gauge",
false,
63 "width of the plotter window",
68 "height of the plotter window",
73 "left of the plotter window",
77 "top of the plotter window",
83 "max value, used only if auto scale is disabled",
87 "min value, used only if auto scale is disabled",
90 "foreground color", QColor(25, 255, 240),
94 "foreground alpha", 0.7,
95 "alpha belnding value for foreground",
100 "background color", QColor(0, 0, 0),
104 "backround alpha", 0.0,
105 "alpha belnding value for background",
110 "linewidth of the plot",
116 "show border or not",
119 "text size of the caption",
124 "show caption",
true,
125 "show caption or not",
128 "update interval", 0.04,
129 "update interval of the plotter",
136 "change the color automatically",
142 "only used if auto color change is set to True.",
173 static int count = 0;
175 ss <<
"LinearGaugeDisplayObject" << count++;
205 double max_gauge_length = 0.0;
215 double r2 = (r - 0.3) / 0.7;
229 for (
int i = 0; i <
overlay_->getTextureWidth(); i++) {
230 for (
int j = 0; j <
overlay_->getTextureHeight(); j++) {
231 Hud.setPixel(i, j, bg_color.rgba());
236 QPainter painter( &Hud );
237 painter.setRenderHint(QPainter::Antialiasing,
true);
238 painter.setPen(QPen(fg_color,
line_width_, Qt::SolidLine));
240 uint16_t
w =
overlay_->getTextureWidth();
257 painter.drawLine(0, 0, 0, h);
258 painter.drawLine(0, h, w, h);
259 painter.drawLine(w, h, w, 0);
260 painter.drawLine(w, 0, 0, 0);
264 QFont
font = painter.font();
267 painter.setFont(font);
269 Qt::AlignCenter | Qt::AlignVCenter,
275 QFont
font = painter.font();
278 painter.setFont(font);
279 std::ostringstream ss;
280 ss << std::fixed << std::setprecision(2) <<
data_;
284 painter.translate(0, h);
286 painter.drawText(0, 0, h, w,
287 Qt::AlignCenter | Qt::AlignVCenter,
290 painter.translate(0, -h);
294 painter.drawText(0, 0, w, h,
295 Qt::AlignCenter | Qt::AlignVCenter,
341 if (topic_name.length() > 0 && topic_name !=
"/") {
504 return (top_ < y && top_ + texture_height_ > y &&
505 left_ < x && left_ + texture_width_ > x);
virtual ~LinearGaugeDisplay()
const int height_padding_
rviz::FloatProperty * min_value_property_
rviz::ColorProperty * bg_color_property_
rviz::FloatProperty * bg_alpha_property_
virtual QImage getQImage(unsigned int width, unsigned int height)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
PLUGINLIB_EXPORT_CLASS(jsk_rviz_plugins::PictogramArrayDisplay, rviz::Display)
rviz::IntProperty * text_size_property_
virtual QColor getColor() const
rviz::BoolProperty * vertical_gauge_property_
void updateUpdateInterval()
rviz::BoolProperty * auto_color_change_property_
rviz::FloatProperty * update_interval_property_
virtual void onInitialize()
virtual bool isInRegion(int x, int y)
std::string getTopicStd() const
rviz::ColorProperty * fg_color_property_
rviz::IntProperty * height_property_
rviz::BoolProperty * show_border_property_
virtual void unsubscribe()
virtual QString getName() const
void updateVerticalGauge()
rviz::BoolProperty * show_caption_property_
virtual void update(float wall_dt, float ros_dt)
rviz::RosTopicProperty * update_topic_property_
void updateAutoColorChange()
virtual int getInt() const
rviz::IntProperty * top_property_
rviz::IntProperty * width_property_
bool setValue(const QVariant &new_value) override
rviz::FloatProperty * max_value_property_
rviz::IntProperty * left_property_
virtual float getFloat() const
rviz::BoolProperty * show_value_property_
rviz::ColorProperty * max_color_property_
OverlayObject::Ptr overlay_
virtual void setPosition(int x, int y)
virtual void movePosition(int x, int y)
virtual bool getBool() const
rviz::FloatProperty * fg_alpha_property_
virtual void processMessage(const std_msgs::Float32::ConstPtr &msg)
rviz::IntProperty * line_width_property_