Skip to content

Commit 92ae93e

Browse files
Gaël Écorchardgalou
Gaël Écorchard
authored andcommitted
Do not rely on generatePlan() to set error code
Do not rely on generatePlan() to set the error code in all cases and ensure that the error code is set to FAILURE if `generatePlan()` returns false. Signed-off-by: Gaël Écorchard <gael@km-robotics.cz>
1 parent eebcc13 commit 92ae93e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

moveit_ros/planning/planning_pipeline_interfaces/src/planning_pipeline_interfaces.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <moveit/utils/logger.hpp>
3939

4040
#include <thread>
41-
#include <tuple> // std::ignore.
4241

4342
namespace moveit
4443
{
@@ -64,7 +63,16 @@ planWithSinglePipeline(const ::planning_interface::MotionPlanRequest& motion_pla
6463
return motion_plan_response;
6564
}
6665
const planning_pipeline::PlanningPipelinePtr pipeline = it->second;
67-
std::ignore = pipeline->generatePlan(planning_scene, motion_plan_request, motion_plan_response);
66+
if (!pipeline->generatePlan(planning_scene, motion_plan_request, motion_plan_response))
67+
{
68+
if ((motion_plan_response.error_code.val == moveit::core::MoveItErrorCode::SUCCESS) ||
69+
(motion_plan_response.error_code.val == moveit::core::MoveItErrorCode::UNDEFINED))
70+
{
71+
RCLCPP_ERROR(getLogger(), "Planning pipeline '%s' failed to plan, but did not set an error code",
72+
motion_plan_request.pipeline_id.c_str());
73+
motion_plan_response.error_code = moveit::core::MoveItErrorCode::FAILURE;
74+
}
75+
}
6876
return motion_plan_response;
6977
}
7078

0 commit comments

Comments
 (0)