~ in ROS2 action name

asked 2021-12-30 13:09:10 -0500

AndyZe gravatar image

updated 2022-01-02 08:57:13 -0500

In ROS2 I have a common header file that has some action names. Note the ~ which (I believe) is supposed to prepend the node name.

hybrid_planning_common.h:

#pragma once

namespace moveit::hybrid_planning
{
namespace
{
constexpr char GLOBAL_PLANNING_ACTION_NAME[] = "~/hybrid_planning/global_planning_action";
constexpr char LOCAL_PLANNING_ACTION_NAME[] = "~/hybrid_planning/local_planning_action";
constexpr char RUN_HYBRID_PLANNING_ACTION_NAME[] = "~/hybrid_planning/run_hybrid_planning";
}  // namespace
}  // namespace moveit::hybrid_planning

It's used in several cpp files like this:

#include <moveit/hybrid_planning_common/hybrid_planning_common.h>
...
  global_planning_request_server_ = rclcpp_action::create_server<moveit_msgs::action::GlobalPlanner>(
      node_, GLOBAL_PLANNING_ACTION_NAME,

It works great if I delete the ~. With the ~, I get this error:

[ERROR] [1640889487.748031102] [hybrid_planning_manager]: Global planner action server not available after waiting

Everything is launched as a component of a ComposableNodeContainer. ros2 action list shows this:

/global_planner/hybrid_planning/global_planning_action
/hybrid_planning_demo_node/hybrid_planning/run_hybrid_planning
/hybrid_planning_manager/hybrid_planning/local_planning_action
/local_planner/hybrid_planning/local_planning_action

The problem being local_planning_action has 2 different namespaces.

The PR is here in case anybody really wants to dig in.

Without this feature, I don't know how I would launch 2 actions servers for 2 manipulators.

edit retag flag offensive close merge delete

Comments

Well, an inconvenient workaround for this is to add parameters to the launch file for the action names.

AndyZe gravatar image AndyZe  ( 2022-01-01 18:28:34 -0500 )edit