SMACC2
Loading...
Searching...
No Matches
cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner Class Reference

#include <undo_path_global_planner.hpp>

Inheritance diagram for cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner:
Inheritance graph
Collaboration diagram for cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner:
Collaboration graph

Public Member Functions

 UndoPathGlobalPlanner ()
 
 ~UndoPathGlobalPlanner () override
 Virtual destructor.
 
void configure (const rclcpp_lifecycle::LifecycleNode::WeakPtr &parent, std::string name, std::shared_ptr< tf2_ros::Buffer > tf, std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros) override
 
void cleanup () override
 Method to cleanup resources used on shutdown.
 
void activate () override
 Method to active planner and any threads involved in execution.
 
void deactivate () override
 Method to deactivate planner and any threads involved in execution.
 
nav_msgs::msg::Path createPlan (const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal, std::function< bool()> cancel_checker) override
 Method create the plan from a starting and ending goal.
 

Private Member Functions

void onForwardTrailMsg (const nav_msgs::msg::Path::SharedPtr trailMessage)
 
void publishGoalMarker (const geometry_msgs::msg::Pose &pose, double r, double g, double b)
 
void clearGoalMarker ()
 
virtual void createDefaultUndoPathPlan (const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal, std::vector< geometry_msgs::msg::PoseStamped > &plan)
 

Private Attributes

rclcpp_lifecycle::LifecycleNode::SharedPtr nh_
 
rclcpp::Subscription< nav_msgs::msg::Path >::SharedPtr forwardPathSub_
 
rclcpp_lifecycle::LifecyclePublisher< nav_msgs::msg::Path >::SharedPtr planPub_
 
rclcpp_lifecycle::LifecyclePublisher< visualization_msgs::msg::MarkerArray >::SharedPtr markersPub_
 
nav_msgs::msg::Path lastForwardPathMsg_
 
std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros_
 stored but almost not used
 
double skip_straight_motion_distance_
 
double transform_tolerance_
 
std::string name_
 
std::shared_ptr< tf2_ros::Buffer > tf_
 

Detailed Description

Definition at line 33 of file undo_path_global_planner.hpp.

Constructor & Destructor Documentation

◆ UndoPathGlobalPlanner()

cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::UndoPathGlobalPlanner ( )

◆ ~UndoPathGlobalPlanner()

cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::~UndoPathGlobalPlanner ( )
override

Virtual destructor.

Definition at line 53 of file undo_path_global_planner.cpp.

54{
55 // a planner that was never configured has neither a node nor a publisher
56 if (nh_ == nullptr || planPub_ == nullptr) return;
57
58 // clear "rviz"- publish empty path
59 nav_msgs::msg::Path planMsg;
60 planMsg.header.stamp = this->nh_->now();
61 planPub_->publish(planMsg);
62}
rclcpp_lifecycle::LifecyclePublisher< nav_msgs::msg::Path >::SharedPtr planPub_

References nh_, and planPub_.

Member Function Documentation

◆ activate()

void cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::activate ( )
override

Method to active planner and any threads involved in execution.

Definition at line 66 of file undo_path_global_planner.cpp.

67{
68 RCLCPP_INFO_STREAM(nh_->get_logger(), "activating planner UndoPathGlobalPlanner");
69 planPub_->on_activate();
70 markersPub_->on_activate();
71}
rclcpp_lifecycle::LifecyclePublisher< visualization_msgs::msg::MarkerArray >::SharedPtr markersPub_

References markersPub_, nh_, and planPub_.

◆ cleanup()

void cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::cleanup ( )
override

Method to cleanup resources used on shutdown.

Definition at line 64 of file undo_path_global_planner.cpp.

References clearGoalMarker().

Here is the call graph for this function:

◆ clearGoalMarker()

void cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::clearGoalMarker ( )
private

clearGoalMarker()

Definition at line 129 of file undo_path_global_planner.cpp.

130{
131 visualization_msgs::msg::Marker marker;
132 marker.header.frame_id = this->costmap_ros_->getGlobalFrameID();
133 marker.header.stamp = nh_->now();
134 marker.ns = "my_namespace2";
135 marker.id = 0;
136 marker.action = visualization_msgs::msg::Marker::DELETEALL;
137
138 visualization_msgs::msg::MarkerArray ma;
139 ma.markers.push_back(marker);
140 markersPub_->publish(ma);
141}
std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros_
stored but almost not used

References costmap_ros_, markersPub_, and nh_.

Referenced by cleanup(), and deactivate().

