35 #ifndef DWB_CRITICS__MAP_GRID_HPP_
36 #define DWB_CRITICS__MAP_GRID_HPP_
43 #include "dwb_core/trajectory_critic.hpp"
44 #include "costmap_queue/costmap_queue.hpp"
65 void onInit()
override;
66 double scoreTrajectory(
const dwb_msgs::msg::Trajectory2D & traj)
override;
68 std::vector<std::pair<std::string, std::vector<float>>> & cost_channels)
override;
69 double getScale()
const override {
return costmap_->
getResolution() * 0.5 * scale_;}
77 virtual double scorePose(
const geometry_msgs::msg::Pose2D & pose);
85 inline double getScore(
unsigned int x,
unsigned int y)
87 return cell_values_[costmap_->
getIndex(x, y)];
126 void reset()
override;
133 std::shared_ptr<MapGridQueue> queue_;
135 std::vector<double> cell_values_;
137 bool stop_on_failure_;
Storage for cell information used during queue expansion.
Evaluates a Trajectory2D to produce a score.
Subclass of CostmapQueue that avoids Obstacles and Unknown Values.
bool validCellToQueue(const costmap_queue::CellData &cell) override
Check to see if we should add this cell to the queue. Always true unless overridden.
breadth-first scoring of all the cells in the costmap
double scoreTrajectory(const dwb_msgs::msg::Trajectory2D &traj) override
Return a raw score for the given trajectory.
void addCriticVisualization(std::vector< std::pair< std::string, std::vector< float >>> &cost_channels) override
Add information to the given pointcloud for debugging costmap-grid based scores.
ScoreAggregationType
Separate modes for aggregating scores across the multiple poses in a trajectory.
void reset() override
Clear the queuDWB_CRITICS_MAP_GRID_He and set cell_values_ to the appropriate number of unreachableCe...
virtual double scorePose(const geometry_msgs::msg::Pose2D &pose)
Retrieve the score for a single pose.
void setAsObstacle(unsigned int index)
Sets the score of a particular cell to the obstacle cost.
void propogateManhattanDistances()
Go through the queue and set the cells to the Manhattan distance from their parents.
double getScore(unsigned int x, unsigned int y)
Retrieve the score for a particular cell of the costmap.
double unreachable_score_
Special cell_values.
A 2D costmap provides a mapping between points in the world and their associated "costs".
unsigned int getIndex(unsigned int mx, unsigned int my) const
Given two map coordinates... compute the associated index.
double getResolution() const
Accessor for the resolution of the costmap.