tf_display.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef RVIZ_TF_DISPLAY_H
31 #define RVIZ_TF_DISPLAY_H
32 
33 #include <map>
34 #include <set>
35 
36 #include <OgreQuaternion.h>
37 #include <OgreVector3.h>
38 
40 
41 #include "rviz/display.h"
42 
43 namespace Ogre
44 {
45 class SceneNode;
46 }
47 
48 namespace rviz
49 {
50 class Arrow;
51 class Axes;
52 class BoolProperty;
53 class FloatProperty;
54 class MovableText;
55 class QuaternionProperty;
56 class StringProperty;
57 class VectorProperty;
58 
59 class FrameInfo;
62 
64 class TFDisplay : public Display
65 {
66  Q_OBJECT
67 public:
68  TFDisplay();
69  ~TFDisplay() override;
70 
71  void update(float wall_dt, float ros_dt) override;
72 
73 protected:
74  // Overrides from Display
75  void onInitialize() override;
76  void load(const Config& config) override;
77  void fixedFrameChanged() override;
78  void reset() override;
79 
80 private Q_SLOTS:
81  void updateShowAxes();
82  void updateShowArrows();
83  void updateShowNames();
84  void allEnabledChanged();
85 
86 private:
87  typedef std::map<std::string, FrameInfo*> M_FrameInfo;
88 
89  void updateFrames();
90  FrameInfo* createFrame(const std::string& frame);
91  void updateFrame(FrameInfo* frame);
92  M_FrameInfo::iterator deleteFrame(M_FrameInfo::iterator it, bool delete_properties);
93 
94  FrameInfo* getFrameInfo(const std::string& frame);
95 
96  void clear();
97 
98  // overrides from Display
99  void onEnable() override;
100  void onDisable() override;
101 
102  Ogre::SceneNode* root_node_;
103  Ogre::SceneNode* names_node_;
104  Ogre::SceneNode* arrows_node_;
105  Ogre::SceneNode* axes_node_;
106 
107  M_FrameInfo frames_;
108 
109  typedef std::map<std::string, bool> M_EnabledState;
111 
113 
120 
122 
125 
127  friend class FrameInfo;
128 };
129 
131 class FrameInfo : public QObject
132 {
133  Q_OBJECT
134 public:
135  FrameInfo(TFDisplay* display);
136 
138  void setEnabled(bool enabled);
139 
140 public Q_SLOTS:
143  void updateVisibilityFromFrame();
144 
147  void updateVisibilityFromSelection();
148 
149 public:
151  std::string name_;
152  std::string parent_;
155  FrameSelectionHandlerPtr selection_handler_;
158  Ogre::SceneNode* name_node_;
159 
161  Ogre::Quaternion arrow_orientation_;
162 
165 
172 
174 };
175 
176 } // end namespace rviz
177 
178 #endif // RVIZ_TF_DISPLAY_H
Property * frames_category_
Definition: tf_display.h:123
FloatProperty * scale_property_
Definition: tf_display.h:121
boost::shared_ptr< FrameSelectionHandler > FrameSelectionHandlerPtr
Definition: tf_display.h:60
bool changing_single_frame_enabled_state_
Definition: tf_display.h:126
std::string name_
Definition: tf_display.h:151
BoolProperty * show_arrows_property_
Definition: tf_display.h:115
Ogre::SceneNode * root_node_
Definition: tf_display.h:102
Ogre::Quaternion arrow_orientation_
Definition: tf_display.h:161
Ogre::SceneNode * names_node_
Definition: tf_display.h:103
StringProperty * parent_property_
Definition: tf_display.h:170
Property * tree_category_
Definition: tf_display.h:124
Ogre::SceneNode * arrows_node_
Definition: tf_display.h:104
Displays a visual representation of the TF hierarchy.
Definition: tf_display.h:64
A single element of a property tree, with a name, value, description, and possibly children...
Definition: property.h:100
float distance_to_parent_
Definition: tf_display.h:160
config
M_EnabledState frame_config_enabled_state_
Definition: tf_display.h:110
ros::Time last_update_
Definition: tf_display.h:163
std::map< std::string, bool > M_EnabledState
Definition: tf_display.h:109
Internal class needed only by TFDisplay.
Definition: tf_display.h:131
Property specialized to enforce floating point max/min.
BoolProperty * show_names_property_
Definition: tf_display.h:114
VectorProperty * rel_position_property_
Definition: tf_display.h:166
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
Configuration data storage class.
Definition: config.h:124
VectorProperty * position_property_
Definition: tf_display.h:168
QuaternionProperty * rel_orientation_property_
Definition: tf_display.h:167
std::map< std::string, FrameInfo * > M_FrameInfo
Definition: tf_display.h:87
CollObjectHandle axes_coll_
Definition: tf_display.h:154
std::string parent_
Definition: tf_display.h:152
BoolProperty * all_enabled_property_
Definition: tf_display.h:119
Ogre::SceneNode * axes_node_
Definition: tf_display.h:105
BoolProperty * enabled_property_
Definition: tf_display.h:171
TFDisplay * display_
Definition: tf_display.h:150
float update_timer_
Definition: tf_display.h:112
Ogre::SceneNode * name_node_
Definition: tf_display.h:158
An object that displays a set of X/Y/Z axes, with X=Red, Y=Green, Z=Blue.
Definition: axes.h:59
FrameSelectionHandlerPtr selection_handler_
Definition: tf_display.h:155
FloatProperty * update_rate_property_
Definition: tf_display.h:117
Property specialized for string values.
MovableText * name_text_
Definition: tf_display.h:157
BoolProperty * show_axes_property_
Definition: tf_display.h:116
Property specialized to provide getter for booleans.
Definition: bool_property.h:38
An arrow consisting of a cylinder and a cone.
Definition: arrow.h:59
Arrow * parent_arrow_
Definition: tf_display.h:156
M_FrameInfo frames_
Definition: tf_display.h:107
Property * tree_property_
Definition: tf_display.h:173
ros::Time last_time_to_fixed_
Definition: tf_display.h:164
FloatProperty * frame_timeout_property_
Definition: tf_display.h:118
QuaternionProperty * orientation_property_
Definition: tf_display.h:169
uint32_t CollObjectHandle
Definition: forwards.h:45


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Fri Feb 3 2023 03:06:42