Here is the caller graph for this function:

◆ configure()

void cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::configure ( const rclcpp_lifecycle::LifecycleNode::WeakPtr & parent,
std::string name,
std::shared_ptr< tf2_ros::Buffer > tf,
std::shared_ptr< nav2_costmap_2d::Costmap2DROS > costmap_ros )
override
Parameters
parentpointer to user's node
nameThe name of this planner
tfA pointer to a TF buffer
costmap_rosA pointer to the costmap

initialize()

Definition at line 86 of file undo_path_global_planner.cpp.

89{
90 nh_ = parent.lock();
91 costmap_ros_ = costmap_ros;
92 tf_ = tf;
93 name_ = name;
94 // RCLCPP_WARN_NAMED(nh_->get_logger(), "Backwards", "initializing global planner, costmap address: %ld",
95 // (long)costmap_ros);
96
97 rclcpp::SensorDataQoS qos;
98 qos.keep_last(2);
99 forwardPathSub_ = nh_->create_subscription<nav_msgs::msg::Path>(
100 "odom_tracker_path", qos,
101 std::bind(&UndoPathGlobalPlanner::onForwardTrailMsg, this, std::placeholders::_1));
102
103 planPub_ =
104 nh_->create_publisher<nav_msgs::msg::Path>("undo_path_planner/global_plan", rclcpp::QoS(1));
105 markersPub_ = nh_->create_publisher<visualization_msgs::msg::MarkerArray>(
106 "undo_path_planner/markers", rclcpp::QoS(1));
107
108 declareOrSet(nh_, name_ + ".transform_tolerance", transform_tolerance_);
109}
rclcpp::Subscription< nav_msgs::msg::Path >::SharedPtr forwardPathSub_
void onForwardTrailMsg(const nav_msgs::msg::Path::SharedPtr trailMessage)
void declareOrSet(rclcpp_lifecycle::LifecycleNode::SharedPtr &node, std::string param, T &value)
Definition common.hpp:34

References costmap_ros_, declareOrSet(), forwardPathSub_, markersPub_, name_, nh_, onForwardTrailMsg(), planPub_, tf_, and transform_tolerance_.

Here is the call graph for this function:

◆ createDefaultUndoPathPlan()

void cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::createDefaultUndoPathPlan ( const geometry_msgs::msg::PoseStamped & start,
const geometry_msgs::msg::PoseStamped & goal,
std::vector< geometry_msgs::msg::PoseStamped > & plan )
privatevirtual

defaultBackwardPath()

Definition at line 191 of file undo_path_global_planner.cpp.

