@@ -860,7 +860,7 @@ const moveit_msgs::msg::MoveItErrorCodes ompl_interface::ModelBasedPlanningConte
860
860
RCLCPP_DEBUG (LOGGER, " %s: Solving the planning problem once..." , name_.c_str ());
861
861
ob::PlannerTerminationCondition ptc = constructPlannerTerminationCondition (timeout, start);
862
862
registerTerminationCondition (ptc);
863
- result. val = ompl_simple_setup_->solve (ptc) == ompl::base::PlannerStatus::EXACT_SOLUTION ;
863
+ std::ignore = ompl_simple_setup_->solve (ptc);
864
864
last_plan_time_ = ompl_simple_setup_->getLastPlanComputationTime ();
865
865
unregisterTerminationCondition ();
866
866
// fill the result status code
@@ -976,7 +976,7 @@ void ompl_interface::ModelBasedPlanningContext::unregisterTerminationCondition()
976
976
int32_t ompl_interface::ModelBasedPlanningContext::logPlannerStatus (const og::SimpleSetupPtr& ompl_simple_setup)
977
977
{
978
978
auto result = moveit_msgs::msg::MoveItErrorCodes::PLANNING_FAILED;
979
- ompl::base::PlannerStatus ompl_status = ompl_simple_setup->getLastPlannerStatus ();
979
+ const ompl::base::PlannerStatus ompl_status = ompl_simple_setup->getLastPlannerStatus ();
980
980
switch (ompl::base::PlannerStatus::StatusType (ompl_status))
981
981
{
982
982
case ompl::base::PlannerStatus::UNKNOWN:
@@ -996,12 +996,23 @@ int32_t ompl_interface::ModelBasedPlanningContext::logPlannerStatus(const og::Si
996
996
result = moveit_msgs::msg::MoveItErrorCodes::UNRECOGNIZED_GOAL_TYPE;
997
997
break ;
998
998
case ompl::base::PlannerStatus::TIMEOUT:
999
- RCLCPP_WARN (LOGGER, " Timed out" );
999
+ RCLCPP_WARN (LOGGER, " Timed out: %.1fs ≥ %.1fs" , ompl_simple_setup->getLastPlanComputationTime (),
1000
+ request_.allowed_planning_time );
1000
1001
result = moveit_msgs::msg::MoveItErrorCodes::TIMED_OUT;
1001
1002
break ;
1002
1003
case ompl::base::PlannerStatus::APPROXIMATE_SOLUTION:
1003
- RCLCPP_WARN (LOGGER, " Solution is approximate" );
1004
- result = moveit_msgs::msg::MoveItErrorCodes::SUCCESS;
1004
+ // timeout is a common reason for APPROXIMATE_SOLUTION
1005
+ if (ompl_simple_setup->getLastPlanComputationTime () > request_.allowed_planning_time )
1006
+ {
1007
+ RCLCPP_WARN (LOGGER, " Planning timed out: %.1fs ≥ %.1fs" , ompl_simple_setup->getLastPlanComputationTime (),
1008
+ request_.allowed_planning_time );
1009
+ result = moveit_msgs::msg::MoveItErrorCodes::TIMED_OUT;
1010
+ }
1011
+ else
1012
+ {
1013
+ RCLCPP_WARN (LOGGER, " Solution is approximate" );
1014
+ result = moveit_msgs::msg::MoveItErrorCodes::PLANNING_FAILED;
1015
+ }
1005
1016
break ;
1006
1017
case ompl::base::PlannerStatus::EXACT_SOLUTION:
1007
1018
result = moveit_msgs::msg::MoveItErrorCodes::SUCCESS;
0 commit comments