Skip to content

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