moveit/moveit2

Why does Trajectory Execution Manager use MultiThreadedExecutor?

CihatAltiparmak opened this issue · 1 comments

Description

While trying to integrate rmw_zenoh to MoveIt, i have seen that MoveGroup server uses MultiThreadedExecutor. rmw_zenoh doesn't work at the moment because of MultiThreadedExecutor. My aim here is not to report a bug, but to start a discussion about whether it's really necessary to use MultiThreadedExecutor here.

// The default callback group for rclcpp::Node is MutuallyExclusive which means we cannot call
// receiveEvent while processing a different callback. To fix this we create a new callback group (the type is not
// important since we only use it to process one callback) and associate event_topic_subscriber_ with this callback group
auto callback_group = node_->create_callback_group(rclcpp::CallbackGroupType::MutuallyExclusive);
auto options = rclcpp::SubscriptionOptions();
options.callback_group = callback_group;
event_topic_subscriber_ = node_->create_subscription<std_msgs::msg::String>(
EXECUTION_EVENT_TOPIC, rclcpp::SystemDefaultsQoS(),
[this](const std_msgs::msg::String::ConstSharedPtr& event) { return receiveEvent(event); }, options);

rclcpp::executors::MultiThreadedExecutor executor;
move_group::MoveGroupExe mge(moveit_cpp, default_planning_pipeline, debug);
bool monitor_dynamics;
if (nh->get_parameter("monitor_dynamics", monitor_dynamics) && monitor_dynamics)
{
RCLCPP_INFO(nh->get_logger(), "MoveGroup monitors robot dynamics (higher load)");
planning_scene_monitor->getStateMonitor()->enableCopyDynamics(true);
}
planning_scene_monitor->publishDebugInformation(debug);
mge.status();
executor.add_node(nh);
executor.spin();

Your environment

  • ROS Distro: Rolling
  • OS Version: Ubuntu 22.04
  • Build Type: Source
  • main
  • rmw_zenoh