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_
void PrintInfo(const std::string &message)
marti_nav_msgs::RoutePositionConstPtr src_route_position_
Definition: route_plugin.h:114
void LoadConfig(const YAML::Node &node, const std::string &path)
ros::Subscriber position_sub_
Definition: route_plugin.h:111
void Draw(double x, double y, double scale)
bool Initialize(QGLWidget *canvas)
void PrintError(const std::string &message)
swri_route_util::Route src_route_
Definition: route_plugin.h:113
void DrawRoutePoint(const swri_route_util::RoutePoint &point)
void PrintWarning(const std::string &message)
void DrawStopWaypoint(double x, double y)
ros::Subscriber route_sub_
Definition: route_plugin.h:110
void PositionCallback(const marti_nav_msgs::RoutePositionConstPtr &msg)
void RouteCallback(const marti_nav_msgs::RouteConstPtr &msg)
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
void SetDrawStyle(QString style)
void DrawRoute(const swri_route_util::Route &route)
QWidget * GetConfigWidget(QWidget *parent)


mapviz_plugins
Author(s): Marc Alban
autogenerated on Fri Dec 16 2022 03:59:33