path_display.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * 2020, Locus Robotics
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * * Neither the name of the Willow Garage, Inc. or Locus Robotics nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef ROBOT_NAV_RVIZ_PLUGINS_PATH_DISPLAY_H
32 #define ROBOT_NAV_RVIZ_PLUGINS_PATH_DISPLAY_H
33 
34 #include <nav_2d_msgs/Path2D.h>
37 #include <rviz/ogre_helpers/axes.h>
44 #include <OgreManualObject.h>
45 #include <vector>
46 
47 namespace robot_nav_rviz_plugins
48 {
54 class PathDisplay: public rviz::MessageFilterDisplay<nav_2d_msgs::Path2D>
55 {
56 Q_OBJECT
57 public:
58  PathDisplay();
59  virtual ~PathDisplay();
60  void reset() override;
61 
62 protected:
63  void onInitialize() override;
64  void processMessage(const nav_2d_msgs::Path2D::ConstPtr& msg) override;
65 
66 private Q_SLOTS:
67  void updateBufferLength();
68  void updateStyle();
69  void updateLineWidth();
70  void updateOffset();
71  void updatePoseStyle();
73  void updatePoseArrowColor();
75 
76 private:
77  // Display Option Enums
78  enum struct LineStyle {LINES, BILLBOARDS};
79  enum struct PoseStyle {NONE, AXES, ARROWS};
80  LineStyle getLineStyle() const { return static_cast<LineStyle>(style_property_->getOptionInt()); }
81  PoseStyle getPoseStyle() const { return static_cast<PoseStyle>(pose_style_property_->getOptionInt()); }
82 
83  void destroyObjects();
84  void allocateArrowVector(std::vector<rviz::Arrow*>& arrow_vect, int num);
85  void allocateAxesVector(std::vector<rviz::Axes*>& axes_vect, int num);
86 
87  std::vector<Ogre::ManualObject*> manual_objects_;
88  std::vector<rviz::BillboardLine*> billboard_lines_;
89  std::vector<std::vector<rviz::Axes*>> axes_chain_;
90  std::vector<std::vector<rviz::Arrow*>> arrow_chain_;
91 
98 
99  // pose marker property
108 };
109 } // namespace robot_nav_rviz_plugins
110 
111 #endif // ROBOT_NAV_RVIZ_PLUGINS_PATH_DISPLAY_H
rviz::EnumProperty * style_property_
Definition: path_display.h:92
rviz::VectorProperty * offset_property_
Definition: path_display.h:97
rviz::ColorProperty * color_property_
Definition: path_display.h:93
std::vector< Ogre::ManualObject * > manual_objects_
Definition: path_display.h:87
rviz::ColorProperty * pose_arrow_color_property_
Definition: path_display.h:103
rviz::IntProperty * buffer_length_property_
Definition: path_display.h:96
std::vector< std::vector< rviz::Axes * > > axes_chain_
Definition: path_display.h:89
void allocateAxesVector(std::vector< rviz::Axes * > &axes_vect, int num)
Displays a nav_2d_msgs::Path2D message in Rviz.
Definition: path_display.h:54
rviz::FloatProperty * pose_axes_radius_property_
Definition: path_display.h:102
std::vector< std::vector< rviz::Arrow * > > arrow_chain_
Definition: path_display.h:90
rviz::FloatProperty * pose_axes_length_property_
Definition: path_display.h:101
rviz::FloatProperty * pose_arrow_head_diameter_property_
Definition: path_display.h:107
rviz::FloatProperty * line_width_property_
Definition: path_display.h:95
Several reusable pieces for displaying polygons.
rviz::FloatProperty * pose_arrow_shaft_length_property_
Definition: path_display.h:104
std::vector< rviz::BillboardLine * > billboard_lines_
Definition: path_display.h:88
rviz::FloatProperty * pose_arrow_head_length_property_
Definition: path_display.h:105
rviz::FloatProperty * alpha_property_
Definition: path_display.h:94
rviz::FloatProperty * pose_arrow_shaft_diameter_property_
Definition: path_display.h:106
rviz::EnumProperty * pose_style_property_
Definition: path_display.h:100
virtual int getOptionInt()
void allocateArrowVector(std::vector< rviz::Arrow * > &arrow_vect, int num)
void processMessage(const nav_2d_msgs::Path2D::ConstPtr &msg) override


robot_nav_rviz_plugins
Author(s):
autogenerated on Sun Jan 10 2021 04:08:58