194{
195 //------------- TRANSFORM TO GLOBAL FRAME PATH ---------------------------
196 // the forward plan might be recoreded in a different frame of the global (costmap) frame. Transform it.
197 // transform global plan to the navigation reference frame
198
199 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Transforming forward path");
200 nav_msgs::msg::Path transformedPlan;
201 rclcpp::Duration ttol = rclcpp::Duration::from_seconds(transform_tolerance_);
202 for (auto p : lastForwardPathMsg_.poses)
203 {
204 geometry_msgs::msg::PoseStamped transformedPose;
205 p.header.stamp = nh_->now(); // otherwise we can get some time tolerance error
206 transformedPose.header.stamp = nh_->now();
207 transformedPose.header.frame_id = costmap_ros_->getGlobalFrameID();
208 nav_2d_utils::transformPose(tf_, costmap_ros_->getGlobalFrameID(), p, transformedPose, ttol);
209 transformedPlan.poses.push_back(transformedPose);
210 }
211
212 lastForwardPathMsg_ = transformedPlan;
213 //---------------------------------------------------------------------------
214
215 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] finding goal closest point");
216 // reverse index of the pose being examined in the first pass (the last pose
217 // of the recorded forward path is the one closest to the robot now)
218 int reverseIndex = lastForwardPathMsg_.poses.size() - 1;
219 double linear_mindist = std::numeric_limits<double>::max();
220 int mindistindex = -1;
221 double startPoseAngle = tf2::getYaw(start.pose.orientation);
222 geometry_msgs::msg::Pose startPositionProjected;
223
224 // The goal of this code is finding the most convenient initial path pose.
225 // first, find closest linear point to the current robot position
226 // we start from the final goal, that is, the beginning of the trajectory
227 // (since this was the forward motion from the odom tracker)
228 for (const auto & p : transformedPlan.poses /*| boost::adaptors::reversed*/)
229 {
230 geometry_msgs::msg::PoseStamped pose = p;
231 pose.header.frame_id = costmap_ros_->getGlobalFrameID();
232
233 double dx = pose.pose.position.x - start.pose.position.x;
234 double dy = pose.pose.position.y - start.pose.position.y;
235
236 double dist = sqrt(dx * dx + dy * dy);
237 double angleOrientation = tf2::getYaw(pose.pose.orientation);
238 double angleError = fabs(angles::shortest_angular_distance(angleOrientation, startPoseAngle));
239 if (dist <= linear_mindist)
240 {
241 mindistindex = reverseIndex;
242 linear_mindist = dist;
243 startPositionProjected = pose.pose;
244
245 RCLCPP_INFO_STREAM(
246 nh_->get_logger(), "[UndoPathGlobalPlanner] initial start point search, NEWBEST_LINEAR= "
247 << reverseIndex << ". error, linear: " << linear_mindist
248 << ", angular: " << angleError);
249 }
250 else
251 {
252 RCLCPP_INFO_STREAM(
253 nh_->get_logger(), "[UndoPathGlobalPlanner] initial start point search, skipped= "
254 << reverseIndex << ". best linear error: " << linear_mindist
255 << ". current error, linear: " << dist << " angular: " << angleError);
256 }
257
258 reverseIndex--;
259 }
260
261 double const ERROR_DISTANCE_PURE_SPINNING_FACTOR = 1.5;
262 // Concept of second pass: now we only consider a pure spinning motion in this point. We want to consume some very
263 // close angular targets, (accepting a larger linear minerror of 1.5 besterror. That is, more or less in the same
264 // point).
265
266 RCLCPP_INFO(nh_->get_logger(), "[UndoPathGlobalPlanner] second angular pass");
267 double angularMinDist = std::numeric_limits<double>::max();
268
269 if (mindistindex >= (int)transformedPlan.poses.size())
270 mindistindex =
271 transformedPlan.poses.size() -
272 1; // workaround, something is making a out of bound exception in poses array access
273 {
274 if (transformedPlan.poses.size() == 0)
275 {
276 RCLCPP_WARN_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Warning possible bug");
277 }
278
279 // ------- FULL FORWARD PASS TO FIND THE STARTING POINT OF THE FORWARD MOTION ------
280 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] second pass loop");
281 for (int i = mindistindex; i >= 0; i--)
282 {
283 // warning this index, i refers to some inverse interpretation from the previous loop,
284 // (last indexes in this path corresponds to the poses closer to our current position)
285 RCLCPP_INFO_STREAM(
286 nh_->get_logger(), "[UndoPathGlobalPlanner] " << i << "/" << transformedPlan.poses.size());
287 auto index = (int)transformedPlan.poses.size() - i - 1;
288 if (index < 0 || (size_t)index >= transformedPlan.poses.size())
289 {
290 RCLCPP_WARN_STREAM(
291 nh_->get_logger(),
292 "[UndoPathGlobalPlanner] this should not happen. Check implementation.");
293 break;
294 }
295 geometry_msgs::msg::PoseStamped pose =
296 transformedPlan.poses[transformedPlan.poses.size() - i - 1];
297
298 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] global frame");
299 pose.header.frame_id = costmap_ros_->getGlobalFrameID();
300
301 double dx = pose.pose.position.x - start.pose.position.x;
302 double dy = pose.pose.position.y - start.pose.position.y;
303
304 double dist = sqrt(dx * dx + dy * dy);
305 if (dist <= linear_mindist * ERROR_DISTANCE_PURE_SPINNING_FACTOR)
306 {
307 double angleOrientation = tf2::getYaw(pose.pose.orientation);
308 double angleError =
309 fabs(angles::shortest_angular_distance(angleOrientation, startPoseAngle));
310 if (angleError < angularMinDist)
311 {
312 angularMinDist = angleError;
313 mindistindex = i;
314 RCLCPP_INFO_STREAM(
315 nh_->get_logger(),
316 "[UndoPathGlobalPlanner] initial start point search (angular update), NEWBEST_ANGULAR= "
317 << i << ". error, linear: " << dist << "(" << linear_mindist << ")"
318 << ", angular: " << angleError << "(" << angularMinDist << ")");
319 }
320 else
321 {
322 RCLCPP_INFO_STREAM(
323 nh_->get_logger(),
324 "[UndoPathGlobalPlanner] initial start point search (angular update), skipped= "
325 << i << ". error, linear: " << dist << "(" << linear_mindist << ")"
326 << ", angular: " << angleError << "(" << angularMinDist << ")");
327 }
328 }
329 else
330 {
331 RCLCPP_INFO_STREAM(
332 nh_->get_logger(),
333 "[UndoPathGlobalPlanner] initial start point search (angular update) not in linear "
334 "range, skipped= "
335 << i << " linear error: " << dist << "(" << linear_mindist << ")");
336 }
337 }
338 }
339
340 // REVERSE FORWARD PASS
341 if (mindistindex != -1)
342 {
343 RCLCPP_WARN_STREAM(
344 nh_->get_logger(),
345 "[UndoPathGlobalPlanner] Creating the backwards plan from odom tracker path (, "
346 << transformedPlan.poses.size() << ") poses");
347
348 RCLCPP_WARN_STREAM(
349 nh_->get_logger(), "[UndoPathGlobalPlanner] closer point to goal i="
350 << mindistindex << " (linear min dist " << linear_mindist << ")");
351
352 // copy the path at the inverse direction, but only up to the closest point to the goal in the path (for partial undoing)
353 // NOTE: mindistindex lives in reverse-index space (passes above iterate with i counting
354 // down while walking the array forward: reverse index m maps to array index N-1-m).
355 // The emitted plan must start at the pose closest to the robot (array index
356 // N-1-mindistindex) and walk back to the start of the recorded trail (array index 0),
357 // which is the undo goal. When mindistindex == 0 (robot exactly at the trail tail)
358 // this is identical to emitting the whole path reversed.
359 //
360 // Same-position rotation clusters at the goal end (the poses recorded while the
361 // robot rotated in place before starting the forward motion) are pruned down to
362 // the final goal pose: they carry no positional information for the backward
363 // controller and destabilize the carrot/goal-checker endgame.
364 const double SAME_POSITION_PRUNE_DISTANCE = 0.02;
365 const auto & goalPosition = transformedPlan.poses.front().pose.position;
366 for (int i = (int)transformedPlan.poses.size() - 1 - mindistindex; i >= 0; i--)
367 {
368 auto & pose = transformedPlan.poses[i];
369
370 if (i != 0)
371 {
372 double gdx = pose.pose.position.x - goalPosition.x;
373 double gdy = pose.pose.position.y - goalPosition.y;
374 if (sqrt(gdx * gdx + gdy * gdy) < SAME_POSITION_PRUNE_DISTANCE)
375 {
376 // part of the in-place rotation cluster at the goal: skip, keep only i == 0
377 continue;
378 }
379 }
380
381 rclcpp::Time t(pose.header.stamp);
382
383 RCLCPP_INFO_STREAM(
384 nh_->get_logger(),
385 "[UndoPathGlobalPlanner] adding to plan i = " << i << " stamp:" << t.seconds());
386 plan.push_back(pose);
387 }
388 RCLCPP_WARN_STREAM(
389 nh_->get_logger(), "[UndoPathGlobalPlanner] refined plan has " << plan.size() << " points");
390 }
391 else
392 {
393 RCLCPP_ERROR_STREAM(
394 nh_->get_logger(), "[UndoPathGlobalPlanner ] undo global plan size: " << plan.size());
395 }
396}

