Skip to content

Commit

Permalink
Invoke OMPL debug print only when debug logging is enabled (#2608)
Browse files Browse the repository at this point in the history
  • Loading branch information
medvedevigorek authored Dec 17, 2023
1 parent 7ad5b52 commit 0807cb2
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,13 @@ void ModelBasedPlanningContext::postSolve()
RCLCPP_DEBUG(getLogger(), "There were %d valid motions and %d invalid motions.", v, iv);

// Debug OMPL setup and solution
std::stringstream debug_out;
ompl_simple_setup_->print(debug_out);
RCLCPP_DEBUG(getLogger(), "%s", rclcpp::get_c_string(debug_out.str()));
RCLCPP_DEBUG(getLogger(), "%s",
[&] {
std::stringstream debug_out;
ompl_simple_setup_->print(debug_out);
return debug_out.str();
}()
.c_str());
}

void ModelBasedPlanningContext::solve(planning_interface::MotionPlanResponse& res)
Expand Down

0 comments on commit 0807cb2

Please sign in to comment.