fiducials
fiducials copied to clipboard
All topics in root / namespace, difficult for multirobot environment
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:
- 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
- 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