Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify controller manager namespacing #2210

Merged
merged 2 commits into from
Jun 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,8 @@ class Ros2ControlManager : public moveit_controller_manager::MoveItControllerMan
* \brief Configure interface with namespace
* @param ns namespace of ros_control node (without /controller_manager/)
*/
Ros2ControlManager(const std::string& ns)
[[deprecated("Ros2ControlManager constructor with namespace is deprecated. Set namespace via the "
"ros_control_namespace parameter.")]] Ros2ControlManager(const std::string& ns)
: ns_(ns), loader_("moveit_ros_control_interface", "moveit_ros_control_interface::ControllerHandleAllocator")
{
RCLCPP_INFO_STREAM(LOGGER, "Started moveit_ros_control_interface::Ros2ControlManager for namespace " << ns_);
Expand All @@ -258,18 +259,12 @@ class Ros2ControlManager : public moveit_controller_manager::MoveItControllerMan
void initialize(const rclcpp::Node::SharedPtr& node) override
{
node_ = node;
if (!ns_.empty())
// Set the namespace from the ros_control_namespace parameter, or default to "/"
if (!node_->has_parameter("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_);
}
ns_ = node_->declare_parameter<std::string>("ros_control_namespace", "/");
}
else if (node->has_parameter("ros_control_namespace"))
else
{
node_->get_parameter<std::string>("ros_control_namespace", ns_);
RCLCPP_INFO_STREAM(LOGGER, "Namespace for controller manager was specified, namespace: " << ns_);
Expand Down