35 #include "dwb_critics/path_align.hpp"
38 #include "dwb_critics/alignment_util.hpp"
39 #include "pluginlib/class_list_macros.hpp"
44 void PathAlignCritic::onInit()
46 PathDistCritic::onInit();
47 stop_on_failure_ =
false;
49 auto node = node_.lock();
51 throw std::runtime_error{
"Failed to lock node"};
54 forward_point_distance_ = node->declare_or_get_parameter(
55 dwb_plugin_name_ +
"." + name_ +
".forward_point_distance", 0.325);
59 const geometry_msgs::msg::Pose & pose,
const nav_2d_msgs::msg::Twist2D & vel,
60 const geometry_msgs::msg::Pose & goal,
61 const nav_msgs::msg::Path & global_plan)
63 double dx = pose.position.x - goal.position.x;
64 double dy = pose.position.y - goal.position.y;
65 double sq_dist = dx * dx + dy * dy;
66 if (sq_dist > forward_point_distance_ * forward_point_distance_) {
77 double PathAlignCritic::getScale()
const
Evaluates a Trajectory2D to produce a score.
virtual double scorePose(const geometry_msgs::msg::Pose &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.
double scorePose(const geometry_msgs::msg::Pose &pose) override
Retrieve the score for a single pose.
bool prepare(const geometry_msgs::msg::Pose &pose, const nav_2d_msgs::msg::Twist2D &vel, const geometry_msgs::msg::Pose &goal, const nav_msgs::msg::Path &global_plan) override
Prior to evaluating any trajectories, look at contextual information constant across all trajectories...
bool prepare(const geometry_msgs::msg::Pose &pose, const nav_2d_msgs::msg::Twist2D &vel, const geometry_msgs::msg::Pose &goal, const nav_msgs::msg::Path &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.