~ in ROS2 action name
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.
Well, an inconvenient workaround for this is to add parameters to the launch file for the action names.