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

All topics in root / namespace, difficult for multirobot environment #276

Open
ivan140 opened this issue Sep 2, 2022 · 0 comments
Open

Comments

@ivan140
Copy link

ivan140 commented Sep 2, 2022

Hi,

In the package fiducial_slam there are several subscribers and publishers which use the root (/) namespace. Here are the mentioned lines:

FiducialSlam::FiducialSlam(ros::NodeHandle &nh) : fiducialMap(nh) {
...
ft_sub = nh.subscribe("/fiducial_transforms", 1, &FiducialSlam::transformCallback, this);
--------------------------------------------------------------------------------------------
Map::Map(ros::NodeHandle &nh) : tfBuffer(ros::Duration(30.0)) {
...
robotPosePub =
    ros::Publisher(nh.advertise<geometry_msgs::PoseWithCovarianceStamped>("/fiducial_pose", 1));
cameraPosePub = ros::Publisher(
    nh.advertise<geometry_msgs::PoseWithCovarianceStamped>("/fiducial_slam/camera_pose", 1));

markerPub = ros::Publisher(nh.advertise<visualization_msgs::Marker>("/fiducials", 100));
mapPub = ros::Publisher(nh.advertise<fiducial_msgs::FiducialMapEntryArray>("/fiducial_map", 1));

When having several robots, each in its own namespace it makes it difficult to manage the fiducial_slam (remap...). I'd make a pull request with a fix, but want to ask you how you'd prefer it:

  1. Pass two NodeHandles (pnh and nh) to these functions. This way, if a namespace is defined and you declare the subscriber with nh but without the / the nodehandle will use the namespace: /robot_1/fiducial_map
  2. Pass only the private NodeHandle, as it is now, but create all publishers from the private namespace, which will result in: /robot_1/fiducial_slam/fiducial_map

What is the preferable way in your opinion?
Thank you in advance.
Ivan

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

No branches or pull requests

1 participant