ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
You could do something like this:
ros::Subscriber pos_sub_uav1 = nh.subscribe<geometry_mgs::PoseStamped>("uav1/mavros/local_position/pose", 10, boost::bind(&follow, _1, "uav1"));
ros::Subscriber pos_sub_uav1 = nh.subscribe<geometry_mgs::PoseStamped>("uav1/mavros/local_position/pose", 10, boost::bind(&follow, _1, "uav2"));
...
void follow(const geometry_msgs::PoseStamped::ConstPtr& msg, const std::string &uav) { }
You might also want to just use a time sychronizer.
2 | No.2 Revision |
You could do something like this:
ros::Subscriber pos_sub_uav1 = nh.subscribe<geometry_mgs::PoseStamped>("uav1/mavros/local_position/pose", 10, boost::bind(&follow, _1, "uav1"));
ros::Subscriber pos_sub_uav1 pos_sub_uav2 = nh.subscribe<geometry_mgs::PoseStamped>("uav1/mavros/local_position/pose", nh.subscribe<geometry_mgs::PoseStamped>("uav2/mavros/local_position/pose", 10, boost::bind(&follow, _1, "uav2"));
...
void follow(const geometry_msgs::PoseStamped::ConstPtr& msg, const std::string &uav) { }
You might also want to just use a time sychronizer.