Skip to content

Commit 757232a

Browse files
Refactor build_dispatch_goal_pose to return PoseStamped directly and update related usages
1 parent 36eac68 commit 757232a

3 files changed

Lines changed: 9 additions & 14 deletions

File tree

include/frontier_exploration_ros2/frontier_explorer_core.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ class FrontierExplorerCore
218218
const FrontierLike & target_frontier,
219219
const geometry_msgs::msg::Pose & current_pose) const;
220220

221-
std::optional<geometry_msgs::msg::PoseStamped> build_dispatch_goal_pose(
222-
const FrontierLike & target_frontier,
221+
geometry_msgs::msg::PoseStamped build_dispatch_goal_pose(
222+
const FrontierLike & target_frontier,
223223
const geometry_msgs::msg::Pose & current_pose,
224224
bool bypass_min_distance_dispatch = false) const;
225225

src/frontier_explorer_core_dispatch.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ void FrontierExplorerCore::try_send_next_goal()
174174
frontier_sequence,
175175
*current_pose,
176176
"Sending frontier goal (" + selection.mode + "): " + describe_frontier(frontier_sequence.front()),
177-
false);
177+
escape_mode_active);
178178
}
179179

180180
void FrontierExplorerCore::reset_exploration_runtime_state(bool clear_maps)
@@ -910,24 +910,19 @@ bool FrontierExplorerCore::send_frontier_goal(
910910
dispatch_sequence.push_back(frontier_sequence[index]);
911911
}
912912

913-
const auto dispatch_goal_pose = build_dispatch_goal_pose(
914-
dispatch_sequence.front(),
913+
const auto goal_pose = build_dispatch_goal_pose(
914+
dispatch_sequence.front(),
915915
current_pose,
916916
bypass_min_distance_dispatch);
917-
if (!dispatch_goal_pose.has_value()) {
918-
callbacks.log_info(
919-
"No dispatchable frontier goal satisfies the minimum-distance constraint; waiting for updated map data");
920-
return false;
921-
}
922917
if (debug_outputs_enabled()) {
923-
callbacks.publish_selected_frontier_pose(dispatch_goal_pose.value());
918+
callbacks.publish_selected_frontier_pose(goal_pose);
924919
}
925920
const std::string dispatch_description = dispatch_index == 0U ?
926921
description :
927922
"Sending frontier goal after blocked-goal skip: " + describe_frontier(dispatch_sequence.front());
928923
// Frontier mode dispatches only the first element from the selected sequence.
929924
return send_pose_goal(
930-
dispatch_goal_pose.value(),
925+
goal_pose,
931926
"frontier",
932927
dispatch_sequence.front(),
933928
dispatch_sequence,

src/frontier_explorer_core_frontiers.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ geometry_msgs::msg::PoseStamped FrontierExplorerCore::build_goal_pose(
492492
return goal_pose;
493493
}
494494

495-
std::optional<geometry_msgs::msg::PoseStamped> FrontierExplorerCore::build_dispatch_goal_pose(
495+
geometry_msgs::msg::PoseStamped FrontierExplorerCore::build_dispatch_goal_pose(
496496
const FrontierLike & target_frontier,
497497
const geometry_msgs::msg::Pose & current_pose,
498498
bool bypass_min_distance_dispatch) const
@@ -606,7 +606,7 @@ std::optional<geometry_msgs::msg::PoseStamped> FrontierExplorerCore::build_dispa
606606
}
607607
}
608608

609-
return std::nullopt;
609+
return fallback_goal_pose;
610610
}
611611

612612
std::vector<geometry_msgs::msg::PoseStamped> FrontierExplorerCore::build_goal_pose_sequence(

0 commit comments

Comments
 (0)