SMACC2
Loading...
Searching...
No Matches
forward_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 ******************************************************************************************************************/
21
22#include <angles/angles.h>
23#include <geometry_msgs/msg/pose_stamped.hpp>
24#include <geometry_msgs/msg/twist.hpp>
25#include <rclcpp/rclcpp.hpp>
26#include <visualization_msgs/msg/marker_array.hpp>
27
28#include <boost/intrusive_ptr.hpp>
29#include <nav_2d_utils/tf_help.hpp>
30#include <pluginlib/class_list_macros.hpp>
31
32using namespace std::chrono_literals;
33namespace cl_nav2z
34{
35namespace forward_local_planner
36{
42ForwardLocalPlanner::ForwardLocalPlanner() : transform_tolerance_(0.1), waitingTimeout_(2s) {}
43
45
47{
48 RCLCPP_DEBUG_STREAM(nh_->get_logger(), "activating controller ForwardLocalPlanner");
49 this->updateParameters();
50 this->goalMarkerPublisher_->on_activate();
51}
52
54{
55 this->cleanMarkers();
56 this->goalMarkerPublisher_->on_deactivate();
57}
58
60{
61 this->cleanMarkers();
62 this->plan_.clear();
63 this->currentPoseIndex_ = 0;
66}
67
69 const rclcpp_lifecycle::LifecycleNode::WeakPtr & node, std::string name,
70 const std::shared_ptr<tf2_ros::Buffer> tf,
71 const std::shared_ptr<nav2_costmap_2d::Costmap2DROS> costmap_ros)
72{
73 nh_ = node.lock();
74 costmapRos_ = costmap_ros;
75 tf_ = tf;
76 name_ = name;
77 k_rho_ = 1.0;
78 k_alpha_ = -0.4;
79 k_betta_ = -1.0; // set to zero means that orientation is not important
80
81 goalReached_ = false;
82 carrot_distance_ = 0.4;
87
89
90 declareOrSet(nh_, name_ + ".k_rho", k_rho_);
91 declareOrSet(nh_, name_ + ".k_alpha", k_alpha_);
92 declareOrSet(nh_, name_ + ".k_betta", k_betta_);
93 declareOrSet(nh_, name_ + ".carrot_distance", carrot_distance_);
94 declareOrSet(nh_, name_ + ".yaw_goal_tolerance", yaw_goal_tolerance_);
95 declareOrSet(nh_, name_ + ".xy_goal_tolerance", xy_goal_tolerance_);
96 declareOrSet(nh_, name_ + ".max_linear_x_speed", max_linear_x_speed_);
97 declareOrSet(nh_, name_ + ".max_angular_z_speed", max_angular_z_speed_);
98 declareOrSet(nh_, name_ + ".transform_tolerance", transform_tolerance_);
99
100 RCLCPP_DEBUG(
101 nh_->get_logger(),
102 "[ForwardLocalPlanner] max linear speed: %lf, max angular speed: %lf, k_rho: %lf, "
103 "carrot_distance: "
104 "%lf, ",
106 goalMarkerPublisher_ = nh_->create_publisher<visualization_msgs::msg::MarkerArray>(
107 "forward_local_planner/carrot_goal_marker", rclcpp::QoS(1));
108
109 waiting_ = false;
110 waitingTimeout_ = rclcpp::Duration(10s);
111}
112
114{
115 nh_->get_parameter(name_ + ".k_rho", k_rho_);
116 nh_->get_parameter(name_ + ".k_alpha", k_alpha_);
117 nh_->get_parameter(name_ + ".k_betta", k_betta_);
118 nh_->get_parameter(name_ + ".carrot_distance", carrot_distance_);
119 nh_->get_parameter(name_ + ".yaw_goal_tolerance", yaw_goal_tolerance_);
120 nh_->get_parameter(name_ + ".xy_goal_tolerance", xy_goal_tolerance_);
121 nh_->get_parameter(name_ + ".max_linear_x_speed", max_linear_x_speed_);
122 nh_->get_parameter(name_ + ".max_angular_z_speed", max_angular_z_speed_);
123 nh_->get_parameter(name_ + ".transform_tolerance", transform_tolerance_);
124
125 RCLCPP_INFO_STREAM(nh_->get_logger(), "[ForwardLocalPlanner.k_rho: " << k_rho_);
126 RCLCPP_INFO_STREAM(nh_->get_logger(), "[ForwardLocalPlanner.k_alpha: " << k_alpha_);
127 RCLCPP_INFO_STREAM(nh_->get_logger(), "[ForwardLocalPlanner.k_betta: " << k_betta_);
128 RCLCPP_INFO_STREAM(
129 nh_->get_logger(), "[ForwardLocalPlanner.carrot_distance: " << carrot_distance_);
130 RCLCPP_INFO_STREAM(
131 nh_->get_logger(), "[ForwardLocalPlanner.yaw_goal_tolerance:" << yaw_goal_tolerance_);
132 RCLCPP_INFO_STREAM(
133 nh_->get_logger(), "[ForwardLocalPlanner.xy_goal_tolerance: " << xy_goal_tolerance_);
134 RCLCPP_INFO_STREAM(
135 nh_->get_logger(), "[ForwardLocalPlanner.max_linear_x_speed:" << max_linear_x_speed_);
136 RCLCPP_INFO_STREAM(
137 nh_->get_logger(), "[ForwardLocalPlanner.max_angular_z_speed:" << max_angular_z_speed_);
138 RCLCPP_INFO_STREAM(
139 nh_->get_logger(), "[ForwardLocalPlanner.transform_tolerance:" << transform_tolerance_);
140}
141
143 const Eigen::Vector3f & pos, const Eigen::Vector3f & vel, float maxdist, float maxanglediff,
144 float maxtime, float dt, std::vector<Eigen::Vector3f> & outtraj)
145{
146 // simulate the trajectory and check for collisions, updating costs along the way
147 bool end = false;
148 float time = 0;
149 Eigen::Vector3f currentpos = pos;
150 while (!end)
151 {
152 // add the point to the trajectory so we can draw it later if we want
153 // traj.addPoint(pos[0], pos[1], pos[2]);
154
155 auto loop_vel = vel;
156 // update the position of the robot using the velocities passed in
157 auto newpos = computeNewPositions(currentpos, loop_vel, dt);
158
159 auto dx = newpos[0] - currentpos[0];
160 auto dy = newpos[1] - currentpos[1];
161 float dist = 0.0;
162
163 // RCLCPP_DEBUG(nh_->get_logger(), "traj point %d", i);
164 dist = sqrt(dx * dx + dy * dy);
165 if (dist > maxdist)
166 {
167 end = true;
168 // RCLCPP_DEBUG(nh_->get_logger(), "dist break: %f", dist);
169 }
170 else
171 {
172 // ouble from, double to
173 float angledist = fabs(angles::shortest_angular_distance(currentpos[2], newpos[2]));
174 if (angledist > maxanglediff)
175 {
176 end = true;
177 // RCLCPP_DEBUG(nh_->get_logger(), "angle dist break: %f", angledist);
178 }
179 else
180 {
181 outtraj.push_back(newpos);
182
183 time += dt;
184 if (time > maxtime)
185 {
186 end = true;
187 // RCLCPP_DEBUG(nh_->get_logger(), "time break: %f", time);
188 }
189
190 // RCLCPP_DEBUG(nh_->get_logger(), "dist: %f, angledist: %f, time: %f", dist, angledist, time);
191 }
192 }
193
194 currentpos = newpos;
195 } // end for simulation steps
196}
197
199 const Eigen::Vector3f & pos, const Eigen::Vector3f & vel, double dt)
200{
201 Eigen::Vector3f new_pos = Eigen::Vector3f::Zero();
202 new_pos[0] = pos[0] + (static_cast<double>(vel[0]) * cos(pos[2]) +
203 static_cast<double>(vel[1]) * cos(M_PI_2 + pos[2])) *
204 dt;
205 new_pos[1] = pos[1] + (static_cast<double>(vel[0]) * sin(pos[2]) +
206 static_cast<double>(vel[1]) * sin(M_PI_2 + pos[2])) *
207 dt;
208 new_pos[2] = pos[2] + vel[2] * dt;
209 return new_pos;
210}
211
217void ForwardLocalPlanner::publishGoalMarker(double x, double y, double phi)
218{
219 visualization_msgs::msg::Marker marker;
220
221 marker.header.frame_id = costmapRos_->getGlobalFrameID();
222 marker.header.stamp = nh_->now();
223 marker.ns = "my_namespace2";
224 marker.id = 0;
225 marker.type = visualization_msgs::msg::Marker::ARROW;
226 marker.action = visualization_msgs::msg::Marker::ADD;
227 marker.pose.orientation.w = 1;
228 marker.lifetime = rclcpp::Duration(1.0s);
229
230 marker.scale.x = 0.1;
231 marker.scale.y = 0.3;
232 marker.scale.z = 0.1;
233 marker.color.a = 1.0;
234 marker.color.r = 0;
235 marker.color.g = 0;
236 marker.color.b = 1.0;
237
238 geometry_msgs::msg::Point start, end;
239 start.x = x;
240 start.y = y;
241
242 end.x = x + 0.5 * cos(phi);
243 end.y = y + 0.5 * sin(phi);
244
245 marker.points.push_back(start);
246 marker.points.push_back(end);
247
248 visualization_msgs::msg::MarkerArray ma;
249 ma.markers.push_back(marker);
250
251 goalMarkerPublisher_->publish(ma);
252}
253
255{
256 RCLCPP_INFO_STREAM(nh_->get_logger(), "[ForwardLocalPlanner] cleaning markers.");
257 visualization_msgs::msg::Marker marker;
258
259 marker.header.frame_id = costmapRos_->getGlobalFrameID();
260 marker.header.stamp = nh_->now();
261 marker.ns = "my_namespace2";
262 marker.id = 0;
263 marker.action = visualization_msgs::msg::Marker::DELETEALL;
264
265 visualization_msgs::msg::MarkerArray ma;
266 ma.markers.push_back(marker);
267
268 goalMarkerPublisher_->publish(ma);
269}
270
271void clamp(
272 rclcpp::Node::SharedPtr nh_, geometry_msgs::msg::Twist & cmd_vel, double max_linear_x_speed_,
273 double max_angular_z_speed_)
274{
275 if (max_angular_z_speed_ == 0 || max_linear_x_speed_ == 0) return;
276
277 if (cmd_vel.angular.z == 0)
278 {
279 cmd_vel.linear.x = max_linear_x_speed_;
280 }
281 else
282 {
283 double kurvature = cmd_vel.linear.x / cmd_vel.angular.z;
284
285 double linearAuthority = fabs(cmd_vel.linear.x / max_linear_x_speed_);
286 double angularAuthority = fabs(cmd_vel.angular.z / max_angular_z_speed_);
287 if (linearAuthority < angularAuthority)
288 {
289 // lets go to maximum linear speed
290 cmd_vel.linear.x = max_linear_x_speed_;
291 cmd_vel.angular.z = kurvature / max_linear_x_speed_;
292 RCLCPP_WARN_STREAM(
293 nh_->get_logger(), "k=" << kurvature << "lets go to maximum linear capacity: " << cmd_vel);
294 }
295 else
296 {
297 // lets go with maximum angular speed
298 cmd_vel.angular.x = max_angular_z_speed_;
299 cmd_vel.linear.x = kurvature * max_angular_z_speed_;
300 RCLCPP_WARN_STREAM(nh_->get_logger(), "lets go to maximum angular capacity: " << cmd_vel);
301 }
302 }
303}
304
311geometry_msgs::msg::TwistStamped ForwardLocalPlanner::computeVelocityCommands(
312 const geometry_msgs::msg::PoseStamped & currentPose,
313 const geometry_msgs::msg::Twist & /*velocity*/, nav2_core::GoalChecker * goal_checker)
314{
315 this->updateParameters();
316
317 if (this->plan_.size() > 0)
318 {
319 RCLCPP_INFO_STREAM(
320 nh_->get_logger(), "[ForwardLocalPlanner] Current pose frame id: "
321 << plan_.front().header.frame_id
322 << ", path pose frame id: " << currentPose.header.frame_id);
323
324 if (plan_.front().header.frame_id != currentPose.header.frame_id)
325 {
326 RCLCPP_ERROR_STREAM(nh_->get_logger(), "[ForwardLocalPlanner] Inconsistent frames");
327 }
328 }
329
330 // xy_goal_tolerance and yaw_goal_tolerance are just used for logging proposes and clamping the carrot
331 // goal distance (parameter safety)
332 if (xy_goal_tolerance_ == -1 || yaw_goal_tolerance_ == -1)
333 {
334 geometry_msgs::msg::Pose posetol;
335 geometry_msgs::msg::Twist twistol;
336 if (goal_checker->getTolerances(posetol, twistol))
337 {
338 xy_goal_tolerance_ = posetol.position.x;
339 yaw_goal_tolerance_ = tf2::getYaw(posetol.orientation);
340 //xy_goal_tolerance_ = posetol.position.x * 0.35; // WORKAROUND DIFFERENCE WITH NAV CONTROLLER GOAL CHECKER
341 //yaw_goal_tolerance_ = tf2::getYaw(posetol.orientation) * 0.35;
342 RCLCPP_INFO_STREAM(
343 nh_->get_logger(), "[ForwardLocalPlanner] xy_goal_tolerance_: " << xy_goal_tolerance_
344 << ", yaw_goal_tolerance_: "
346 }
347 else
348 {
349 RCLCPP_INFO_STREAM(
350 nh_->get_logger(), "[ForwardLocalPlanner] could not get tolerances from goal checker");
351 }
352 }
353
354 geometry_msgs::msg::TwistStamped cmd_vel;
355 goalReached_ = false;
356 RCLCPP_DEBUG(
357 nh_->get_logger(), "[ForwardLocalPlanner] ----- COMPUTE VELOCITY COMMAND LOCAL PLANNER ---");
358
359 bool ok = false;
360 while (!ok)
361 {
362 // iterate the point from the current position and ahead until reaching a new goal point in the path
363 while (!ok && currentPoseIndex_ < (int)plan_.size())
364 {
365 auto & pose = plan_[currentPoseIndex_];
366 const geometry_msgs::msg::Point & p = pose.pose.position;
367 tf2::Quaternion q;
368 tf2::fromMsg(pose.pose.orientation, q);
369
370 // take error from the current position to the path point
371 double dx = p.x - currentPose.pose.position.x;
372 double dy = p.y - currentPose.pose.position.y;
373 double dist = sqrt(dx * dx + dy * dy);
374
375 double pangle = tf2::getYaw(q);
376 double angle = tf2::getYaw(currentPose.pose.orientation);
377 double angular_error = angles::shortest_angular_distance(pangle, angle);
378
379 if (dist >= carrot_distance_ || fabs(angular_error) > 0.1)
380 {
381 // the target pose is enough different to be defined as a target
382 ok = true;
383 RCLCPP_DEBUG(
384 nh_->get_logger(),
385 "current index: %d, carrot goal percentaje: %lf, dist: %lf, maxdist: %lf, angle_error: "
386 "%lf",
388 angular_error);
389 }
390 else
391 {
393 }
394 }
395
396 RCLCPP_DEBUG_STREAM(
397 nh_->get_logger(), "[ForwardLocalPlanner] selected carrot pose index "
398 << currentPoseIndex_ << "/" << plan_.size());
399
400 if (currentPoseIndex_ >= (int)plan_.size())
401 {
402 // even the latest point is quite similar, then take the last since it is the final goal
403 cmd_vel.twist.linear.x = 0;
404 cmd_vel.twist.angular.z = 0;
405 // RCLCPP_INFO(nh_->get_logger(), "End Local planner");
406 ok = true;
407 currentPoseIndex_ = (int)plan_.size() - 1;
408 }
409 }
410
411 // RCLCPP_INFO(nh_->get_logger(), "pose control algorithm");
412
413 const geometry_msgs::msg::PoseStamped & finalgoalpose = plan_.back();
414 const geometry_msgs::msg::PoseStamped & carrot_goalpose = plan_[currentPoseIndex_];
415 const geometry_msgs::msg::Point & goalposition = carrot_goalpose.pose.position;
416
417 tf2::Quaternion carrotGoalQ;
418 tf2::fromMsg(carrot_goalpose.pose.orientation, carrotGoalQ);
419 // RCLCPP_INFO_STREAM(nh_->get_logger(), "Plan goal quaternion at "<< carrot_goalpose.pose.orientation);
420
421 // goal orientation (global frame)
422 double betta = tf2::getYaw(carrot_goalpose.pose.orientation) + betta_offset_;
423 double dx = goalposition.x - currentPose.pose.position.x;
424 double dy = goalposition.y - currentPose.pose.position.y;
425
426 // distance error to the targetpoint
427 double rho_error = sqrt(dx * dx + dy * dy);
428
429 tf2::Quaternion currentOrientation;
430 tf2::convert(currentPose.pose.orientation, currentOrientation);
431
432 // current angle
433 double theta = tf2::getYaw(currentOrientation);
434 double alpha = atan2(dy, dx);
435 alpha = alpha + alpha_offset_;
436
437 double alpha_error = angles::shortest_angular_distance(alpha, theta);
438 double betta_error = angles::shortest_angular_distance(betta, theta);
439
440 double vetta = 0;
441 double gamma = 0;
442
443 if (
444 rho_error >
445 xy_goal_tolerance_) // regular control rule, be careful, rho error is with the carrot not with the
446 // final goal (this is something to improve like the backwards planner)
447 {
448 vetta = k_rho_ * rho_error;
449 gamma = k_alpha_ * alpha_error;
450 }
451 else if (fabs(betta_error) >= yaw_goal_tolerance_) // pureSpining
452 {
453 vetta = 0;
454 gamma = k_betta_ * betta_error;
455 }
456 else // goal reached
457 {
458 RCLCPP_DEBUG(nh_->get_logger(), "GOAL REACHED");
459 vetta = 0;
460 gamma = 0;
461 goalReached_ = true;
462 }
463
464 // linear speed clamp
465 if (vetta > max_linear_x_speed_)
466 {
467 vetta = max_linear_x_speed_;
468 }
469 else if (vetta < -max_linear_x_speed_)
470 {
471 vetta = -max_linear_x_speed_;
472 }
473
474 // angular speed clamp
475 if (gamma > max_angular_z_speed_)
476 {
477 gamma = max_angular_z_speed_;
478 }
479 else if (gamma < -max_angular_z_speed_)
480 {
481 gamma = -max_angular_z_speed_;
482 }
483
484 cmd_vel.twist.linear.x = vetta;
485 cmd_vel.twist.angular.z = gamma;
486
487 publishGoalMarker(goalposition.x, goalposition.y, betta);
488
489 RCLCPP_DEBUG_STREAM(
490 nh_->get_logger(), "Forward local planner,"
491 << '\n'
492 << " theta: " << theta << '\n'
493 << " betta: " << betta << '\n'
494 << " err_x: " << dx << '\n'
495 << " err_y:" << dy << '\n'
496 << " rho_error:" << rho_error << '\n'
497 << " alpha_error:" << alpha_error << '\n'
498 << " betta_error:" << betta_error << '\n'
499 << " vetta:" << vetta << '\n'
500 << " gamma:" << gamma << '\n'
501 << " xy_goal_tolerance:" << xy_goal_tolerance_ << '\n'
502 << " yaw_goal_tolerance:" << yaw_goal_tolerance_ << '\n');
503
504 // integrate trajectory and check collision
505
506 assert(currentPose.header.frame_id == "odom" || currentPose.header.frame_id == "map");
507 auto global_pose = currentPose;
508
509 auto * costmap2d = costmapRos_->getCostmap();
510 auto yaw = tf2::getYaw(global_pose.pose.orientation);
511
512 auto & pos = global_pose.pose.position;
513
514 Eigen::Vector3f currentpose(pos.x, pos.y, yaw);
515 Eigen::Vector3f currentvel(
516 cmd_vel.twist.linear.x, cmd_vel.twist.linear.y, cmd_vel.twist.angular.z);
517
518 std::vector<Eigen::Vector3f> trajectory;
519 this->generateTrajectory(
520 currentpose, currentvel, 0.8 /*meters*/, M_PI / 8 /*rads*/, 3.0 /*seconds*/, 0.05 /*seconds*/,
521 trajectory);
522
523 // check plan rejection
524 bool aceptedplan = true;
525
526 unsigned int mx = 0, my = 0;
527
528 // RCLCPP_INFO_STREAM(nh_->get_logger(), "lplanner goal: " << finalgoalpose.pose.position);
529 for (auto & p : trajectory)
530 {
531 float goaldx = p[0] - finalgoalpose.pose.position.x;
532 float goaldy = p[1] - finalgoalpose.pose.position.y;
533
534 float dst = sqrt(goaldx * goaldx + goaldy * goaldy);
535 if (dst < xy_goal_tolerance_)
536 {
537 // RCLCPP_INFO(nh_->get_logger(), "trajectory checking skipped, goal reached");
538 break;
539 }
540
541 costmap2d->worldToMap(p[0], p[1], mx, my);
542
543 // RCLCPP_INFO(nh_->get_logger(), "checking cost pt %d [%lf, %lf] cell[%d,%d] = %d", i, p[0], p[1], mx, my, cost);
544 // RCLCPP_INFO_STREAM(nh_->get_logger(), "cost: " << cost);
545
546 // Costmap values: 255 no information, 254 lethal obstacle, 253 inscribed inflated obstacle, 0 free space.
547 if (costmap2d->getCost(mx, my) >= nav2_costmap_2d::INSCRIBED_INFLATED_OBSTACLE)
548 {
549 aceptedplan = false;
550 // RCLCPP_WARN(nh_->get_logger(), "ABORTED LOCAL PLAN BECAUSE OBSTACLE DETEDTED");
551 break;
552 }
553 }
554
555 bool success = false;
556 if (aceptedplan)
557 {
558 waiting_ = false;
559 success = true;
560 RCLCPP_DEBUG(nh_->get_logger(), "simulated trajectory is accepted.");
561 }
562 else
563 {
564 RCLCPP_DEBUG(nh_->get_logger(), "simulated trajectory is not accepted. Stop command.");
565
566 // stop and wait
567 cmd_vel.twist.linear.x = 0;
568 cmd_vel.twist.angular.z = 0;
569
570 if (!waiting_)
571 {
572 RCLCPP_DEBUG(nh_->get_logger(), "Start waiting obstacle disappear");
573 waiting_ = true;
574 waitingStamp_ = nh_->now();
575 }
576 else
577 {
578 auto waitingduration = nh_->now() - waitingStamp_;
579 RCLCPP_DEBUG(
580 nh_->get_logger(), "waiting obstacle disappear, elapsed: %lf seconds",
581 waitingduration.seconds());
582
583 if (waitingduration > this->waitingTimeout_)
584 {
585 RCLCPP_WARN(
586 nh_->get_logger(), "TIMEOUT waiting obstacle disappear, elapsed: %lf seconds",
587 waitingduration.seconds());
588 success = false;
589 }
590 }
591 }
592
593 if (!success)
594 {
595 RCLCPP_DEBUG(
596 nh_->get_logger(),
597 "[ForwardLocalPlanner] object detected waiting stopped until it disappears.");
598 }
599
600 cmd_vel.header.stamp = nh_->now();
601 return cmd_vel;
602}
603
604void ForwardLocalPlanner::setSpeedLimit(const double & /*speed_limit*/, const bool & /*percentage*/)
605{
606 RCLCPP_WARN_STREAM(
607 nh_->get_logger(),
608 "ForwardLocalPlanner::setSpeedLimit invoked. Ignored, functionality not "
609 "implemented.");
610}
611
618
624void ForwardLocalPlanner::setPlan(const nav_msgs::msg::Path & plan)
625{
626 nav_msgs::msg::Path transformedPlan;
627
628 rclcpp::Duration ttol = rclcpp::Duration::from_seconds(transform_tolerance_);
629 // transform global plan
630 for (auto & p : plan.poses)
631 {
632 geometry_msgs::msg::PoseStamped transformedPose;
633 nav_2d_utils::transformPose(tf_, costmapRos_->getGlobalFrameID(), p, transformedPose, ttol);
634 transformedPose.header.frame_id = costmapRos_->getGlobalFrameID();
635 transformedPlan.poses.push_back(transformedPose);
636 }
637
638 plan_ = transformedPlan.poses;
639 goalReached_ = false;
640}
641} // namespace forward_local_planner
642} // namespace cl_nav2z
643PLUGINLIB_EXPORT_CLASS(cl_nav2z::forward_local_planner::ForwardLocalPlanner, nav2_core::Controller)
std::vector< geometry_msgs::msg::PoseStamped > plan_
std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmapRos_
Eigen::Vector3f computeNewPositions(const Eigen::Vector3f &pos, const Eigen::Vector3f &vel, double dt)
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 generateTrajectory(const Eigen::Vector3f &pos, const Eigen::Vector3f &vel, float maxdist, float maxangle, float maxtime, float dt, std::vector< Eigen::Vector3f > &outtraj)
void setSpeedLimit(const double &speed_limit, const bool &percentage) override
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 setPlan(const nav_msgs::msg::Path &path) override
nav2_core setPlan - Sets the global plan
rclcpp_lifecycle::LifecyclePublisher< visualization_msgs::msg::MarkerArray >::SharedPtr goalMarkerPublisher_
void declareOrSet(rclcpp_lifecycle::LifecycleNode::SharedPtr &node, std::string param, T &value)
Definition common.hpp:34
void clamp(rclcpp::Node::SharedPtr nh_, geometry_msgs::msg::Twist &cmd_vel, double max_linear_x_speed_, double max_angular_z_speed_)