Skip to content

Commit

Permalink
Replaced std::bind with lambdas
Browse files Browse the repository at this point in the history
  • Loading branch information
Shobuj-Paul committed Sep 15, 2023
1 parent 3b96cbc commit 5eb2c63
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions moveit_planners/ompl/ompl_interface/src/ompl_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include <moveit/kinematic_constraints/utils.h>
#include <moveit/utils/lexical_casts.h>
#include <fstream>
#include <utility>

namespace ompl_interface
{
Expand All @@ -59,7 +60,19 @@ OMPLInterface::OMPLInterface(const moveit::core::RobotModelConstPtr& robot_model

store_planner_data_service_ = node_->create_service<std_srvs::srv::Trigger>(
"store_planner_data",
std::bind(&OMPLInterface::storePlannerData, this, std::placeholders::_1, std::placeholders::_2));
[this](const std::shared_ptr<std_srvs::srv::Trigger::Request>,
std::shared_ptr<std_srvs::srv::Trigger::Response> response) -> void {
bool success = context_manager_.storePlannerData();
response->success = success;
if (success)
{
RCLCPP_INFO(LOGGER, "Stored motion planner data");
}
else
{
RCLCPP_ERROR(LOGGER, "Motion planning graph is empty");
}
});
}

OMPLInterface::OMPLInterface(const moveit::core::RobotModelConstPtr& robot_model,
Expand All @@ -78,7 +91,19 @@ OMPLInterface::OMPLInterface(const moveit::core::RobotModelConstPtr& robot_model

store_planner_data_service_ = node_->create_service<std_srvs::srv::Trigger>(
"store_planner_data",
std::bind(&OMPLInterface::storePlannerData, this, std::placeholders::_1, std::placeholders::_2));
[this](const std::shared_ptr<std_srvs::srv::Trigger::Request>,
std::shared_ptr<std_srvs::srv::Trigger::Response> response) -> void {
bool success = context_manager_.storePlannerData();
response->success = success;
if (success)
{
RCLCPP_INFO(LOGGER, "Stored motion planner data");
}
else
{
RCLCPP_ERROR(LOGGER, "Motion planning graph is empty");
}
});
}

OMPLInterface::~OMPLInterface() = default;
Expand Down

0 comments on commit 5eb2c63

Please sign in to comment.