ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You can easily do that by creating multiple subscribers or a vector of subscribers and make all of them point at same callback function.
2 | No.2 Revision |
You can easily do that by creating multiple subscribers or a vector of subscribers and make all of them point at same callback function.
sicklms_subs = new ros::Subscriber[no_of_ugv];
for(int i = 0; i < no_of_ugv; i++)
{
ss.seekp(0);
ss << "/sicklms" << i << "/scan";
sicklms_subs[i] = nh.subscribe(ss.str(), 100, &mapper_direct::laserCallback, this);
}
3 | highlighting |
You can easily do that by creating multiple subscribers or a vector of subscribers and make all of them point at same callback function.
sicklms_subs = new ros::Subscriber[no_of_ugv];
for(int i = 0; i < no_of_ugv; i++)
{
ss.seekp(0);
ss << "/sicklms" << i << "/scan";
sicklms_subs[i] = nh.subscribe(ss.str(), 100, &mapper_direct::laserCallback, this);
}