mst_path.h
Go to the documentation of this file.
1 #ifndef MST_PATH_H
2 #define MST_PATH_H
3 
4 #include <deque>
5 #include <valarray>
6 #include <unordered_set>
7 #include <ros/ros.h>
8 #include <tf2/utils.h>
9 #include <geometry_msgs/Point.h>
10 #include <geometry_msgs/PoseArray.h>
11 #include <nav_msgs/OccupancyGrid.h>
12 #include <nav_msgs/Path.h>
13 #include "lib/edge.h"
14 
15 using namespace std;
16 using namespace ros;
17 
21 class mst_path
22 {
23 public:
27  mst_path ();
28 
33  void generate_path (geometry_msgs::Point);
34 
39  geometry_msgs::PoseArray get_grid ();
40 
45  nav_msgs::Path get_path ();
46 
53  geometry_msgs::Point get_waypoint (geometry_msgs::Point position, double tolerance);
54 
60  void initialize_graph (nav_msgs::OccupancyGrid gridmap, bool connect4 = true);
61 
66  void initialize_tree (vector<edge> mst);
67 
72  bool valid ();
73 
74 private:
81  void add_edge(int from, int to, int cost);
82 
89  double dist (geometry_msgs::Point p1, geometry_msgs::Point p2);
90 
96  geometry_msgs::Point get_wp (int offset=0);
97 
102  void remove_edge (edge e);
103 
107  deque<geometry_msgs::Point> path;
108 
112  unordered_set<edge, hash_edge> edges;
113 
117  vector<unordered_set<int>> nodes;
118 
122  nav_msgs::OccupancyGrid map;
123 
127  int wp;
128 };
129 
130 #endif // MST_PATH_H
bool get_path(nav_msgs::GetPlan::Request &req, nav_msgs::GetPlan::Response &res)
Callback function to get the coverage path.
bool get_waypoint(cpswarm_msgs::GetWaypoint::Request &req, cpswarm_msgs::GetWaypoint::Response &res)
Callback function to get the current waypoint of the path.
nav_msgs::OccupancyGrid gridmap
The grid map representing the environment to be covered.
Definition: coverage_path.h:69
int wp
The current way point.
Definition: mst_path.h:127
A class for representing edges.
Definition: edge.h:9
vector< unordered_set< int > > nodes
The sets of connected vertices.
Definition: mst_path.h:117
nav_msgs::OccupancyGrid map
The grid map that needs to be covered by the MST path.
Definition: mst_path.h:122
deque< geometry_msgs::Point > path
The boustrophedon path.
Definition: mst_path.h:107
bool generate_path()
Generate an optimal coverage path for a given area.
An class to compute the coverage path based on a minimum-spanning-tree (MST).
Definition: mst_path.h:21
unordered_set< edge, hash_edge > edges
Priority queue of edge objects sorted by cost.
Definition: mst_path.h:112


coverage_path
Author(s): Micha Sende
autogenerated on Thu Oct 31 2019 10:37:30