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

Improved tf_prefix based on namespace #1060

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
9 changes: 5 additions & 4 deletions diff_drive_controller/src/diff_drive_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,13 +372,14 @@ controller_interface::CallbackReturn DiffDriveController::on_configure(
tf_prefix = std::string(get_node()->get_namespace());
}

if (tf_prefix == "/")
// Make sure prefix does not start with '/' and always ends with '/'
if (tf_prefix.back() != '/')
{
tf_prefix = "";
tf_prefix = tf_prefix + "/";
}
else
if (tf_prefix.front() == '/')
{
tf_prefix = tf_prefix + "/";
tf_prefix.erase(0, 1);
}
}

Expand Down
Loading