References costmap_ros_, lastForwardPathMsg_, nh_, tf_, and transform_tolerance_.

Referenced by createPlan().

Here is the caller graph for this function:

◆ createPlan()

nav_msgs::msg::Path cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::createPlan ( const geometry_msgs::msg::PoseStamped & start,
const geometry_msgs::msg::PoseStamped & goal,
std::function< bool()> cancel_checker )
override

Method create the plan from a starting and ending goal.

Parameters
startThe starting pose of the robot
goalThe goal pose of the robot
cancel_checkerFunction to check if planning should be cancelled
Returns
The sequence of poses to get from start to goal, if any

makePlan()

Definition at line 403 of file undo_path_global_planner.cpp.

406{
407 // -------------- BASIC CHECKS ---------------------
408
409 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Undo global plan start ");
410 nav_msgs::msg::Path planMsg;
411 std::vector<geometry_msgs::msg::PoseStamped> & plan = planMsg.poses;
412
413 RCLCPP_INFO_STREAM(
414 nh_->get_logger(),
415 "[UndoPathGlobalPlanner] last forward path msg size: " << lastForwardPathMsg_.poses.size());
416
417 if (lastForwardPathMsg_.poses.size() == 0)
418 {
419 RCLCPP_WARN_STREAM(
420 nh_->get_logger(),
421 "[UndoPathGlobalPlanner] no forward path received yet (odom_tracker_path), returning "
422 "empty plan");
423 return planMsg;
424 }
425
426 RCLCPP_INFO_STREAM(
427 nh_->get_logger(), "[UndoPathGlobalPlanner] last forward path frame id: "
428 << lastForwardPathMsg_.poses.front().header.frame_id);
429 RCLCPP_INFO_STREAM(
430 nh_->get_logger(), "[UndoPathGlobalPlanner] start pose frame id: " << start.header.frame_id);
431 RCLCPP_INFO_STREAM(
432 nh_->get_logger(), "[UndoPathGlobalPlanner] goal pose frame id: " << goal.header.frame_id);
433
434 // ---------- INPUTS ACCOMMODATION -------------------
435 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Inputs accommodation");
436 geometry_msgs::msg::PoseStamped transformedStart, transformedGoal;
437 {
438 rclcpp::Duration ttol = rclcpp::Duration::from_seconds(transform_tolerance_);
439
440 geometry_msgs::msg::PoseStamped pstart = start;
441 pstart.header.stamp = nh_->now();
442 nav_2d_utils::transformPose(
443 tf_, costmap_ros_->getGlobalFrameID(), pstart, transformedStart, ttol);
444 transformedStart.header.frame_id = costmap_ros_->getGlobalFrameID();
445
446 //--------------- FORCE GOAL POSE----------------------------
447 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Forced goal");
448 auto forcedGoal =
449 lastForwardPathMsg_.poses[lastForwardPathMsg_.poses.size() - 1]; // FORCE LAST POSE
450 forcedGoal.header.stamp = nh_->now();
451 nav_2d_utils::transformPose(
452 tf_, costmap_ros_->getGlobalFrameID(), forcedGoal, transformedGoal, ttol);
453 transformedGoal.header.frame_id = costmap_ros_->getGlobalFrameID();
454 }
455
456 //------------- CREATING GLOBAL PLAN -----------------------------------------------
457 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] Creating undo plan");
458 this->createDefaultUndoPathPlan(transformedStart, transformedGoal, plan);
459 planMsg.header.frame_id = this->costmap_ros_->getGlobalFrameID();
460
461 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] publishing goal markers");
462 publishGoalMarker(plan.back().pose, 1.0, 0, 1.0 /*purple color*/);
463
464 //-------- CHECKING VALID PLAN ------------------------------------
465 bool acceptedGlobalPlan = true;
466 RCLCPP_INFO_STREAM(nh_->get_logger(), "[UndoPathGlobalPlanner] valid plan checking");
467
468 auto costmap2d = this->costmap_ros_->getCostmap();
469 for (auto & p : plan)
470 {
471 unsigned int mx = 0, my = 0;
472 costmap2d->worldToMap(p.pose.position.x, p.pose.position.y, mx, my);
473 auto cost = costmap2d->getCost(mx, my);
474
475 if (cost >= nav2_costmap_2d::INSCRIBED_INFLATED_OBSTACLE)
476 {
477 acceptedGlobalPlan = false;
478 break;
479 }
480 }
481
482 //-------- PUBLISHING RESULTS ---------------------------------------
483 RCLCPP_INFO_STREAM(
484 nh_->get_logger(), "[UndoPathGlobalPlanner] plan publishing. size: " << plan.size());
485 planPub_->publish(planMsg);
486 if (!acceptedGlobalPlan)
487 {
488 RCLCPP_INFO(
489 nh_->get_logger(),
490 "[UndoPathGlobalPlanner] not accepted global plan because of possible collision");
491 }
492
493 RCLCPP_INFO_STREAM(
494 nh_->get_logger(), "[UndoPathGlobalPlanner] plan publishing. size: " << planMsg.poses.size());
495
496 return planMsg;
497}
void publishGoalMarker(const geometry_msgs::msg::Pose &pose, double r, double g, double b)
virtual void createDefaultUndoPathPlan(const geometry_msgs::msg::PoseStamped &start, const geometry_msgs::msg::PoseStamped &goal, std::vector< geometry_msgs::msg::PoseStamped > &plan)

References costmap_ros_, createDefaultUndoPathPlan(), lastForwardPathMsg_, nh_, planPub_, publishGoalMarker(), tf_, and transform_tolerance_.

Here is the call graph for this function:

◆ deactivate()

void cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::deactivate ( )
override

Method to deactivate planner and any threads involved in execution.

Definition at line 73 of file undo_path_global_planner.cpp.

74{
75 RCLCPP_INFO_STREAM(nh_->get_logger(), "deactivating planner UndoPathGlobalPlanner");
76 this->clearGoalMarker();
77 planPub_->on_deactivate();
78 markersPub_->on_deactivate();
79}

References clearGoalMarker(), markersPub_, nh_, and planPub_.

Here is the call graph for this function:

◆ onForwardTrailMsg()

void cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::onForwardTrailMsg ( const nav_msgs::msg::Path::SharedPtr forwardPath)
private

onForwardTrailMsg()

Definition at line 115 of file undo_path_global_planner.cpp.

116{
117 lastForwardPathMsg_ = *forwardPath;
118 RCLCPP_INFO_STREAM_THROTTLE(
119 nh_->get_logger(), *nh_, 1000,
120 "[UndoPathGlobalPlanner] received backward path msg poses [" << lastForwardPathMsg_.poses.size()
121 << "]");
122}

References lastForwardPathMsg_, and nh_.

Referenced by configure().

Here is the caller graph for this function:

◆ publishGoalMarker()

void cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::publishGoalMarker ( const geometry_msgs::msg::Pose & pose,
double r,
double g,
double b )
private

publishGoalMarker()

Definition at line 148 of file undo_path_global_planner.cpp.

150{
151 double phi = tf2::getYaw(pose.orientation);
152
153 visualization_msgs::msg::Marker marker;
154 marker.header.frame_id = this->costmap_ros_->getGlobalFrameID();
155 marker.header.stamp = nh_->now();
156 marker.ns = "my_namespace2";
157 marker.id = 0;
158 marker.type = visualization_msgs::msg::Marker::ARROW;
159 marker.action = visualization_msgs::msg::Marker::ADD;
160 marker.scale.x = 0.1;
161 marker.scale.y = 0.3;
162 marker.scale.z = 0.1;
163 marker.color.a = 1.0;
164
165 marker.color.r = r;
166 marker.color.g = g;
167 marker.color.b = b;
168
169 marker.lifetime = rclcpp::Duration(0s);
170
171 geometry_msgs::msg::Point start, end;
172 start.x = pose.position.x;
173 start.y = pose.position.y;
174
175 end.x = pose.position.x + 0.5 * cos(phi);
176 end.y = pose.position.y + 0.5 * sin(phi);
177
178 marker.points.push_back(start);
179 marker.points.push_back(end);
180
181 visualization_msgs::msg::MarkerArray ma;
182 ma.markers.push_back(marker);
183
184 markersPub_->publish(ma);
185}

References costmap_ros_, markersPub_, and nh_.

Referenced by createPlan().

Here is the caller graph for this function:

Member Data Documentation

◆ costmap_ros_

std::shared_ptr<nav2_costmap_2d::Costmap2DROS> cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::costmap_ros_
private

stored but almost not used

Definition at line 91 of file undo_path_global_planner.hpp.

Referenced by clearGoalMarker(), configure(), createDefaultUndoPathPlan(), createPlan(), and publishGoalMarker().

◆ forwardPathSub_

rclcpp::Subscription<nav_msgs::msg::Path>::SharedPtr cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::forwardPathSub_
private

Definition at line 82 of file undo_path_global_planner.hpp.

Referenced by configure().

◆ lastForwardPathMsg_

nav_msgs::msg::Path cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::lastForwardPathMsg_
private

◆ markersPub_

rclcpp_lifecycle::LifecyclePublisher<visualization_msgs::msg::MarkerArray>::SharedPtr cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::markersPub_
private

◆ name_

std::string cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::name_
private

Definition at line 107 of file undo_path_global_planner.hpp.

Referenced by configure().

◆ nh_

rclcpp_lifecycle::LifecycleNode::SharedPtr cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::nh_
private

◆ planPub_

rclcpp_lifecycle::LifecyclePublisher<nav_msgs::msg::Path>::SharedPtr cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::planPub_
private

◆ skip_straight_motion_distance_

double cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::skip_straight_motion_distance_
private

Definition at line 103 of file undo_path_global_planner.hpp.

Referenced by UndoPathGlobalPlanner().

◆ tf_

std::shared_ptr<tf2_ros::Buffer> cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::tf_
private

Definition at line 109 of file undo_path_global_planner.hpp.

Referenced by configure(), createDefaultUndoPathPlan(), and createPlan().

◆ transform_tolerance_

double cl_nav2z::undo_path_global_planner::UndoPathGlobalPlanner::transform_tolerance_
private

The documentation for this class was generated from the following files: