hector_exploration_planner.h
Go to the documentation of this file.
1 //=================================================================================================
2 // Copyright (c) 2012, Mark Sollweck, Stefan Kohlbrecher, TU Darmstadt
3 // All rights reserved.
4 
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above copyright
10 // notice, this list of conditions and the following disclaimer in the
11 // documentation and/or other materials provided with the distribution.
12 // * Neither the name of the Simulation, Systems Optimization and Robotics
13 // group, TU Darmstadt nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without
15 // specific prior written permission.
16 
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 // DISCLAIMED. IN NO EVENT SHALL THE 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 #ifndef HECTOR_EXPLORATION_PLANNER_H___
30 #define HECTOR_EXPLORATION_PLANNER_H___
31 
32 #include <ros/ros.h>
33 #include <costmap_2d/costmap_2d.h>
35 #include <geometry_msgs/PoseStamped.h>
36 
37 #include <dynamic_reconfigure/server.h>
38 
40 
41 #include <boost/shared_array.hpp>
42 
44 
45 class ExplorationPlannerConfig;
46 
48 public:
51  HectorExplorationPlanner(std::string name,costmap_2d::Costmap2DROS *costmap_ros);
52  void initialize(std::string name,costmap_2d::Costmap2DROS *costmap_ros);
53 
54  void dynRecParamCallback(hector_exploration_planner::ExplorationPlannerConfig &config, uint32_t level);
55 
63  bool makePlan(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &original_goal, std::vector<geometry_msgs::PoseStamped> &plan);
64 
70  bool doExploration(const geometry_msgs::PoseStamped &start,std::vector<geometry_msgs::PoseStamped> &plan);
71 
78  bool doInnerExploration(const geometry_msgs::PoseStamped &start, std::vector<geometry_msgs::PoseStamped> &plan);
79 
80  bool getObservationPose(const geometry_msgs::PoseStamped& observation_pose, const double desired_distance, geometry_msgs::PoseStamped& new_observation_pose);
81 
82  bool doAlternativeExploration(const geometry_msgs::PoseStamped &start,std::vector<geometry_msgs::PoseStamped> &plan, std::vector<geometry_msgs::PoseStamped> &oldplan);
83  bool findFrontiers(std::vector<geometry_msgs::PoseStamped> &frontiers, std::vector<geometry_msgs::PoseStamped> &noFrontiers);
84  bool findFrontiersCloseToPath(std::vector<geometry_msgs::PoseStamped> &frontiers);
85  bool findFrontiers(std::vector<geometry_msgs::PoseStamped> &frontiers);
86  bool findInnerFrontier(std::vector<geometry_msgs::PoseStamped> &innerFrontier);
87 
88  float angleDifferenceWall(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal);
89  bool exploreWalls(const geometry_msgs::PoseStamped &start, std::vector<geometry_msgs::PoseStamped> &goals);
90 
91 private:
92 
93  enum LastMode{
96  } last_mode_;
97 
101  void setupMapData();
102  void deleteMapData();
103  bool buildobstacle_trans_array_(bool use_inflated_obstacles);
104  bool buildexploration_trans_array_(const geometry_msgs::PoseStamped &start, std::vector<geometry_msgs::PoseStamped> goals,bool useAnglePenalty, bool use_cell_danger = true);
105  bool getTrajectory(const geometry_msgs::PoseStamped &start, std::vector<geometry_msgs::PoseStamped> goals, std::vector<geometry_msgs::PoseStamped> &plan);
106  bool recoveryMakePlan(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal,std::vector<geometry_msgs::PoseStamped> &plan);
107  unsigned int cellDanger(int point);
108  unsigned int angleDanger(float angle);
109 
110  void saveMaps(std::string path);
111  void resetMaps();
112  void clearFrontiers();
113  bool isValid(int point);
114  bool isFree(int point);
115  bool isFreeFrontiers(int point);
116  bool isFrontier(int point);
117  float angleDifference(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal);
118  float getDistanceWeight(const geometry_msgs::PoseStamped &point1, const geometry_msgs::PoseStamped &point2);
119  double getYawToUnknown(int point);
120  bool isFrontierReached(int point);
121  bool isSameFrontier(int frontier_point1,int frontier_point2);
122 
123  void getStraightPoints(int point, int points[]);
124  void getDiagonalPoints(int point, int points[]);
125  void getAdjacentPoints(int point, int points[]);
126  int left(int point);
127  int upleft(int point);
128  int up(int point);
129  int upright(int point);
130  int right(int point);
131  int downright(int point);
132  int down(int point);
133  int downleft(int point);
134 
137 
142 
143  const unsigned char* occupancy_grid_array_;
148 
151 
152  std::string name;
153  unsigned int map_width_;
154  unsigned int map_height_;
155  unsigned int num_map_cells_;
156 
157  // Parameters
164  double p_alpha_;
170 
173 
175 
180 
181 };
182 }
183 
184 #endif
185 
186 
boost::shared_ptr< ExplorationTransformVis > close_path_vis_
bool recoveryMakePlan(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal, std::vector< geometry_msgs::PoseStamped > &plan)
boost::shared_ptr< ExplorationTransformVis > vis_
bool isSameFrontier(int frontier_point1, int frontier_point2)
boost::shared_ptr< ExplorationTransformVis > inner_vis_
float angleDifferenceWall(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal)
float getDistanceWeight(const geometry_msgs::PoseStamped &point1, const geometry_msgs::PoseStamped &point2)
void initialize(std::string name, costmap_2d::Costmap2DROS *costmap_ros)
bool getObservationPose(const geometry_msgs::PoseStamped &observation_pose, const double desired_distance, geometry_msgs::PoseStamped &new_observation_pose)
bool makePlan(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &original_goal, std::vector< geometry_msgs::PoseStamped > &plan)
enum hector_exploration_planner::HectorExplorationPlanner::LastMode last_mode_
bool findInnerFrontier(std::vector< geometry_msgs::PoseStamped > &innerFrontier)
bool doAlternativeExploration(const geometry_msgs::PoseStamped &start, std::vector< geometry_msgs::PoseStamped > &plan, std::vector< geometry_msgs::PoseStamped > &oldplan)
boost::shared_ptr< ExplorationTransformVis > obstacle_vis_
bool getTrajectory(const geometry_msgs::PoseStamped &start, std::vector< geometry_msgs::PoseStamped > goals, std::vector< geometry_msgs::PoseStamped > &plan)
boost::shared_ptr< dynamic_reconfigure::Server< hector_exploration_planner::ExplorationPlannerConfig > > dyn_rec_server_
bool doExploration(const geometry_msgs::PoseStamped &start, std::vector< geometry_msgs::PoseStamped > &plan)
bool exploreWalls(const geometry_msgs::PoseStamped &start, std::vector< geometry_msgs::PoseStamped > &goals)
bool buildexploration_trans_array_(const geometry_msgs::PoseStamped &start, std::vector< geometry_msgs::PoseStamped > goals, bool useAnglePenalty, bool use_cell_danger=true)
void dynRecParamCallback(hector_exploration_planner::ExplorationPlannerConfig &config, uint32_t level)
float angleDifference(const geometry_msgs::PoseStamped &start, const geometry_msgs::PoseStamped &goal)
bool findFrontiersCloseToPath(std::vector< geometry_msgs::PoseStamped > &frontiers)
bool doInnerExploration(const geometry_msgs::PoseStamped &start, std::vector< geometry_msgs::PoseStamped > &plan)
bool findFrontiers(std::vector< geometry_msgs::PoseStamped > &frontiers, std::vector< geometry_msgs::PoseStamped > &noFrontiers)


hector_exploration_planner
Author(s):
autogenerated on Mon Jun 10 2019 13:34:41