map_grid.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2017, Locus Robotics
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef DWB_CRITICS_MAP_GRID_H
36 #define DWB_CRITICS_MAP_GRID_H
37 
40 #include <vector>
41 
42 namespace dwb_critics
43 {
58 {
59 public:
61 
62  // Standard TrajectoryCritic Interface
63  void onInit() override;
64  double scoreTrajectory(const dwb_msgs::Trajectory2D& traj) override;
65  void addCriticVisualization(sensor_msgs::PointCloud& pc) override;
66  double getScale() const override { return costmap_->getResolution() * 0.5 * scale_; }
67 
68  // Helper Functions
74  virtual double scorePose(const geometry_msgs::Pose2D& pose);
75 
82  inline double getScore(unsigned int x, unsigned int y) { return cell_values_(x, y); }
83 
89  void setAsObstacle(unsigned int x, unsigned int y);
90 
91 protected:
100 
106  {
107  public:
109  : costmap_queue::CostmapQueue(costmap, true), parent_(parent) {}
110  bool validCellToQueue(const costmap_queue::CellData& cell) override;
111  protected:
113  };
114 
118  void reset() override;
119 
124 
125  std::shared_ptr<MapGridQueue> queue_;
130 };
131 } // namespace dwb_critics
132 
133 #endif // DWB_CRITICS_MAP_GRID_H
ScoreAggregationType
Separate modes for aggregating scores across the multiple poses in a trajectory.
Definition: map_grid.h:99
void reset() override
Clear the queue and set cell_values_ to the appropriate number of unreachableCellScore.
Definition: map_grid.cpp:93
Subclass of CostmapQueue that avoids Obstacles and Unknown Values.
Definition: map_grid.h:105
virtual double scorePose(const geometry_msgs::Pose2D &pose)
Retrieve the score for a single pose.
Definition: map_grid.cpp:169
void propogateManhattanDistances()
Go through the queue and set the cells to the Manhattan distance from their parents.
Definition: map_grid.cpp:109
MapGridQueue(nav_core2::Costmap &costmap, MapGridCritic &parent)
Definition: map_grid.h:108
void setAsObstacle(unsigned int x, unsigned int y)
Sets the score of a particular cell to the obstacle cost.
Definition: map_grid.cpp:88
TFSIMD_FORCE_INLINE const tfScalar & y() const
double getScale() const override
Definition: map_grid.h:66
ScoreAggregationType aggregationType_
Definition: map_grid.h:129
void addCriticVisualization(sensor_msgs::PointCloud &pc) override
Definition: map_grid.cpp:180
nav_core2::Costmap::Ptr costmap_
breadth-first scoring of all the cells in the costmap
Definition: map_grid.h:57
TFSIMD_FORCE_INLINE const tfScalar & x() const
double getScore(unsigned int x, unsigned int y)
Retrieve the score for a particular cell of the costmap.
Definition: map_grid.h:82
void onInit() override
Definition: map_grid.cpp:59
std::shared_ptr< MapGridQueue > queue_
Definition: map_grid.h:125
nav_grid::VectorNavGrid< double > cell_values_
Definition: map_grid.h:126
double scoreTrajectory(const dwb_msgs::Trajectory2D &traj) override
Definition: map_grid.cpp:120
double unreachable_score_
Special cell_values.
Definition: map_grid.h:127


dwb_critics
Author(s): David V. Lu!!
autogenerated on Wed Jun 26 2019 20:06:22