attitude_indicator_plugin.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2014, Southwest Research Institute® (SwRI®)
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 // * 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 Southwest Research Institute® (SwRI®) nor the
14 // names of its contributors may be used to endorse or promote products
15 // derived from 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 <COPYRIGHT HOLDER> BE LIABLE FOR ANY
21 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 //
28 // *****************************************************************************
29 
30 #ifndef MAPVIZ_PLUGINS_ATTITUDE_INDICATOR_PLUGIN_H_
31 #define MAPVIZ_PLUGINS_ATTITUDE_INDICATOR_PLUGIN_H_
32 
33 // Include mapviz_plugin.h first to ensure GL deps are included in the right order
34 #include <mapviz/mapviz_plugin.h>
35 
36 // C++ standard libraries
37 #include <string>
38 #include <list>
39 #include <vector>
40 
41 // QT libraries
42 #include <QColor>
43 #include <QGLWidget>
44 #include <QObject>
45 #include <QWidget>
46 
47 // ROS libraries
48 #include <geometry_msgs/Pose.h>
49 #include <nav_msgs/Odometry.h>
50 #include <ros/ros.h>
51 #include <sensor_msgs/Imu.h>
52 #include <tf/transform_datatypes.h>
54 
55 #include <mapviz/map_canvas.h>
57 
58 // QT autogenerated files
59 #include "ui_attitude_indicator_config.h"
60 
61 namespace mapviz_plugins
62 {
64 {
65  Q_OBJECT
66 
67  public:
69  virtual ~AttitudeIndicatorPlugin();
70 
71  bool Initialize(QGLWidget* canvas);
72  void Shutdown();
73 
74  void Draw(double x, double y, double scale);
75 
76  void Transform() {}
77 
78  void LoadConfig(const YAML::Node& node, const std::string& path);
79  void SaveConfig(YAML::Emitter& emitter, const std::string& path);
80 
81  QWidget* GetConfigWidget(QWidget* parent);
82 
83  protected:
84  void PrintError(const std::string& message);
85  void PrintInfo(const std::string& message);
86  void PrintWarning(const std::string& message);
87 
88  void drawBackground();
89  void drawBall();
90  void drawPanel();
91 
92  void timerEvent(QTimerEvent *);
93 
94  protected Q_SLOTS:
95  void SelectTopic();
96  void TopicEdited();
97 
98  private:
99  void AttitudeCallbackImu(const sensor_msgs::ImuConstPtr& imu);
100  void AttitudeCallbackOdom(const nav_msgs::OdometryConstPtr& odometry);
101  void AttitudeCallbackPose(const geometry_msgs::PoseConstPtr& pose);
103 
105  double pitch_;
106  double roll_;
107  double yaw_;
109  QWidget* config_widget_;
111  std::string topic_;
112  std::vector<std::string> topics_;
113  Ui::attitude_indicator_config ui_;
114 }; // class AttitudeIndicatorPlugin
115 } // namespace mapviz_plugins
116 #endif // MAPVIZ_PLUGINS_ATTITUDE_INDICATOR_PLUGIN_H_
msg
void LoadConfig(const YAML::Node &node, const std::string &path)
void AttitudeCallbackImu(const sensor_msgs::ImuConstPtr &imu)
void Draw(double x, double y, double scale)
TFSIMD_FORCE_INLINE const tfScalar & y() const
void handleMessage(const topic_tools::ShapeShifter::ConstPtr &msg)
TFSIMD_FORCE_INLINE const tfScalar & x() const
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
void AttitudeCallbackOdom(const nav_msgs::OdometryConstPtr &odometry)
void AttitudeCallbackPose(const geometry_msgs::PoseConstPtr &pose)


mapviz_plugins
Author(s): Marc Alban
autogenerated on Thu Jun 6 2019 19:25:16