Skip to content

Commit ed695c3

Browse files
another refactor
Signed-off-by: Daniel Sanchez <danielsanchezaran@gmail.com>
1 parent c1bf1fc commit ed695c3

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

planning/behavior_path_start_planner_module/src/start_planner_module.cpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -360,20 +360,17 @@ bool StartPlannerModule::isStopped()
360360

361361
bool StartPlannerModule::isExecutionReady() const
362362
{
363-
bool is_safe = true;
364363
// Evaluate safety. The situation is not safe if any of the following conditions are met:
365364
// 1. pull out path has not been found
366365
// 2. there is a moving objects around ego
367366
// 3. waiting for approval and there is a collision with dynamic objects
368-
if (!status_.found_pull_out_path) {
369-
is_safe = false;
370-
} else if (isWaitingApproval()) {
371-
if (!noMovingObjectsAround()) {
372-
is_safe = false;
373-
} else if (requiresDynamicObjectsCollisionDetection() && hasCollisionWithDynamicObjects()) {
374-
is_safe = false;
375-
}
376-
}
367+
368+
const bool is_safe = [&]() -> bool {
369+
if (!status_.found_pull_out_path) return false;
370+
if (!isWaitingApproval()) return true;
371+
if (!noMovingObjectsAround()) return false;
372+
return !(requiresDynamicObjectsCollisionDetection() && hasCollisionWithDynamicObjects());
373+
}();
377374

378375
if (!is_safe) {
379376
stop_pose_ = planner_data_->self_odometry->pose.pose;

0 commit comments

Comments
 (0)