route_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_ROUTE_PLUGIN_H_
31 #define MAPVIZ_PLUGINS_ROUTE_PLUGIN_H_
32 
33 // C++ standard libraries
34 #include <list>
35 #include <string>
36 #include <vector>
37 
38 #include <mapviz/mapviz_plugin.h>
39 
40 // QT libraries
41 #include <QGLWidget>
42 #include <QObject>
43 #include <QWidget>
44 
45 // ROS libraries
46 #include <ros/ros.h>
47 #include <tf/transform_datatypes.h>
48 #include <marti_nav_msgs/RoutePosition.h>
49 #include <mapviz/map_canvas.h>
50 #include <swri_route_util/route.h>
51 
52 // QT autogenerated files
53 #include "ui_route_config.h"
54 
55 namespace mapviz_plugins
56 {
58  {
59  Q_OBJECT
60 
61  public:
62  enum DrawStyle
63  {
64  LINES = 0,
65  POINTS = 1
66  };
67 
68  RoutePlugin();
69  virtual ~RoutePlugin();
70 
71  bool Initialize(QGLWidget* canvas);
72  void Shutdown()
73  {
74  }
75 
76  void Draw(double x, double y, double scale);
77 
78  void Transform() {};
79 
80  void LoadConfig(const YAML::Node& node, const std::string& path);
81  void SaveConfig(YAML::Emitter& emitter, const std::string& path);
82  void DrawStopWaypoint(double x, double y);
83  void DrawRoute(const swri_route_util::Route &route);
85 
86  QWidget* GetConfigWidget(QWidget* parent);
87 
88  protected:
89  void PrintError(const std::string& message);
90  void PrintInfo(const std::string& message);
91  void PrintWarning(const std::string& message);
92 
93  protected Q_SLOTS:
94  void SelectTopic();
95  void SelectPositionTopic();
96  void TopicEdited();
97  void PositionTopicEdited();
98  void SetDrawStyle(QString style);
99  void DrawIcon();
100 
101  private:
102  Ui::route_config ui_;
103  QWidget* config_widget_;
104 
106 
107  std::string topic_;
108  std::string position_topic_;
109 
112 
114  marti_nav_msgs::RoutePositionConstPtr src_route_position_;
115 
116  void RouteCallback(const marti_nav_msgs::RouteConstPtr &msg);
117  void PositionCallback(const marti_nav_msgs::RoutePositionConstPtr &msg);
118  };
119 }
120 
121 #endif // MAPVIZ_PLUGINS_ROUTE_PLUGIN_H_
mapviz_plugins::RoutePlugin::SelectPositionTopic
void SelectPositionTopic()
Definition: route_plugin.cpp:153
mapviz_plugins::RoutePlugin::DrawRoutePoint
void DrawRoutePoint(const swri_route_util::RoutePoint &point)
Definition: route_plugin.cpp:342
mapviz_plugins::RoutePlugin::PositionTopicEdited
void PositionTopicEdited()
Definition: route_plugin.cpp:187
mapviz_plugins::RoutePlugin::position_sub_
ros::Subscriber position_sub_
Definition: route_plugin.h:111
mapviz_plugins::RoutePlugin::TopicEdited
void TopicEdited()
Definition: route_plugin.cpp:167
mapviz_plugins::RoutePlugin::PrintWarning
void PrintWarning(const std::string &message)
Definition: route_plugin.cpp:227
mapviz_plugins::RoutePlugin::RoutePlugin
RoutePlugin()
Definition: route_plugin.cpp:64
ros.h
swri_route_util::Route
mapviz_plugins::RoutePlugin::Draw
void Draw(double x, double y, double scale)
Definition: route_plugin.cpp:249
mapviz_plugins::RoutePlugin::SetDrawStyle
void SetDrawStyle(QString style)
Definition: route_plugin.cpp:126
mapviz_plugins::RoutePlugin::LINES
@ LINES
Definition: route_plugin.h:64
mapviz_plugins::RoutePlugin::SaveConfig
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
Definition: route_plugin.cpp:414
mapviz_plugins::RoutePlugin::~RoutePlugin
virtual ~RoutePlugin()
Definition: route_plugin.cpp:91
mapviz_plugins::RoutePlugin::topic_
std::string topic_
Definition: route_plugin.h:107
mapviz_plugins::RoutePlugin::SelectTopic
void SelectTopic()
Definition: route_plugin.cpp:139
mapviz_plugins::RoutePlugin::PrintInfo
void PrintInfo(const std::string &message)
Definition: route_plugin.cpp:222
mapviz_plugins::RoutePlugin::route_sub_
ros::Subscriber route_sub_
Definition: route_plugin.h:110
mapviz_plugins::RoutePlugin::Shutdown
void Shutdown()
Definition: route_plugin.h:72
mapviz_plugins::RoutePlugin::config_widget_
QWidget * config_widget_
Definition: route_plugin.h:103
mapviz_plugins::RoutePlugin
Definition: route_plugin.h:57
mapviz_plugins::RoutePlugin::src_route_position_
marti_nav_msgs::RoutePositionConstPtr src_route_position_
Definition: route_plugin.h:114
mapviz_plugins::RoutePlugin::DrawRoute
void DrawRoute(const swri_route_util::Route &route)
Definition: route_plugin.cpp:318
route.h
mapviz_plugins::RoutePlugin::DrawIcon
void DrawIcon()
Definition: route_plugin.cpp:95
swri_route_util::RoutePoint
mapviz_plugins::RoutePlugin::DrawStopWaypoint
void DrawStopWaypoint(double x, double y)
Definition: route_plugin.cpp:297
mapviz_plugins::RoutePlugin::POINTS
@ POINTS
Definition: route_plugin.h:65
transform_datatypes.h
mapviz_plugins::RoutePlugin::PositionCallback
void PositionCallback(const marti_nav_msgs::RoutePositionConstPtr &msg)
Definition: route_plugin.cpp:206
mapviz_plugins::RoutePlugin::LoadConfig
void LoadConfig(const YAML::Node &node, const std::string &path)
Definition: route_plugin.cpp:366
mapviz::MapvizPlugin
mapviz_plugins::RoutePlugin::position_topic_
std::string position_topic_
Definition: route_plugin.h:108
mapviz_plugins::RoutePlugin::ui_
Ui::route_config ui_
Definition: route_plugin.h:102
mapviz_plugins::RoutePlugin::Initialize
bool Initialize(QGLWidget *canvas)
Definition: route_plugin.cpp:239
mapviz_plugins::RoutePlugin::DrawStyle
DrawStyle
Definition: route_plugin.h:62
mapviz_plugins::RoutePlugin::RouteCallback
void RouteCallback(const marti_nav_msgs::RouteConstPtr &msg)
Definition: route_plugin.cpp:212
mapviz_plugins::RoutePlugin::Transform
void Transform()
Definition: route_plugin.h:78
mapviz_plugins
Definition: attitude_indicator_plugin.h:61
mapviz_plugins::RoutePlugin::draw_style_
DrawStyle draw_style_
Definition: route_plugin.h:105
mapviz_plugins::RoutePlugin::PrintError
void PrintError(const std::string &message)
Definition: route_plugin.cpp:217
mapviz_plugins::RoutePlugin::GetConfigWidget
QWidget * GetConfigWidget(QWidget *parent)
Definition: route_plugin.cpp:232
map_canvas.h
ros::Subscriber
mapviz_plugins::RoutePlugin::src_route_
swri_route_util::Route src_route_
Definition: route_plugin.h:113
mapviz_plugin.h


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