Open ZhiangChen opened 6 years ago
Another solution is to assign the robot name as an argument when launching the amcl node, and the argument will be used for the node name:
if (argc < 2) {
ROS_ERROR("You must specify robot id.");
return -1;
}
char *id = argv[1];
robot_id = atoi(id);
string node_name = "amcl";
node_name += id;
cout << node_name;
ros::init(argc, argv, node_name);
ros::NodeHandle nh;
In the launch file:
<node name="amcl0" pkg="navigation" type="amcl" args="0" output="screen"/>
In the robots/launch/amcl.launch, group in roslaunch failed to generate transforms from /map to $(arg robot_name)/odom. Two different amcl nodes are specialized for each robot. group should have solved the amcl instance problem, but I didn't dig too much.