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  void applyAttitudeOrientation(const geometry_msgs::Quaternion &orientation);
104 
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_
mapviz_plugins::AttitudeIndicatorPlugin::Draw
void Draw(double x, double y, double scale)
Definition: attitude_indicator_plugin.cpp:266
mapviz_plugins::AttitudeIndicatorPlugin::ui_
Ui::attitude_indicator_config ui_
Definition: attitude_indicator_plugin.h:113
mapviz_plugins::AttitudeIndicatorPlugin::AttitudeCallbackImu
void AttitudeCallbackImu(const sensor_msgs::ImuConstPtr &imu)
Definition: attitude_indicator_plugin.cpp:147
mapviz_plugins::AttitudeIndicatorPlugin::placer_
PlaceableWindowProxy placer_
Definition: attitude_indicator_plugin.h:108
boost::shared_ptr< ShapeShifter const >
mapviz_plugins::AttitudeIndicatorPlugin::pitch_
double pitch_
Definition: attitude_indicator_plugin.h:105
ros.h
mapviz_plugins::AttitudeIndicatorPlugin::~AttitudeIndicatorPlugin
virtual ~AttitudeIndicatorPlugin()
Definition: attitude_indicator_plugin.cpp:85
mapviz_plugins::AttitudeIndicatorPlugin::odometry_sub_
ros::Subscriber odometry_sub_
Definition: attitude_indicator_plugin.h:110
mapviz_plugins::AttitudeIndicatorPlugin::AttitudeIndicatorPlugin
AttitudeIndicatorPlugin()
Definition: attitude_indicator_plugin.cpp:59
mapviz_plugins::AttitudeIndicatorPlugin::PrintInfo
void PrintInfo(const std::string &message)
Definition: attitude_indicator_plugin.cpp:179
mapviz_plugins::AttitudeIndicatorPlugin::AttitudeCallbackPose
void AttitudeCallbackPose(const geometry_msgs::PoseConstPtr &pose)
Definition: attitude_indicator_plugin.cpp:152
mapviz_plugins::AttitudeIndicatorPlugin::drawPanel
void drawPanel()
Definition: attitude_indicator_plugin.cpp:323
mapviz_plugins::AttitudeIndicatorPlugin::applyAttitudeOrientation
void applyAttitudeOrientation(const geometry_msgs::Quaternion &orientation)
Definition: attitude_indicator_plugin.cpp:157
mapviz_plugins::AttitudeIndicatorPlugin::PrintWarning
void PrintWarning(const std::string &message)
Definition: attitude_indicator_plugin.cpp:184
mapviz_plugins::PlaceableWindowProxy
Definition: placeable_window_proxy.h:58
mapviz_plugins::AttitudeIndicatorPlugin::handleMessage
void handleMessage(const topic_tools::ShapeShifter::ConstPtr &msg)
Definition: attitude_indicator_plugin.cpp:122
mapviz_plugins::AttitudeIndicatorPlugin::PrintError
void PrintError(const std::string &message)
Definition: attitude_indicator_plugin.cpp:174
mapviz_plugins::AttitudeIndicatorPlugin::drawBall
void drawBall()
Definition: attitude_indicator_plugin.cpp:214
mapviz_plugins::AttitudeIndicatorPlugin::topics_
std::vector< std::string > topics_
Definition: attitude_indicator_plugin.h:112
shape_shifter.h
placeable_window_proxy.h
mapviz_plugins::AttitudeIndicatorPlugin::GetConfigWidget
QWidget * GetConfigWidget(QWidget *parent)
Definition: attitude_indicator_plugin.cpp:189
transform_datatypes.h
mapviz_plugins::AttitudeIndicatorPlugin::roll_
double roll_
Definition: attitude_indicator_plugin.h:106
mapviz_plugins::AttitudeIndicatorPlugin::timerEvent
void timerEvent(QTimerEvent *)
Definition: attitude_indicator_plugin.cpp:209
mapviz_plugins::AttitudeIndicatorPlugin::topic_
std::string topic_
Definition: attitude_indicator_plugin.h:111
mapviz_plugins::AttitudeIndicatorPlugin::Transform
void Transform()
Definition: attitude_indicator_plugin.h:76
mapviz_plugins::AttitudeIndicatorPlugin::TopicEdited
void TopicEdited()
Definition: attitude_indicator_plugin.cpp:102
mapviz::MapvizPlugin
mapviz_plugins::AttitudeIndicatorPlugin::Shutdown
void Shutdown()
Definition: attitude_indicator_plugin.cpp:204
mapviz_plugins::AttitudeIndicatorPlugin::drawBackground
void drawBackground()
Definition: attitude_indicator_plugin.cpp:307
mapviz_plugins::AttitudeIndicatorPlugin
Definition: attitude_indicator_plugin.h:63
mapviz_plugins::AttitudeIndicatorPlugin::SaveConfig
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
Definition: attitude_indicator_plugin.cpp:391
mapviz_plugins::AttitudeIndicatorPlugin::yaw_
double yaw_
Definition: attitude_indicator_plugin.h:107
mapviz_plugins::AttitudeIndicatorPlugin::SelectTopic
void SelectTopic()
Definition: attitude_indicator_plugin.cpp:89
mapviz_plugins
Definition: attitude_indicator_plugin.h:61
mapviz_plugins::AttitudeIndicatorPlugin::config_widget_
QWidget * config_widget_
Definition: attitude_indicator_plugin.h:109
map_canvas.h
ros::Subscriber
mapviz_plugins::AttitudeIndicatorPlugin::LoadConfig
void LoadConfig(const YAML::Node &node, const std::string &path)
Definition: attitude_indicator_plugin.cpp:350
mapviz_plugin.h
mapviz_plugins::AttitudeIndicatorPlugin::Initialize
bool Initialize(QGLWidget *canvas)
Definition: attitude_indicator_plugin.cpp:195
mapviz_plugins::AttitudeIndicatorPlugin::AttitudeCallbackOdom
void AttitudeCallbackOdom(const nav_msgs::OdometryConstPtr &odometry)
Definition: attitude_indicator_plugin.cpp:142


mapviz_plugins
Author(s): Marc Alban
autogenerated on Sun Sep 8 2024 02:27:14