marti_nav_plan_plugin.h
Go to the documentation of this file.
1 // *****************************************************************************
2 //
3 // Copyright (c) 2021, 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_MARTI_NAV_PLAN_PLUGIN_H_
31 #define MAPVIZ_PLUGINS_MARTI_NAV_PLAN_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/Plan.h>
49 #include <marti_nav_msgs/PlanTrack.h>
50 #include <mapviz/map_canvas.h>
51 
52 // QT autogenerated files
53 #include "ui_marti_nav_plan_config.h"
54 
55 namespace mapviz_plugins
56 {
58  {
59  Q_OBJECT
60 
61  public:
62  enum DrawStyle
63  {
66  };
67 
69  virtual ~MartiNavPlanPlugin();
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 marti_nav_msgs::Plan &route);
84  void DrawRoutePoint(const marti_nav_msgs::PlanPoint &point);
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::marti_nav_plan_config ui_;
103  QWidget* config_widget_;
104 
106 
107  std::string topic_;
108  std::string position_topic_;
109 
112 
113  marti_nav_msgs::PlanConstPtr src_route_;
114  marti_nav_msgs::PlanTrackConstPtr src_route_position_;
115 
116  void RouteCallback(const marti_nav_msgs::PlanConstPtr &msg);
117  void PositionCallback(const marti_nav_msgs::PlanTrackConstPtr &msg);
118  };
119 }
120 
121 #endif // MAPVIZ_PLUGINS_MARTI_NAV_PLAN_PLUGIN_H_
mapviz_plugins::MartiNavPlanPlugin::STYLE_POINTS
@ STYLE_POINTS
Definition: marti_nav_plan_plugin.h:65
mapviz_plugins::MartiNavPlanPlugin::PositionTopicEdited
void PositionTopicEdited()
Definition: marti_nav_plan_plugin.cpp:192
mapviz_plugins::MartiNavPlanPlugin::Draw
void Draw(double x, double y, double scale)
Definition: marti_nav_plan_plugin.cpp:254
mapviz_plugins::MartiNavPlanPlugin::DrawIcon
void DrawIcon()
Definition: marti_nav_plan_plugin.cpp:96
mapviz_plugins::MartiNavPlanPlugin
Definition: marti_nav_plan_plugin.h:57
ros.h
mapviz_plugins::MartiNavPlanPlugin::draw_style_
int draw_style_
Definition: marti_nav_plan_plugin.h:105
mapviz_plugins::MartiNavPlanPlugin::TopicEdited
void TopicEdited()
Definition: marti_nav_plan_plugin.cpp:172
mapviz_plugins::MartiNavPlanPlugin::position_topic_
std::string position_topic_
Definition: marti_nav_plan_plugin.h:108
mapviz_plugins::MartiNavPlanPlugin::DrawRoute
void DrawRoute(const marti_nav_msgs::Plan &route)
Definition: marti_nav_plan_plugin.cpp:324
mapviz_plugins::MartiNavPlanPlugin::route_sub_
ros::Subscriber route_sub_
Definition: marti_nav_plan_plugin.h:110
mapviz_plugins::MartiNavPlanPlugin::SelectPositionTopic
void SelectPositionTopic()
Definition: marti_nav_plan_plugin.cpp:158
mapviz_plugins::MartiNavPlanPlugin::LoadConfig
void LoadConfig(const YAML::Node &node, const std::string &path)
Definition: marti_nav_plan_plugin.cpp:380
mapviz_plugins::MartiNavPlanPlugin::src_route_
marti_nav_msgs::PlanConstPtr src_route_
Definition: marti_nav_plan_plugin.h:113
mapviz_plugins::MartiNavPlanPlugin::PrintWarning
void PrintWarning(const std::string &message)
Definition: marti_nav_plan_plugin.cpp:232
mapviz_plugins::MartiNavPlanPlugin::RouteCallback
void RouteCallback(const marti_nav_msgs::PlanConstPtr &msg)
Definition: marti_nav_plan_plugin.cpp:217
mapviz_plugins::MartiNavPlanPlugin::PrintInfo
void PrintInfo(const std::string &message)
Definition: marti_nav_plan_plugin.cpp:227
mapviz_plugins::MartiNavPlanPlugin::SelectTopic
void SelectTopic()
Definition: marti_nav_plan_plugin.cpp:144
mapviz_plugins::MartiNavPlanPlugin::topic_
std::string topic_
Definition: marti_nav_plan_plugin.h:107
mapviz_plugins::MartiNavPlanPlugin::SetDrawStyle
void SetDrawStyle(QString style)
Definition: marti_nav_plan_plugin.cpp:127
mapviz_plugins::MartiNavPlanPlugin::MartiNavPlanPlugin
MartiNavPlanPlugin()
Definition: marti_nav_plan_plugin.cpp:65
mapviz_plugins::MartiNavPlanPlugin::DrawStopWaypoint
void DrawStopWaypoint(double x, double y)
Definition: marti_nav_plan_plugin.cpp:303
mapviz_plugins::MartiNavPlanPlugin::PositionCallback
void PositionCallback(const marti_nav_msgs::PlanTrackConstPtr &msg)
Definition: marti_nav_plan_plugin.cpp:211
mapviz_plugins::MartiNavPlanPlugin::DrawRoutePoint
void DrawRoutePoint(const marti_nav_msgs::PlanPoint &point)
Definition: marti_nav_plan_plugin.cpp:354
mapviz_plugins::MartiNavPlanPlugin::STYLE_LINES
@ STYLE_LINES
Definition: marti_nav_plan_plugin.h:64
mapviz_plugins::MartiNavPlanPlugin::src_route_position_
marti_nav_msgs::PlanTrackConstPtr src_route_position_
Definition: marti_nav_plan_plugin.h:114
mapviz_plugins::MartiNavPlanPlugin::Shutdown
void Shutdown()
Definition: marti_nav_plan_plugin.h:72
mapviz_plugins::MartiNavPlanPlugin::SaveConfig
void SaveConfig(YAML::Emitter &emitter, const std::string &path)
Definition: marti_nav_plan_plugin.cpp:433
mapviz_plugins::MartiNavPlanPlugin::ui_
Ui::marti_nav_plan_config ui_
Definition: marti_nav_plan_plugin.h:102
transform_datatypes.h
mapviz_plugins::MartiNavPlanPlugin::config_widget_
QWidget * config_widget_
Definition: marti_nav_plan_plugin.h:103
mapviz::MapvizPlugin
mapviz_plugins::MartiNavPlanPlugin::Initialize
bool Initialize(QGLWidget *canvas)
Definition: marti_nav_plan_plugin.cpp:244
mapviz_plugins::MartiNavPlanPlugin::Transform
void Transform()
Definition: marti_nav_plan_plugin.h:78
mapviz_plugins
Definition: attitude_indicator_plugin.h:61
mapviz_plugins::MartiNavPlanPlugin::GetConfigWidget
QWidget * GetConfigWidget(QWidget *parent)
Definition: marti_nav_plan_plugin.cpp:237
mapviz_plugins::MartiNavPlanPlugin::~MartiNavPlanPlugin
virtual ~MartiNavPlanPlugin()
Definition: marti_nav_plan_plugin.cpp:92
map_canvas.h
mapviz_plugins::MartiNavPlanPlugin::DrawStyle
DrawStyle
Definition: marti_nav_plan_plugin.h:62
ros::Subscriber
mapviz_plugins::MartiNavPlanPlugin::PrintError
void PrintError(const std::string &message)
Definition: marti_nav_plan_plugin.cpp:222
mapviz_plugin.h
mapviz_plugins::MartiNavPlanPlugin::position_sub_
ros::Subscriber position_sub_
Definition: marti_nav_plan_plugin.h:111


mapviz_plugins
Author(s): Marc Alban
autogenerated on Wed Jan 17 2024 03:27:49