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

Keep namespace relative if base_prefix is empty string #40

Open
wants to merge 1 commit into
base: indigo
Choose a base branch
from

Conversation

slivingston
Copy link
Contributor

Suppose that rather than use base_prefix to change the default of "mobile_base", a
user wishes to entirely remove the base prefix. If the param
base_prefix is set to the empty string, then the topic names
would become absolute, i.e., would begin with "/". This changeset
ensures that they remain relative in this case.

The motivating use-case is spawning multiple instances of the Kobuki model, each with a unique namespace, while trying to keep topic names short.

Suppose that rather than give a different string for the base_prefix, a
user wishes to entirely remove the base prefix.  If the param
base_prefix is set to the empty string, then previously the topic names
would become absolute, i.e., would begin with "/".  This changeset
ensures that they remain relative in this case.
@@ -309,6 +309,8 @@ void GazeboRosKobuki::setupRosApi(std::string& model_name)
{
std::string base_prefix;
gazebo_ros_->node()->param("base_prefix", base_prefix, std::string("mobile_base"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the default value std::string("mobile_base") has to be dropped. Otherwise you won't be able to set the base_prefix to be an empty string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the parameter server has the empty string as the value of "base_prefix", then ros::NodeHandle::param() will use it and not the default. The API description of param() claims that the default value is only used if the parameter value cannot be retrieved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right in case of the ROS parameter server, but this is not the case here. The parameter here comes from Gazebo and is set here: https://github.com/yujinrobot/kobuki_desktop/blob/indigo/kobuki_gazebo/launch/includes/robot.launch.xml#L9

If I provide an empty string, I believe the parameter is considered not set and the default is selected. At least this happend when I tried it. How did you make it work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants