File tree 2 files changed +8
-2
lines changed
nav2_bt_navigator/src/navigators
2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -123,7 +123,10 @@ NavigateThroughPosesNavigator::onLoop()
123
123
try {
124
124
// Get current path points
125
125
nav_msgs::msg::Path current_path;
126
- res = blackboard->get (path_blackboard_id_, current_path);
126
+ if (!blackboard->get (path_blackboard_id_, current_path) || current_path.poses .size () == 0u ) {
127
+ // If no path set yet or not meaningful, can't compute ETA or dist remaining yet.
128
+ throw std::exception ();
129
+ }
127
130
128
131
// Find the closest pose to current pose on global path
129
132
auto find_closest_pose_idx =
Original file line number Diff line number Diff line change @@ -126,7 +126,10 @@ NavigateToPoseNavigator::onLoop()
126
126
try {
127
127
// Get current path points
128
128
nav_msgs::msg::Path current_path;
129
- [[maybe_unused]] auto res = blackboard->get (path_blackboard_id_, current_path);
129
+ if (!blackboard->get (path_blackboard_id_, current_path) || current_path.poses .size () == 0u ) {
130
+ // If no path set yet or not meaningful, can't compute ETA or dist remaining yet.
131
+ throw std::exception ();
132
+ }
130
133
131
134
// Find the closest pose to current pose on global path
132
135
auto find_closest_pose_idx =
You can’t perform that action at this time.
0 commit comments