SMACC2
Loading...
Searching...
No Matches
backward_local_planner.cpp
Go to the documentation of this file.
1// Copyright 2025 Robosoft Inc.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15/*****************************************************************************************************************
16 *
17 * Authors: Pablo Inigo Blasco, Brett Aldrich
18 *
19 ******************************************************************************************************************/
20
21#include <angles/angles.h>
24
25#include <boost/intrusive_ptr.hpp>
26#include <chrono>
27#include <nav_2d_utils/tf_help.hpp>
28#include <pluginlib/class_list_macros.hpp>
29#include <visualization_msgs/msg/marker_array.hpp>
30
31// register this planner as a BaseLocalPlanner plugin
32PLUGINLIB_EXPORT_CLASS(
34
35using namespace std::literals::chrono_literals;
36
37namespace cl_nav2z
38{
39namespace backward_local_planner
40{
47
54
56{
57 RCLCPP_INFO_STREAM(nh_->get_logger(), "activating controller BackwardLocalPlanner");
59
60 goalMarkerPublisher_->on_activate();
61 planPub_->on_activate();
62 backwardsPlanPath_.clear();
63}
64
66{
67 this->clearMarkers();
68 RCLCPP_WARN_STREAM(nh_->get_logger(), "[BackwardLocalPlanner] deactivated");
69 planPub_->on_deactivate();
70 goalMarkerPublisher_->on_deactivate();
71}
72
74{
75 this->clearMarkers();
76 RCLCPP_WARN_STREAM(nh_->get_logger(), "[BackwardLocalPlanner] cleanup");
77 this->backwardsPlanPath_.clear();
79}
80
87template <typename T>
88void tryGetOrSet(rclcpp_lifecycle::LifecycleNode::SharedPtr & node, std::string param, T & value)
89{
90 if (!node->get_parameter(param, value))
91 {
92 node->set_parameter(rclcpp::Parameter(param, value));
93 }
94}
95
97 const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent, std::string name,
98 const std::shared_ptr<tf2_ros::Buffer> tf,
99 const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros)
100{
101 this->costmapRos_ = costmap_ros;
102 this->nh_ = parent.lock();
103 this->name_ = name;
104 this->tf_ = tf;
105
106 k_rho_ = -1.0;
107 k_alpha_ = 0.5;
108 k_betta_ = -1.0; // set to zero means that orientation is not important
109 carrot_distance_ = 0.4;
119 waitingTimeout_ = rclcpp::Duration(10s);
120
121 this->currentCarrotPoseIndex_ = 0;
122
124 nh_, name_ + ".pure_spinning_straight_line_mode", straightBackwardsAndPureSpinningMode_);
125
126 declareOrSet(nh_, name_ + ".k_rho", k_rho_);
127 declareOrSet(nh_, name_ + ".k_alpha", k_alpha_);
128 declareOrSet(nh_, name_ + ".k_betta", k_betta_);
129 declareOrSet(nh_, name_ + ".linear_mode_rho_error_threshold", linear_mode_rho_error_threshold_);
131 nh_, name_ + ".initial_rotation_alpha_error_threshold",
133
134 declareOrSet(nh_, name_ + ".carrot_distance", carrot_distance_);
135 declareOrSet(nh_, name_ + ".carrot_angular_distance", carrot_angular_distance_);
136 declareOrSet(nh_, name_ + ".enable_obstacle_checking", enable_obstacle_checking_);
137
138 declareOrSet(nh_, name_ + ".max_linear_x_speed", max_linear_x_speed_);
139 declareOrSet(nh_, name_ + ".max_angular_z_speed", max_angular_z_speed_);
140 declareOrSet(nh_, name_ + ".transform_tolerance", transform_tolerance_);
141
142 // we have to do this, for example for the case we are refining the final orientation.
143 // check at some point if the carrot is reached in "goal linear distance", then we go into
144 // some automatic pure-spinning mode where we only update the orientation
145 // This means that if we reach the carrot with precision we go into pure spinning mode but we cannot
146 // leave that point (maybe this could be improved)
147
149 {
150 RCLCPP_WARN_STREAM(
151 nh_->get_logger(), "[BackwardLocalPlanner] carrot_angular_distance ("
153 << ") cannot be lower than yaw_goal_tolerance (" << yaw_goal_tolerance_
154 << ") setting carrot_angular_distance = " << yaw_goal_tolerance_);
156 }
157
159 {
160 RCLCPP_WARN_STREAM(
161 nh_->get_logger(), "[BackwardLocalPlanner] carrot_linear_distance ("
162 << carrot_distance_ << ") cannot be lower than xy_goal_tolerance_ ("
164 << ") setting carrot_angular_distance = " << xy_goal_tolerance_);
166 }
167
168 goalMarkerPublisher_ = nh_->create_publisher<visualization_msgs::msg::MarkerArray>(
169 "backward_local_planner/goal_marker", rclcpp::QoS(1));
170
171 planPub_ =
172 nh_->create_publisher<nav_msgs::msg::Path>("backward_local_planner/path", rclcpp::QoS(1));
173}
174
176{
177 RCLCPP_INFO_STREAM(nh_->get_logger(), "--- parameters ---");
178 tryGetOrSet(nh_, name_ + ".k_rho", k_rho_);
179 RCLCPP_INFO_STREAM(nh_->get_logger(), name_ + ".k_rho:" << k_rho_);
180 tryGetOrSet(nh_, name_ + ".k_alpha", k_alpha_);
181 RCLCPP_INFO_STREAM(nh_->get_logger(), name_ + ".k_alpha:" << k_alpha_);
182 tryGetOrSet(nh_, name_ + ".k_betta", k_betta_);
183 RCLCPP_INFO_STREAM(nh_->get_logger(), name_ + ".k_betta:" << k_betta_);
185 nh_, name_ + ".initial_rotation_alpha_error_threshold",
187 RCLCPP_INFO_STREAM(
188 nh_->get_logger(),
189 name_ + ".initial_rotation_alpha_error_threshold: " << initial_rotation_alpha_error_threshold_);
190
191 tryGetOrSet(nh_, name_ + ".enable_obstacle_checking", enable_obstacle_checking_);
192 RCLCPP_INFO_STREAM(
193 nh_->get_logger(), name_ + ".enable_obstacle_checking: " << enable_obstacle_checking_);
194
195 tryGetOrSet(nh_, name_ + ".carrot_distance", carrot_distance_);
196 RCLCPP_INFO_STREAM(nh_->get_logger(), name_ + ".carrot_distance:" << carrot_distance_);
197 tryGetOrSet(nh_, name_ + ".carrot_angular_distance", carrot_angular_distance_);
198 RCLCPP_INFO_STREAM(
199 nh_->get_logger(), name_ + ".carrot_angular_distance: " << carrot_angular_distance_);
200
202 nh_, name_ + ".pure_spinning_straight_line_mode", straightBackwardsAndPureSpinningMode_);
203 RCLCPP_INFO_STREAM(
204 nh_->get_logger(),
205 name_ + ".pure_spinning_straight_line_mode: " << straightBackwardsAndPureSpinningMode_);
206
207 tryGetOrSet(nh_, name_ + ".linear_mode_rho_error_threshold", linear_mode_rho_error_threshold_);
208 RCLCPP_INFO_STREAM(
209 nh_->get_logger(),
210 name_ + ".linear_mode_rho_error_threshold: " << linear_mode_rho_error_threshold_);
211 tryGetOrSet(nh_, name_ + ".max_linear_x_speed", max_linear_x_speed_);
212 RCLCPP_INFO_STREAM(nh_->get_logger(), name_ + ".max_linear_x_speed: " << max_linear_x_speed_);
213 tryGetOrSet(nh_, name_ + ".max_angular_z_speed", max_angular_z_speed_);
214 RCLCPP_INFO_STREAM(nh_->get_logger(), name_ + ".max_angular_z_speed: " << max_angular_z_speed_);
215
217 {
218 RCLCPP_WARN_STREAM(
219 nh_->get_logger(), "[BackwardLocalPlanner] carrot_angular_distance ("
221 << ") cannot be lower than yaw_goal_tolerance (" << yaw_goal_tolerance_
222 << ") setting carrot_angular_distance = " << yaw_goal_tolerance_);
224 nh_->set_parameter(
225 rclcpp::Parameter(name_ + ".carrot_angular_distance", carrot_angular_distance_));
226 }
227 RCLCPP_INFO_STREAM(
228 nh_->get_logger(), name_ + ".carrot_angular_distance: " << carrot_angular_distance_);
229
231 {
232 RCLCPP_WARN_STREAM(
233 nh_->get_logger(), "[BackwardLocalPlanner] carrot_linear_distance ("
234 << carrot_distance_ << ") cannot be lower than xy_goal_tolerance_ ("
236 << ") setting carrot_angular_distance = " << xy_goal_tolerance_);
238 nh_->set_parameter(rclcpp::Parameter(name_ + ".carrot_distance", carrot_distance_));
239 }
240 RCLCPP_INFO_STREAM(nh_->get_logger(), name_ + ".carrot_distance:" << carrot_distance_);
241 RCLCPP_INFO_STREAM(nh_->get_logger(), "--- end params ---");
242}
243
245 const double & /*speed_limit*/, const bool & /*percentage*/)
246{
247 RCLCPP_WARN_STREAM(
248 nh_->get_logger(),
249 "BackwardLocalPlanner::setSpeedLimit invoked. Ignored, functionality not "
250 "implemented.");
251}
258 const geometry_msgs::msg::PoseStamped & tfpose, double & dist, double & angular_error)
259{
260 double angle = tf2::getYaw(tfpose.pose.orientation);
261 auto & carrot_pose = backwardsPlanPath_[currentCarrotPoseIndex_];
262 const geometry_msgs::msg::Point & carrot_point = carrot_pose.pose.position;
263
264 tf2::Quaternion carrot_orientation;
265 tf2::convert(carrot_pose.pose.orientation, carrot_orientation);
266 geometry_msgs::msg::Pose currentPoseDebugMsg = tfpose.pose;
267
268 // take error from the current position to the path point
269 double dx = carrot_point.x - tfpose.pose.position.x;
270 double dy = carrot_point.y - tfpose.pose.position.y;
271
272 dist = sqrt(dx * dx + dy * dy);
273
274 double pangle = tf2::getYaw(carrot_orientation);
275 angular_error = fabs(angles::shortest_angular_distance(pangle, angle));
276
277 RCLCPP_INFO_STREAM(
278 nh_->get_logger(), "[BackwardLocalPlanner] Compute carrot errors from current pose. (linear "
279 << dist << ")(angular " << angular_error << ")" << '\n'
280 << "Current carrot pose: " << '\n'
281 << carrot_pose << '\n'
282 << "Current actual pose:" << '\n'
283 << currentPoseDebugMsg);
284}
285
291bool BackwardLocalPlanner::updateCarrotGoal(const geometry_msgs::msg::PoseStamped & tfpose)
292{
293 RCLCPP_INFO_STREAM(nh_->get_logger(), "[BackwardsLocalPlanner] --- Carrot update ---");
294 double disterr = 0, angleerr = 0;
295 // iterate the point from the current position and backward until reaching a new goal point in the path
296 // this algorithm among other advantages has that skip the looping with an eager global planner
297 // that recalls the same plan (the already performed part of the plan in the current pose is skipped)
298 while (currentCarrotPoseIndex_ < (long)backwardsPlanPath_.size() - 1)
299 {
301
302 RCLCPP_INFO_STREAM(
303 nh_->get_logger(), "[BackwardsLocalPlanner] update carrot goal: Current index: "
304 << currentCarrotPoseIndex_ << "/" << backwardsPlanPath_.size());
305 RCLCPP_INFO(
306 nh_->get_logger(),
307 "[BackwardsLocalPlanner] update carrot goal: linear error %lf, angular error: %lf", disterr,
308 angleerr);
309
310 // target pose found, goal carrot tries to escape!
311 if (disterr < carrot_distance_ && angleerr < carrot_angular_distance_)
312 {
315 RCLCPP_INFO_STREAM(
316 nh_->get_logger(), "[BackwardsLocalPlanner] move carrot fw "
317 << currentCarrotPoseIndex_ << "/" << backwardsPlanPath_.size());
318 }
319 else
320 {
321 // carrot already escaped
322 break;
323 }
324 }
325 // RCLCPP_INFO(nh_->get_logger(),"[BackwardsLocalPlanner] computing angular error");
326 if (
327 currentCarrotPoseIndex_ >= (long)backwardsPlanPath_.size() - 1 && backwardsPlanPath_.size() > 0)
328 {
330 // reupdated errors
332 }
333
334 RCLCPP_INFO(
335 nh_->get_logger(), "[BackwardsLocalPlanner] Current index carrot goal: %d",
337 RCLCPP_INFO(
338 nh_->get_logger(),
339 "[BackwardsLocalPlanner] Update carrot goal: linear error %lf (xytol: %lf), angular error: "
340 "%lf",
341 disterr, xy_goal_tolerance_, angleerr);
342
343 bool carrotInGoalLinearRange = disterr < xy_goal_tolerance_;
344 RCLCPP_INFO(
345 nh_->get_logger(), "[BackwardsLocalPlanner] carrot in goal radius: %d",
346 carrotInGoalLinearRange);
347
348 RCLCPP_INFO(nh_->get_logger(), "[BackwardsLocalPlanner] ---End carrot update---");
349
350 return carrotInGoalLinearRange;
351}
352
354{
355 // this function should be called always the carrot is updated
356 divergenceDetectionLastCarrotLinearDistance_ = std::numeric_limits<double>::max();
357 return true;
358}
359
360bool BackwardLocalPlanner::divergenceDetectionUpdate(const geometry_msgs::msg::PoseStamped & tfpose)
361{
362 double disterr = 0, angleerr = 0;
364
365 RCLCPP_INFO_STREAM(
366 nh_->get_logger(), "[BackwardLocalPlanner] Divergence check. carrot goal distance. was: "
368 << ", now it is: " << disterr);
370 {
371 // candidate of divergence, we do not throw the divergence alarm yet
372 // but we neither update the distance since it is worse than the one
373 // we had previously with the same carrot.
374 const double MARGIN_FACTOR = 1.2;
375 if (disterr > MARGIN_FACTOR * divergenceDetectionLastCarrotLinearDistance_)
376 {
377 RCLCPP_ERROR_STREAM(
378 nh_->get_logger(),
379 "[BackwardLocalPlanner] Divergence detected. The same carrot goal distance was previously: "
380 << divergenceDetectionLastCarrotLinearDistance_ << "but now it is: " << disterr);
381 return true;
382 }
383 else
384 {
385 // divergence candidate
386 return false;
387 }
388 }
389 else
390 {
391 // update:
393 return false;
394 }
395}
396
398 const geometry_msgs::msg::PoseStamped & tfpose)
399{
400 // this function is specially useful when we want to reach the goal with a lot
401 // of precision. We may pass the goal and then the controller enters in some
402 // unstable state. With this, we are able to detect when stop moving.
403
404 // only apply if the carrot is in goal position and also if we are not in a pure spinning behavior v!=0
405
406 auto & carrot_pose = backwardsPlanPath_[currentCarrotPoseIndex_];
407 const geometry_msgs::msg::Point & carrot_point = carrot_pose.pose.position;
408 double yaw = tf2::getYaw(carrot_pose.pose.orientation);
409
410 // direction vector
411 double vx = cos(yaw);
412 double vy = sin(yaw);
413
414 // line implicit equation
415 // ax + by + c = 0
416 double c = -vx * carrot_point.x - vy * carrot_point.y;
417 const double C_OFFSET_METERS = 0.05; // 5 cm
418 double check = vx * tfpose.pose.position.x + vy * tfpose.pose.position.y + c + C_OFFSET_METERS;
419
420 RCLCPP_INFO_STREAM(
421 nh_->get_logger(),
422 "[BackwardLocalPlanner] half plane constraint:" << vx << "*" << carrot_point.x << " + " << vy
423 << "*" << carrot_point.y << " + " << c);
424 RCLCPP_INFO_STREAM(
425 nh_->get_logger(), "[BackwardLocalPlanner] constraint evaluation: "
426 << vx << "*" << tfpose.pose.position.x << " + " << vy << "*"
427 << tfpose.pose.position.y << " + " << c << " = " << check);
428
429 return check < 0;
430}
431
433 const geometry_msgs::msg::PoseStamped & tfpose,
434 const geometry_msgs::msg::Twist & /*currentTwist*/, double angle_error, bool & linearGoalReached,
435 nav2_core::GoalChecker * /*goal_checker*/)
436{
437 auto & finalgoal = backwardsPlanPath_.back();
438 double gdx = finalgoal.pose.position.x - tfpose.pose.position.x;
439 double gdy = finalgoal.pose.position.y - tfpose.pose.position.y;
440 double goaldist = sqrt(gdx * gdx + gdy * gdy);
441
442 auto abs_angle_error = fabs(angle_error);
443 RCLCPP_INFO_STREAM(
444 nh_->get_logger(), "[BackwardLocalPlanner] goal check. linear dist: "
445 << goaldist << "(" << this->xy_goal_tolerance_ << ")" << ", angular dist: "
446 << abs_angle_error << "(" << this->yaw_goal_tolerance_ << ")");
447
448 linearGoalReached = goaldist < this->xy_goal_tolerance_;
449
450 return linearGoalReached && abs_angle_error < this->yaw_goal_tolerance_;
451}
452
459 const geometry_msgs::msg::PoseStamped & /*tfpose*/, double & vetta, double & gamma,
460 double alpha_error, double betta_error, double rho_error)
461{
462 if (rho_error > linear_mode_rho_error_threshold_) // works in straight motion mode
463 {
464 if (fabs(alpha_error) > initial_rotation_alpha_error_threshold_)
465 {
466 // backward heading is misaligned with the carrot direction: spin in place to
467 // align before translating. Without this gate the robot orbits the goal on
468 // curved-path endgames: at full backward speed the angular authority
469 // (max_angular_z_speed) yields a minimum turning radius larger than the goal
470 // tolerance, so a misaligned approach can never converge.
471 vetta = 0;
472 gamma = k_alpha_ * alpha_error;
473 }
474 else
475 {
476 vetta = k_rho_ * rho_error;
477 gamma = k_alpha_ * alpha_error;
478 }
479 }
480 else if (fabs(betta_error) >= this->yaw_goal_tolerance_) // works in pure spinning mode
481 {
482 vetta = 0; // disable linear
483 gamma = k_betta_ * betta_error;
484 }
485}
486
492geometry_msgs::msg::TwistStamped BackwardLocalPlanner::computeVelocityCommands(
493 const geometry_msgs::msg::PoseStamped & pose, const geometry_msgs::msg::Twist & velocity,
494 nav2_core::GoalChecker * goal_checker)
495{
496 RCLCPP_INFO(
497 nh_->get_logger(),
498 "[BackwardLocalPlanner] ------------------- LOCAL PLANNER LOOP -----------------");
499 this->updateParameters();
500
501 // consistency check
502 if (this->backwardsPlanPath_.size() > 0)
503 {
504 RCLCPP_INFO_STREAM(
505 nh_->get_logger(), "[BackwardLocalPlanner] Current pose frame id: "
506 << backwardsPlanPath_.front().header.frame_id
507 << ", path pose frame id: " << pose.header.frame_id);
508
509 if (backwardsPlanPath_.front().header.frame_id != pose.header.frame_id)
510 {
511 RCLCPP_ERROR_STREAM(nh_->get_logger(), "[BackwardLocalPlanner] Inconsistent frames");
512 }
513 }
514
515 // xy_goal_tolerance and yaw_goal_tolerance are just used for logging proposes and clamping the carrot
516 // goal distance (parameter safety)
517 if (xy_goal_tolerance_ == -1 || yaw_goal_tolerance_ == -1)
518 {
519 geometry_msgs::msg::Pose posetol;
520 geometry_msgs::msg::Twist twistol;
521 if (goal_checker->getTolerances(posetol, twistol))
522 {
523 xy_goal_tolerance_ = posetol.position.x;
524 yaw_goal_tolerance_ = tf2::getYaw(posetol.orientation);
525
526 RCLCPP_INFO_STREAM(
527 nh_->get_logger(), "[BackwardLocalPlanner] xy_goal_tolerance_: "
529 << ", yaw_goal_tolerance_: " << yaw_goal_tolerance_);
530 }
531 else
532 {
533 RCLCPP_INFO_STREAM(
534 nh_->get_logger(), "[BackwardLocalPlanner] could not get tolerances from goal checker");
535 }
536 }
537
538 RCLCPP_INFO(
539 nh_->get_logger(),
540 "[BackwardLocalPlanner] ------------------- LOCAL PLANNER LOOP -----------------");
541
542 geometry_msgs::msg::TwistStamped cmd_vel;
543 RCLCPP_INFO(nh_->get_logger(), "[BackwardLocalPlanner] LOCAL PLANNER LOOP");
544 geometry_msgs::msg::PoseStamped paux;
545 geometry_msgs::msg::PoseStamped tfpose;
546
547 if (!costmapRos_->getRobotPose(tfpose))
548 {
549 RCLCPP_ERROR(
550 nh_->get_logger(),
551 "[BackwardLocalPlanner] missing robot pose, canceling compute Velocity Command");
552 }
553
554 bool carrotInLinearGoalRange = updateCarrotGoal(tfpose);
555 RCLCPP_INFO_STREAM(nh_->get_logger(), "[BackwardLocalPlanner] carrot goal created");
556
557 // ------ Evaluate the current context ----
558 double rho_error = 0.0, betta_error = 0.0, alpha_error = 0.0;
559
560 // getting carrot goal information
561 tf2::Quaternion q;
562 tf2::convert(tfpose.pose.orientation, q);
563
564 RCLCPP_INFO_STREAM(
565 nh_->get_logger(), "[BackwardLocalPlanner] carrot goal: " << currentCarrotPoseIndex_ << "/"
566 << backwardsPlanPath_.size());
567 const geometry_msgs::msg::PoseStamped & carrotgoalpose =
569 RCLCPP_INFO_STREAM(
570 nh_->get_logger(), "[BackwardLocalPlanner] carrot goal pose current index: "
571 << currentCarrotPoseIndex_ << "/" << backwardsPlanPath_.size() << ": "
572 << carrotgoalpose);
573 const geometry_msgs::msg::Point & carrotGoalPosition = carrotgoalpose.pose.position;
574
575 tf2::Quaternion goalQ;
576 tf2::fromMsg(carrotgoalpose.pose.orientation, goalQ);
577 RCLCPP_INFO_STREAM(nh_->get_logger(), "[BackwardLocalPlanner] -- Control Policy --");
578 // goal orientation (global frame)
579 double betta = tf2::getYaw(goalQ);
580 RCLCPP_INFO_STREAM(nh_->get_logger(), "[BackwardLocalPlanner] goal orientation: " << betta);
581 betta = betta + betta_offset_;
582
583 double dx = carrotGoalPosition.x - tfpose.pose.position.x;
584 double dy = carrotGoalPosition.y - tfpose.pose.position.y;
585
586 // distance error to the targetpoint
587 rho_error = sqrt(dx * dx + dy * dy);
588
589 // heading to goal angle
590 double theta = tf2::getYaw(q);
591 double alpha = atan2(dy, dx);
592 alpha = alpha + alpha_offset_;
593
594 alpha_error = angles::shortest_angular_distance(alpha, theta);
595 betta_error = angles::shortest_angular_distance(betta, theta);
596 //------------- END CONTEXT EVAL ----------
597
598 bool linearGoalReached = false;
599 bool currentPoseInGoal =
600 checkCurrentPoseInGoalRange(tfpose, velocity, betta_error, linearGoalReached, goal_checker);
601
602 // Make sure the robot is very close to the goal and it is really in the the last goal point.
603 bool carrotInFinalGoalIndex = currentCarrotPoseIndex_ == (int)backwardsPlanPath_.size() - 1;
604
605 // checking if we are really in the end goal pose
606 if (currentPoseInGoal && carrotInFinalGoalIndex)
607 {
608 goalReached_ = true;
609 RCLCPP_INFO_STREAM(
610 nh_->get_logger(),
611 "[BackwardLocalPlanner] GOAL REACHED. Send stop command and skipping trajectory collision: "
612 << cmd_vel.twist);
613 cmd_vel.twist.linear.x = 0;
614 cmd_vel.twist.angular.z = 0;
615 return cmd_vel;
616 }
617 else if (
618 carrotInLinearGoalRange &&
619 linearGoalReached) // checking if we are in the end goal point but with incorrect
620 // orientation
621 {
622 // this means that we are not in the final angular distance, and we may even not be in the last carrot index
623 // (several intermediate angular poses until the last goal pose)
625 }
626
627 // --------------------
628 // zero-initialized: straightBackwardsAndPureSpinCmd leaves them untouched when the
629 // robot is within both the linear threshold and the yaw tolerance (safe stop)
630 double vetta = 0;
631 double gamma = 0;
633 {
634 // decorated control rule for this mode
636 tfpose, vetta, gamma, alpha_error, betta_error, rho_error);
637 }
638 else // default free navigation backward motion mode
639 {
640 // regular control rule
641 vetta = k_rho_ * rho_error;
642 gamma = k_alpha_ * alpha_error + k_betta_ * betta_error;
643
644 // Even if we are in free navigation, we can enter in the pure spinning state.
645 // then, the linear motion is deactivated.
647 {
648 RCLCPP_INFO(
649 nh_->get_logger(),
650 "[BackwardLocalPlanner] we entered in a pure spinning state even in not pure-spining "
651 "configuration, "
652 "carrotDistanceGoalReached: %d",
653 carrotInLinearGoalRange);
654 gamma = k_betta_ * betta_error;
655 vetta = 0;
656 }
657
658 // classical control to reach a goal backwards
659 }
660
661 // Apply command and Clamp to limits
662 cmd_vel.twist.linear.x = vetta;
663 cmd_vel.twist.angular.z = gamma;
664
665 if (cmd_vel.twist.linear.x > max_linear_x_speed_)
666 {
667 cmd_vel.twist.linear.x = max_linear_x_speed_;
668 }
669 else if (cmd_vel.twist.linear.x < -max_linear_x_speed_)
670 {
671 cmd_vel.twist.linear.x = -max_linear_x_speed_;
672 }
673
674 if (cmd_vel.twist.angular.z > max_angular_z_speed_)
675 {
676 cmd_vel.twist.angular.z = max_angular_z_speed_;
677 }
678 else if (cmd_vel.twist.angular.z < -max_angular_z_speed_)
679 {
680 cmd_vel.twist.angular.z = -max_angular_z_speed_;
681 }
682
683 publishGoalMarker(carrotGoalPosition.x, carrotGoalPosition.y, betta);
684
685 RCLCPP_INFO_STREAM(
686 nh_->get_logger(), "[BackwardLocalPlanner] local planner,"
687 << '\n'
688 << " current pose in goal: " << currentPoseInGoal << '\n'
689 << " carrot in final goal index: " << carrotInFinalGoalIndex << '\n'
690 << " carrot in linear goal range: " << carrotInLinearGoalRange << '\n'
691 << " straightAnPureSpiningMode: " << straightBackwardsAndPureSpinningMode_
692 << '\n'
693 << " inGoalPureSpinningState: " << inGoalPureSpinningState_ << '\n'
694 << " theta: " << theta << '\n'
695 << " betta: " << theta << '\n'
696 << " err_x: " << dx << '\n'
697 << " err_y:" << dy << '\n'
698 << " rho_error:" << rho_error << '\n'
699 << " alpha_error:" << alpha_error << '\n'
700 << " betta_error:" << betta_error << '\n'
701 << " vetta:" << vetta << '\n'
702 << " gamma:" << gamma << '\n'
703 << " cmd_vel.lin.x:" << cmd_vel.twist.linear.x << '\n'
704 << " cmd_vel.ang.z:" << cmd_vel.twist.angular.z);
705
707 {
708 bool carrotHalfPlaneConstraintFailure = checkCarrotHalfPlainConstraint(tfpose);
709
710 if (carrotHalfPlaneConstraintFailure)
711 {
712 RCLCPP_ERROR(
713 nh_->get_logger(),
714 "[BackwardLocalPlanner] CarrotHalfPlaneConstraintFailure detected. Sending "
715 "emergency stop and success to the planner.");
716 cmd_vel.twist.linear.x = 0;
717 }
718 }
719
720 // ---------------------- TRAJECTORY PREDICTION AND COLLISION AVOIDANCE ---------------------
721 geometry_msgs::msg::PoseStamped global_pose;
722 costmapRos_->getRobotPose(global_pose);
723
724 auto * costmap2d = costmapRos_->getCostmap();
725 auto yaw = tf2::getYaw(global_pose.pose.orientation);
726
727 auto & pos = global_pose.pose.position;
728
729 Eigen::Vector3f currentpose(pos.x, pos.y, yaw);
730 Eigen::Vector3f currentvel(
731 cmd_vel.twist.linear.x, cmd_vel.twist.linear.y, cmd_vel.twist.angular.z);
732 std::vector<Eigen::Vector3f> trajectory;
733 this->generateTrajectory(
734 currentpose, currentvel, 0.8 /*meters*/, M_PI / 8 /*rads*/, 3.0 /*seconds*/, 0.05 /*seconds*/,
735 trajectory);
736
737 // check plan rejection
738 bool acceptedLocalTrajectoryFreeOfObstacles = true;
739
740 unsigned int mx = 0, my = 0;
741
743 {
744 if (backwardsPlanPath_.size() > 0)
745 {
746 const auto & finalgoalpose = backwardsPlanPath_.back();
747
748 int i = 0;
749 // RCLCPP_INFO_STREAM(nh_->get_logger(), "lplanner goal: " << finalgoalpose.pose.position);
750 geometry_msgs::msg::Twist mockzerospeed;
751
752 for (auto & p : trajectory)
753 {
754 float goaldx = p[0] - finalgoalpose.pose.position.x;
755 float goaldy = p[1] - finalgoalpose.pose.position.y;
756
757 float dst = sqrt(goaldx * goaldx + goaldy * goaldy);
758 if (dst < xy_goal_tolerance_)
759 {
760 RCLCPP_INFO(
761 nh_->get_logger(),
762 "[BackwardLocalPlanner] trajectory simulation for collision checking: goal "
763 "reached with no collision");
764 break;
765 }
766
767 costmap2d->worldToMap(p[0], p[1], mx, my);
768
769 if (costmap2d->getCost(mx, my) >= nav2_costmap_2d::INSCRIBED_INFLATED_OBSTACLE)
770 {
771 acceptedLocalTrajectoryFreeOfObstacles = false;
772 RCLCPP_WARN_STREAM(
773 nh_->get_logger(),
774 "[BackwardLocalPlanner] ABORTED LOCAL PLAN BECAUSE OBSTACLE DETEDTED at point "
775 << i << "/" << trajectory.size() << '\n'
776 << p[0] << ", " << p[1]);
777 break;
778 }
779 i++;
780 }
781 }
782 else
783 {
784 RCLCPP_WARN(
785 nh_->get_logger(), "[BackwardLocalPlanner] Abort local - Backwards global plan size: %ld",
786 backwardsPlanPath_.size());
787 cmd_vel.twist.angular.z = 0;
788 cmd_vel.twist.linear.x = 0;
789 }
790 }
791
792 if (acceptedLocalTrajectoryFreeOfObstacles)
793 {
794 waiting_ = false;
795 RCLCPP_INFO(
796 nh_->get_logger(),
797 "[BackwardLocalPlanner] accepted local trajectory free of obstacle. Local planner "
798 "continues.");
799 return cmd_vel;
800 }
801 else // that is not appceted because existence of obstacles
802 {
803 // emergency stop for collision: waiting a while before sending error
804 cmd_vel.twist.linear.x = 0;
805 cmd_vel.twist.angular.z = 0;
806
807 if (waiting_ == false)
808 {
809 waiting_ = true;
810 waitingStamp_ = nh_->now();
811 RCLCPP_WARN(
812 nh_->get_logger(), "[BackwardLocalPlanner][Not accepted local plan] starting countdown");
813 }
814 else
815 {
816 auto waitingduration = nh_->now() - waitingStamp_;
817
818 if (waitingduration > this->waitingTimeout_)
819 {
820 RCLCPP_WARN(
821 nh_->get_logger(), "[BackwardLocalPlanner][Abort local] timeout! duration %lf/%f",
822 waitingduration.seconds(), waitingTimeout_.seconds());
823 cmd_vel.twist.linear.x = 0;
824 cmd_vel.twist.angular.z = 0;
825 return cmd_vel;
826 }
827 }
828
829 return cmd_vel;
830 }
831}
832
839{
840 RCLCPP_INFO(nh_->get_logger(), "[BackwardLocalPlanner] isGoalReached call");
841 return goalReached_;
842}
843
844bool BackwardLocalPlanner::findInitialCarrotGoal(geometry_msgs::msg::PoseStamped & tfpose)
845{
846 double lineardisterr = 0.0, angleerr = 0.0;
847 bool inCarrotRange = false;
848
849 // initial state check
850 computeCurrentEuclideanAndAngularErrorsToCarrotGoal(tfpose, lineardisterr, angleerr);
851
852 // lets set the carrot-goal in the correct place with this loop: advance through the
853 // contiguous in-range poses and stop at the last one before leaving the carrot range
854 while (currentCarrotPoseIndex_ < (int)backwardsPlanPath_.size())
855 {
856 computeCurrentEuclideanAndAngularErrorsToCarrotGoal(tfpose, lineardisterr, angleerr);
857
858 RCLCPP_INFO(
859 nh_->get_logger(),
860 "[BackwardLocalPlanner] Finding initial carrot goal i=%d - error to carrot, linear = %lf "
861 "(%lf), "
862 "angular : %lf (%lf)",
864
865 // current path point is inside the carrot distance range, goal carrot tries to escape!
866 if (lineardisterr < carrot_distance_ && angleerr < carrot_angular_distance_)
867 {
868 RCLCPP_INFO(
869 nh_->get_logger(),
870 "[BackwardLocalPlanner] Finding initial carrot goal i=%d - in carrot Range",
872 inCarrotRange = true;
873 // we are inside the goal range, keep advancing to find the last in-range pose
874 }
875 else if (inCarrotRange)
876 {
877 // we were inside the carrot range but not anymore, now we are just leaving.
878 // rollback last index increment (to go back inside the carrot goal scope) and
879 // start motion with that carrot goal we found
881 break;
882 }
883 else
884 {
885 RCLCPP_INFO(
886 nh_->get_logger(),
887 "[BackwardLocalPlanner] Finding initial carrot goal i=%d - carrot out of range, searching "
888 "coincidence...",
890 }
891
893 RCLCPP_INFO_STREAM(
894 nh_->get_logger(), "[BackwardLocalPlanner] setPlan: fw" << currentCarrotPoseIndex_);
895 }
896
897 // the whole remaining path was in range: the carrot is the final pose
899 {
901 }
902
903 RCLCPP_INFO_STREAM(
904 nh_->get_logger(), "[BackwardLocalPlanner] setPlan: (found first carrot:"
905 << inCarrotRange << ") initial carrot point index: "
906 << currentCarrotPoseIndex_ << "/" << backwardsPlanPath_.size());
907
908 return inCarrotRange;
909}
910
912{
913 // this algorithm is really important to have a precise carrot (linear or angular)
914 // and not being considered as a divergence from the path
915
916 RCLCPP_INFO(nh_->get_logger(), "[BackwardLocalPlanner] resample precise");
917 if (backwardsPlanPath_.size() <= 1)
918 {
919 RCLCPP_INFO_STREAM(
920 nh_->get_logger(),
921 "[BackwardLocalPlanner] resample precise skipping, size: " << backwardsPlanPath_.size());
922 return false;
923 }
924
925 int counter = 0;
926 double maxallowedAngularError = 0.45 * this->carrot_angular_distance_; // nyquist
927 double maxallowedLinearError = 0.45 * this->carrot_distance_; // nyquist
928
929 // the bisection below only terminates for positive tolerances
930 if (maxallowedLinearError <= 0.0 || maxallowedAngularError <= 0.0)
931 {
932 RCLCPP_WARN_STREAM(
933 nh_->get_logger(), "[BackwardLocalPlanner] resample precise skipping: carrot_distance ("
934 << carrot_distance_ << ") and carrot_angular_distance ("
935 << carrot_angular_distance_ << ") must both be positive");
936 return false;
937 }
938
939 // Each segment is bisected until both its linear and angular extent fit the
940 // tolerances: an insert re-examines the same index against the new midpoint.
941 int i = 0;
942 while (i < (int)backwardsPlanPath_.size() - 1)
943 {
944 RCLCPP_INFO_STREAM(nh_->get_logger(), "[BackwardLocalPlanner] resample precise, check: " << i);
945 auto & currpose = backwardsPlanPath_[i];
946 auto & nextpose = backwardsPlanPath_[i + 1];
947
948 tf2::Quaternion qCurrent, qNext;
949 tf2::convert(currpose.pose.orientation, qCurrent);
950 tf2::convert(nextpose.pose.orientation, qNext);
951
952 double dx = nextpose.pose.position.x - currpose.pose.position.x;
953 double dy = nextpose.pose.position.y - currpose.pose.position.y;
954 double dist = sqrt(dx * dx + dy * dy);
955
956 bool resample = false;
957 if (dist > maxallowedLinearError)
958 {
959 RCLCPP_INFO_STREAM(
960 nh_->get_logger(), "[BackwardLocalPlanner] resampling point, linear distance:"
961 << dist << "(" << maxallowedLinearError << ")" << i);
962 resample = true;
963 }
964 else
965 {
966 double currentAngle = tf2::getYaw(qCurrent);
967 double nextAngle = tf2::getYaw(qNext);
968
969 double angularError = fabs(angles::shortest_angular_distance(currentAngle, nextAngle));
970 if (angularError > maxallowedAngularError)
971 {
972 resample = true;
973 RCLCPP_INFO_STREAM(
974 nh_->get_logger(), "[BackwardLocalPlanner] resampling point, angular distance:"
975 << angularError << "(" << maxallowedAngularError << ")" << i);
976 }
977 }
978
979 if (resample)
980 {
981 geometry_msgs::msg::PoseStamped pintermediate;
982 auto duration = rclcpp::Time(nextpose.header.stamp) - rclcpp::Time(currpose.header.stamp);
983
984 pintermediate.header.frame_id = currpose.header.frame_id;
985 pintermediate.header.stamp = rclcpp::Time(currpose.header.stamp) + duration * 0.5;
986
987 pintermediate.pose.position.x = 0.5 * (currpose.pose.position.x + nextpose.pose.position.x);
988 pintermediate.pose.position.y = 0.5 * (currpose.pose.position.y + nextpose.pose.position.y);
989 pintermediate.pose.position.z = 0.5 * (currpose.pose.position.z + nextpose.pose.position.z);
990 tf2::Quaternion intermediateQuat = tf2::slerp(qCurrent, qNext, 0.5);
991 pintermediate.pose.orientation = tf2::toMsg(intermediateQuat);
992
993 // currpose / nextpose are references into the vector: not used past this insert
994 this->backwardsPlanPath_.insert(this->backwardsPlanPath_.begin() + i + 1, pintermediate);
995 counter++;
996 continue; // retry this point against the inserted midpoint
997 }
998
999 i++;
1000 }
1001
1002 RCLCPP_INFO_STREAM(
1003 nh_->get_logger(), "[BackwardLocalPlanner] End resampling. resampled:" << counter
1004 << " new inserted poses "
1005 "during precise "
1006 "resmapling.");
1007 return true;
1008}
1009
1015void BackwardLocalPlanner::setPlan(const nav_msgs::msg::Path & path)
1016{
1017 RCLCPP_INFO_STREAM(
1018 nh_->get_logger(),
1019 "[BackwardLocalPlanner] setPlan: new global plan received ( " << path.poses.size() << ")");
1020
1021 //------------- TRANSFORM TO LOCAL FRAME PATH ---------------------------
1022 nav_msgs::msg::Path transformedPlan;
1023 rclcpp::Duration ttol = rclcpp::Duration::from_seconds(transform_tolerance_);
1024 // transform global plan to the navigation reference frame
1025 for (auto & p : path.poses)
1026 {
1027 geometry_msgs::msg::PoseStamped transformedPose;
1028 nav_2d_utils::transformPose(tf_, costmapRos_->getGlobalFrameID(), p, transformedPose, ttol);
1029 transformedPose.header.frame_id = costmapRos_->getGlobalFrameID();
1030 transformedPlan.poses.push_back(transformedPose);
1031 }
1032
1033 backwardsPlanPath_ = transformedPlan.poses;
1034
1035 // --------- resampling path feature -----------
1036 geometry_msgs::msg::PoseStamped tfpose;
1037 if (!costmapRos_->getRobotPose(tfpose))
1038 {
1039 RCLCPP_ERROR(nh_->get_logger(), "Failure getting pose from Backward local planner");
1040 return;
1041 }
1042
1043 geometry_msgs::msg::PoseStamped posestamped = tfpose;
1044 backwardsPlanPath_.insert(backwardsPlanPath_.begin(), posestamped);
1045 this->resamplePrecisePlan();
1046
1047 nav_msgs::msg::Path planMsg;
1048 planMsg.poses = backwardsPlanPath_;
1049 planMsg.header.frame_id = costmapRos_->getGlobalFrameID();
1050 planMsg.header.stamp = nh_->now();
1051 planPub_->publish(planMsg);
1052
1053 // ------ reset controller state ----------------------
1054 goalReached_ = false;
1057 // re-read the tolerances from the goal checker on the next control cycle: the selected
1058 // goal checker may have changed since the previous navigation (goal_checker_selector)
1059 xy_goal_tolerance_ = -1;
1062
1063 if (path.poses.size() == 0)
1064 {
1065 RCLCPP_INFO_STREAM(nh_->get_logger(), "[BackwardLocalPlanner] received plan without any pose");
1066 return;
1067 }
1068
1069 // -------- initialize carrot ----------------
1070 bool foundInitialCarrotGoal = this->findInitialCarrotGoal(tfpose);
1071 if (!foundInitialCarrotGoal)
1072 {
1073 RCLCPP_ERROR(
1074 nh_->get_logger(),
1075 "[BackwardLocalPlanner] new plan rejected. The initial point in the global path is "
1076 "too much far away from the current state (according to carrot_distance "
1077 "parameter)");
1078 // return false; // in this case, the new plan broke the current execution
1079 return;
1080 }
1081 else
1082 {
1083 this->divergenceDetectionUpdate(tfpose);
1084 return;
1085 }
1086}
1087
1089 const Eigen::Vector3f & pos, const Eigen::Vector3f & vel, float maxdist, float maxanglediff,
1090 float maxtime, float dt, std::vector<Eigen::Vector3f> & outtraj)
1091{
1092 // simulate the trajectory and check for collisions, updating costs along the way
1093 bool end = false;
1094 float time = 0;
1095 Eigen::Vector3f currentpos = pos;
1096 while (!end)
1097 {
1098 auto loop_vel = vel;
1099 // update the position of the robot using the velocities passed in
1100 auto newpos = computeNewPositions(currentpos, loop_vel, dt);
1101
1102 auto dx = newpos[0] - currentpos[0];
1103 auto dy = newpos[1] - currentpos[1];
1104 float dist = 0.0;
1105
1106 // RCLCPP_INFO(nh_->get_logger(), "traj point %d", i);
1107 dist = sqrt(dx * dx + dy * dy);
1108 if (dist > maxdist)
1109 {
1110 end = true;
1111 // RCLCPP_INFO(nh_->get_logger(), "dist break: %f", dist);
1112 }
1113 else
1114 {
1115 // ouble from, double to
1116 float angledist = angles::shortest_angular_distance(currentpos[2], newpos[2]);
1117 if (angledist > maxanglediff)
1118 {
1119 end = true;
1120 // RCLCPP_INFO(nh_->get_logger(), "angle dist break: %f", angledist);
1121 }
1122 else
1123 {
1124 outtraj.push_back(newpos);
1125
1126 time += dt;
1127 if (time > maxtime)
1128 {
1129 end = true;
1130 // RCLCPP_INFO(nh_->get_logger(), "time break: %f", time);
1131 }
1132
1133 // RCLCPP_INFO(nh_->get_logger(), "dist: %f, angledist: %f, time: %f", dist, angledist, time);
1134 }
1135 }
1136
1137 currentpos = newpos;
1138 } // end for simulation steps
1139}
1140
1142 const Eigen::Vector3f & pos, const Eigen::Vector3f & vel, double dt)
1143{
1144 Eigen::Vector3f new_pos = Eigen::Vector3f::Zero();
1145 new_pos[0] = pos[0] + (static_cast<double>(vel[0]) * cos(pos[2]) +
1146 static_cast<double>(vel[1]) * cos(M_PI_2 + pos[2])) *
1147 dt;
1148 new_pos[1] = pos[1] + (static_cast<double>(vel[0]) * sin(pos[2]) +
1149 static_cast<double>(vel[1]) * sin(M_PI_2 + pos[2])) *
1150 dt;
1151 new_pos[2] = pos[2] + vel[2] * dt;
1152 return new_pos;
1153}
1154
1156{
1157 visualization_msgs::msg::Marker marker;
1158 marker.header.frame_id = this->costmapRos_->getGlobalFrameID();
1159 marker.header.stamp = nh_->now();
1160
1161 marker.ns = "my_namespace2";
1162 marker.id = 0;
1163 marker.type = visualization_msgs::msg::Marker::ARROW;
1164 marker.action = visualization_msgs::msg::Marker::DELETEALL;
1165
1166 visualization_msgs::msg::MarkerArray ma;
1167 ma.markers.push_back(marker);
1168
1169 goalMarkerPublisher_->publish(ma);
1170}
1171
1177void BackwardLocalPlanner::publishGoalMarker(double x, double y, double phi)
1178{
1179 visualization_msgs::msg::Marker marker;
1180 marker.header.frame_id = this->costmapRos_->getGlobalFrameID();
1181 marker.header.stamp = nh_->now();
1182
1183 marker.ns = "my_namespace2";
1184 marker.id = 0;
1185 marker.type = visualization_msgs::msg::Marker::ARROW;
1186 marker.action = visualization_msgs::msg::Marker::ADD;
1187 marker.lifetime = rclcpp::Duration(1.0s);
1188
1189 marker.pose.orientation.w = 1;
1190
1191 marker.scale.x = 0.05;
1192 marker.scale.y = 0.15;
1193 marker.scale.z = 0.05;
1194 marker.color.a = 1.0;
1195
1196 // red marker
1197 marker.color.r = 1;
1198 marker.color.g = 0;
1199 marker.color.b = 0;
1200
1201 geometry_msgs::msg::Point start, end;
1202 start.x = x;
1203 start.y = y;
1204
1205 end.x = x + 0.5 * cos(phi);
1206 end.y = y + 0.5 * sin(phi);
1207
1208 marker.points.push_back(start);
1209 marker.points.push_back(end);
1210
1211 visualization_msgs::msg::MarkerArray ma;
1212 ma.markers.push_back(marker);
1213
1214 goalMarkerPublisher_->publish(ma);
1215}
1216} // namespace backward_local_planner
1217} // namespace cl_nav2z
bool updateCarrotGoal(const geometry_msgs::msg::PoseStamped &pose)
bool checkCarrotHalfPlainConstraint(const geometry_msgs::msg::PoseStamped &pose)
Eigen::Vector3f computeNewPositions(const Eigen::Vector3f &pos, const Eigen::Vector3f &vel, double dt)
geometry_msgs::msg::TwistStamped computeVelocityCommands(const geometry_msgs::msg::PoseStamped &pose, const geometry_msgs::msg::Twist &velocity, nav2_core::GoalChecker *goal_checker) override
nav2_core computeVelocityCommands - calculates the best command given the current pose and velocity
void straightBackwardsAndPureSpinCmd(const geometry_msgs::msg::PoseStamped &pose, double &vetta, double &gamma, double alpha_error, double betta_error, double rho_error)
std::vector< geometry_msgs::msg::PoseStamped > backwardsPlanPath_
void generateTrajectory(const Eigen::Vector3f &pos, const Eigen::Vector3f &vel, float maxdist, float maxangle, float maxtime, float dt, std::vector< Eigen::Vector3f > &outtraj)
std::shared_ptr< rclcpp_lifecycle::LifecyclePublisher< visualization_msgs::msg::MarkerArray > > goalMarkerPublisher_
bool findInitialCarrotGoal(geometry_msgs::msg::PoseStamped &pose)
bool divergenceDetectionUpdate(const geometry_msgs::msg::PoseStamped &pose)
void setPlan(const nav_msgs::msg::Path &path) override
nav2_core setPlan - Sets the global plan
void computeCurrentEuclideanAndAngularErrorsToCarrotGoal(const geometry_msgs::msg::PoseStamped &pose, double &dist, double &angular_error)
bool checkCurrentPoseInGoalRange(const geometry_msgs::msg::PoseStamped &tfpose, const geometry_msgs::msg::Twist &currentTwist, double angle_error, bool &linearGoalReached, nav2_core::GoalChecker *goalChecker)
std::shared_ptr< rclcpp_lifecycle::LifecyclePublisher< nav_msgs::msg::Path > > planPub_
void configure(const rclcpp_lifecycle::LifecycleNode::WeakPtr &parent, std::string name, const std::shared_ptr< tf2_ros::Buffer > tf, const std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros) override
void setSpeedLimit(const double &speed_limit, const bool &percentage) override
std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmapRos_
void declareOrSet(rclcpp_lifecycle::LifecycleNode::SharedPtr &node, std::string param, T &value)
Definition common.hpp:34
void tryGetOrSet(rclcpp_lifecycle::LifecycleNode::SharedPtr &node, std::string param, T &value)