Skip to content

Commit

Permalink
Revert "Simplify controller manager namespacing (moveit#2210)"
Browse files Browse the repository at this point in the history
This reverts commit 55df0bc.

The deprecated constructor was being used in the same file
for the exact use case of enabling namespaces that are not
specified by the parameter. There is no replacement for
supporting a dynamic server lookup, however the parameter
logic could still use simplification.
  • Loading branch information
henningkayser committed Jun 7, 2024
1 parent 14bc36e commit f54c718
Showing 1 changed file with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ class Ros2ControlManager : public moveit_controller_manager::MoveItControllerMan
* \brief Configure interface with namespace
* @param ns namespace of ros_control node (without /controller_manager/)
*/
[[deprecated("Ros2ControlManager constructor with namespace is deprecated. Set namespace via the "
"ros_control_namespace parameter.")]] Ros2ControlManager(const std::string& ns)
Ros2ControlManager(const std::string& ns)
: ns_(ns), loader_("moveit_ros_control_interface", "moveit_ros_control_interface::ControllerHandleAllocator")
{
RCLCPP_INFO_STREAM(getLogger(), "Started moveit_ros_control_interface::Ros2ControlManager for namespace " << ns_);
Expand All @@ -265,12 +264,18 @@ class Ros2ControlManager : public moveit_controller_manager::MoveItControllerMan
void initialize(const rclcpp::Node::SharedPtr& node) override
{
node_ = node;
// Set the namespace from the ros_control_namespace parameter, or default to "/"
if (!node_->has_parameter("ros_control_namespace"))
if (!ns_.empty())
{
ns_ = node_->declare_parameter<std::string>("ros_control_namespace", "/");
if (!node_->has_parameter("ros_control_namespace"))
{
ns_ = node_->declare_parameter<std::string>("ros_control_namespace", "/");
}
else
{
node_->get_parameter<std::string>("ros_control_namespace", ns_);
}
}
else
else if (node->has_parameter("ros_control_namespace"))
{
node_->get_parameter<std::string>("ros_control_namespace", ns_);
RCLCPP_INFO_STREAM(getLogger(), "Namespace for controller manager was specified, namespace: " << ns_);
Expand Down

0 comments on commit f54c718

Please sign in to comment.