35 #include "dwb_critics/path_align.hpp"
38 #include "dwb_critics/alignment_util.hpp"
39 #include "pluginlib/class_list_macros.hpp"
40 #include "nav_2d_utils/parameters.hpp"
45 void PathAlignCritic::onInit()
47 PathDistCritic::onInit();
48 stop_on_failure_ =
false;
50 auto node = node_.lock();
52 throw std::runtime_error{
"Failed to lock node"};
55 forward_point_distance_ = nav_2d_utils::searchAndGetParam(
57 dwb_plugin_name_ +
"." + name_ +
".forward_point_distance", 0.325);
61 const geometry_msgs::msg::Pose2D & pose,
const nav_2d_msgs::msg::Twist2D & vel,
62 const geometry_msgs::msg::Pose2D & goal,
63 const nav_2d_msgs::msg::Path2D & global_plan)
65 double dx = pose.x - goal.x;
66 double dy = pose.y - goal.y;
67 double sq_dist = dx * dx + dy * dy;
68 if (sq_dist > forward_point_distance_ * forward_point_distance_) {
79 double PathAlignCritic::getScale()
const
Evaluates a Trajectory2D to produce a score.
virtual double scorePose(const geometry_msgs::msg::Pose2D &pose)
Retrieve the score for a single pose.
Scores trajectories based on how far from the global path the front of the robot ends up.
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
Prior to evaluating any trajectories, look at contextual information constant across all trajectories...
double scorePose(const geometry_msgs::msg::Pose2D &pose) override
Retrieve the score for a single pose.
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
Prior to evaluating any trajectories, look at contextual information constant across all trajectories...
double getResolution() const
Accessor for the resolution of the costmap.