RouteSegmentsVisual.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Software License Agreement (BSD License) *
3  * Copyright (C) 2016 by Markus Bader <markus.bader@tuwien.ac.at> *
4  * *
5  * Redistribution and use in source and binary forms, with or without *
6  * modification, are permitted provided that the following conditions *
7  * are met: *
8  * *
9  * 1. Redistributions of source code must retain the above copyright *
10  * notice, this list of conditions and the following disclaimer. *
11  * 2. Redistributions in binary form must reproduce the above copyright *
12  * notice, this list of conditions and the following disclaimer in *
13  * the documentation and/or other materials provided with the *
14  * distribution. *
15  * 3. Neither the name of the copyright holder nor the names of its *
16  * contributors may be used to endorse or promote products derived *
17  * from this software without specific prior written permission. *
18  * *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *
27  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY *
29  * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
30  * POSSIBILITY OF SUCH DAMAGE. *
31  ***************************************************************************/
32 
33 #ifndef ROUTESEGMENTS_VISUAL_H
34 #define ROUTESEGMENTS_VISUAL_H
35 
36 #include <tuw_nav_msgs/RouteSegments.h>
38 #include <eigen3/unsupported/Eigen/Splines>
40 #include <rviz/ogre_helpers/line.h>
41 
42 namespace Ogre
43 {
44 class Vector3;
45 class Quaternion;
46 }
47 
48 namespace rviz
49 {
50 class Shape;
51 }
52 
53 namespace tuw_nav_rviz
54 {
55 
56 // Declare the visual class for this display.
58 {
59 public:
60  // Constructor. Creates the visual stuff and puts it into the
61  // scene, but in an unconfigured state.
62  RouteSegmentsVisual( Ogre::SceneManager* scene_manager, Ogre::SceneNode* parent_node );
63 
64  // Destructor. Removes the visual stuff from the scene.
65  virtual ~RouteSegmentsVisual();
66 
67  // Configure the visual to show the data in the message.
68  void setMessage( const tuw_nav_msgs::RouteSegments::ConstPtr& msg );
69 
70  // Set the pose of the coordinate frame the message refers to.
71  // These could be done inside setMessage(), but that would require
72  // calls to FrameManager and error handling inside setMessage(),
73  // which doesn't seem as clean. This way RouteSegmentsVisual is
74  // only responsible for visualization.
75  void setFramePosition( const Ogre::Vector3& position );
76  void setFrameOrientation( const Ogre::Quaternion& orientation );
77 
78  // Set the color of the visual, which is an user-editable
79  // parameter and therefore don't come from the MarkerDetection message.
80  void setStartPointColor( Ogre::ColourValue color );
81  void setEndPointColor( Ogre::ColourValue color );
82  void setCenterPointColor( Ogre::ColourValue color );
83  void setLineColor( Ogre::ColourValue color );
84  void setArcColor( Ogre::ColourValue color );
85 
86  // Set the shape of the visual, which is an user-editable
87  // parameter and therefore don't come from the MarkerDetection message.
88  void setStartPointShape( rviz::Shape::Type shape_type );
89  void setEndPointShape( rviz::Shape::Type shape_type );
90  void setCenterPointShape( rviz::Shape::Type shape_type );
91 
92  // Set the scale of the visual, which is an user-editable
93  // parameter and therefore don't come from the MarkerDetection message.
94  void setStartPointScale( float scale );
95  void setEndPointScale( float scale );
96  void setCenterPointScale( float scale );
97 
98  void setShowArcs( bool visible );
99  void setShowLines ( bool visible );
100  void setShowStartPoints( bool visible );
101  void setShowEndPoints ( bool visible );
102  void setShowCenterPoints ( bool visible );
103 
104 private:
105  // The objects implementing the actual shape
106  std::vector<boost::shared_ptr<rviz::Shape> > startPts_;
107  std::vector<boost::shared_ptr<rviz::Shape> > endPts_;
108  std::vector<boost::shared_ptr<rviz::Shape> > centerPts_;
109  std::vector<boost::shared_ptr<rviz::Line> > lines_;
110  std::vector<boost::shared_ptr<rviz::Line> > arcs_;
111 
113 
114  // A SceneNode whose pose is set to match the coordinate frame of
115  // the Imu message header.
116  Ogre::SceneNode* frame_node_;
117 
118  // The SceneManager, kept here only so the destructor can ask it to
119  // destroy the ``frame_node_``.
120  Ogre::SceneManager* scene_manager_;
121 
122  // The Shape object's color
123  Ogre::ColourValue color_start_point_;
124  Ogre::ColourValue color_end_point_;
125  Ogre::ColourValue color_center_point_;
126  Ogre::ColourValue color_lines_;
127  Ogre::ColourValue color_arcs_;
128 
129  // The Shape object's shape type
133 
134  // The Shape object's scale
143 
144 };
145 
146 } // end namespace tuw_nav_rviz
147 
148 #endif // ROUTESEGMENTS_VISUAL_H
boost::shared_ptr< Eigen::Spline3d > spline_
std::vector< boost::shared_ptr< rviz::Line > > arcs_
std::vector< boost::shared_ptr< rviz::Line > > lines_
std::vector< boost::shared_ptr< rviz::Shape > > endPts_
TFSIMD_FORCE_INLINE Vector3()
std::vector< boost::shared_ptr< rviz::Shape > > centerPts_
std::vector< boost::shared_ptr< rviz::Shape > > startPts_


tuw_nav_rviz
Author(s):
autogenerated on Mon Jun 10 2019 15:40:12