title: ROS: Subscribe to the same callback and same topic (with different index) assign to correspondig variables
body: <p>I have 10 robots in stage ROS and want to subscribe the topic of position <code>/base_pose_ground_truth</code>. It means I must subscribe to <code>robot0_base_pose_ground_truth</code>, <code>robot1_base_pose_ground_truth</code>, .... </p>
  
  <p>The first solution coming to mind is:</p>
  
  <pre><code>for(int i=0; i&lt;RobotNumber; i++) {                  
    char str[30] = "/robot_";
    char index[4];
    sprintf(index, "%d", i);
    strcat(str, index);
    strcat(str, "/base_pose_ground_truth");
    GoalPos_sub[i] = Node.subscribe(str, 100, GetPos_callback);           
  }   
  </code></pre>
  
  <p>and the callback could be:</p>
  
  <pre><code>void GetPos_callback(const nav_msgs::Odometry::ConstPtr&amp; msg) {
    Goalpose[0] = msg-&gt;pose.pose.position.x;
    Goalpose[1] = msg-&gt;pose.pose.position.y;
  }
  </code></pre>
  
  <p>But this will not give me 10 different position corresponding to each robot. I don't know how I can put the position of each robot in its corresponding memory (for example array or vector). It might be possible by passing the robot index as an argument to the callback and try to use it for assigning the position topic to an array.</p>
  
  <p>I will be thankful if some one help me in this issue.</p>