Class PathAlignCritic

Inheritance Relationships

Base Type

Class Documentation

class PathAlignCritic : public dwb_critics::PathDistCritic

Scores trajectories based on how far from the global path the front of the robot ends up.

This uses the costmap grid as a proxy for calculating which way the robot should be facing relative to the global path. Instead of scoring how far the center of the robot is away from the global path, this critic calculates how far a point forward_point_distance in front of the robot is from the global path. This biases the planner toward trajectories that line up with the global plan.

When the robot is near the end of the path, the scale of this critic is set to zero. When the projected point is past the global goal, we no longer want this critic to try to align to a part of the global path that isn’t there.

Public Functions

inline PathAlignCritic()
void onInit() override
virtual bool prepare(const geometry_msgs::msg::Pose2D &pose, const nav_2d_msgs::msg::Twist2D &vel, const geometry_msgs::msg::Pose2D &goal, const nav_2d_msgs::msg::Path2D &global_plan) override
double getScale() const override
virtual double scorePose(const geometry_msgs::msg::Pose2D &pose) override

Retrieve the score for a single pose.

Parameters:

pose – The pose to score, assumed to be in the same frame as the costmap

Returns:

The score associated with the cell of the costmap where the pose lies

Protected Attributes

bool zero_scale_
double forward_point_distance_