42 #include <boost/tokenizer.hpp>
58 "move_group/MoveGroupCartesianPathService",
59 "move_group/MoveGroupKinematicsService",
60 "move_group/MoveGroupExecuteTrajectoryAction",
61 "move_group/MoveGroupMoveAction",
62 "move_group/MoveGroupPickPlaceAction",
63 "move_group/MoveGroupPlanService",
64 "move_group/MoveGroupQueryPlannersService",
65 "move_group/MoveGroupStateValidationService",
66 "move_group/MoveGroupGetPlanningSceneService",
67 "move_group/ApplyPlanningSceneService",
68 "move_group/ClearOctomapService",
79 bool allow_trajectory_execution;
80 node_handle_.
param(
"allow_trajectory_execution", allow_trajectory_execution,
true);
83 std::make_shared<MoveGroupContext>(
moveit_cpp, default_planning_pipeline, allow_trajectory_execution, debug);
120 "moveit_ros_move_group",
"move_group::MoveGroupCapability");
125 "Exception while creating plugin loader for move_group capabilities: " << ex.what());
129 std::set<std::string> capabilities;
133 capabilities.insert(capability);
136 std::string capability_plugins;
139 boost::char_separator<char> sep(
" ");
140 boost::tokenizer<boost::char_separator<char>> tok(capability_plugins, sep);
141 capabilities.insert(tok.begin(), tok.end());
145 for (
const auto& pipeline_entry :
context_->moveit_cpp_->getPlanningPipelines())
147 const auto& pipeline_name = pipeline_entry.first;
148 std::string pipeline_capabilities;
149 if (
node_handle_.
getParam(
"planning_pipelines/" + pipeline_name +
"/capabilities", pipeline_capabilities))
151 boost::char_separator<char> sep(
" ");
152 boost::tokenizer<boost::char_separator<char>> tok(pipeline_capabilities, sep);
153 capabilities.insert(tok.begin(), tok.end());
160 boost::char_separator<char> sep(
" ");
161 boost::tokenizer<boost::char_separator<char>> tok(capability_plugins, sep);
162 for (boost::tokenizer<boost::char_separator<char>>::iterator cap_name = tok.begin(); cap_name != tok.end();
164 capabilities.erase(*cap_name);
167 for (
const std::string& capability : capabilities)
180 "Exception while loading move_group capability '" << capability <<
"': " << ex.what());
184 std::stringstream ss;
187 ss <<
"********************************************************" << std::endl;
188 ss <<
"* MoveGroup using: " << std::endl;
190 ss <<
"* - " << cap->getName() << std::endl;
191 ss <<
"********************************************************" << std::endl;
202 int main(
int argc,
char** argv)
216 if (pnh.
getParam(
"planning_pipelines", planning_pipeline_configs))
221 <<
"' is expected to be a dictionary of pipeline configurations.");
225 for (std::pair<const std::string, XmlRpc::XmlRpcValue>& config : planning_pipeline_configs)
228 std::find_if(config.second.begin(), config.second.end(),
229 [](std::pair<const std::string, XmlRpc::XmlRpcValue>& item) {
230 return item.first ==
"planning_plugin";
231 }) == config.second.end())
233 << config.first <<
"/planning_plugin' doesn't exist");
240 <<
". Did you use a namespace, e.g. planning_pipelines/ompl/ ?");
246 std::string default_planning_pipeline;
247 if (pnh.
getParam(
"default_planning_pipeline", default_planning_pipeline))
250 if (std::find(pipeline_names.begin(), pipeline_names.end(), default_planning_pipeline) == pipeline_names.end())
253 "MoveGroup launched with ~default_planning_pipeline '%s' not configured in ~planning_pipelines",
254 default_planning_pipeline.c_str());
255 default_planning_pipeline =
"";
258 else if (pipeline_names.size() > 1)
262 "MoveGroup launched without ~default_planning_pipeline specifying the namespace for the default "
263 "planning pipeline configuration");
267 if (default_planning_pipeline.empty())
269 if (!pipeline_names.empty())
272 default_planning_pipeline = pipeline_names[0];
276 ROS_WARN_NAMED(
LOGNAME,
"Falling back to using the move_group node's namespace (deprecated Melodic behavior).");
282 pnh.
setParam(
"default_planning_pipeline", default_planning_pipeline);
287 const auto moveit_cpp = std::make_shared<moveit_cpp::MoveItCpp>(moveit_cpp_options, pnh,
tf_buffer);
293 for (
int i = 1; i < argc; ++i)
294 if (strncmp(argv[i],
"--debug", 7) == 0)
306 if (pnh.
param<
bool>(
"monitor_dynamics",
false))