Advertisement
130s

Code_Q2_Client_11Oct20

Oct 20th, 2011
1,246
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "ros/ros.h"
  2. #include "geometry_msgs/Point.h"
  3. #include "server_msgs/Swarm.h"
  4.  
  5. using namespace std;
  6.  
  7. void chatterCallback(const server_msgs::Swarm::ConstPtr& msg) {
  8. // ROS_INFO("I heard: [%s]", msg->crowds.size());
  9. cout << "Size of crowd: " << msg->crowds.size() << endl;
  10. }
  11.  
  12. int main(int argc, char **argv) {
  13. ros::init(argc, argv, "clientNode");
  14. ros::NodeHandle n;
  15. std::string topicName = "server_msgs/Swarm";
  16. ros::Subscriber sub = n.subscribe(topicName, 1000, chatterCallback);
  17. ros::spin();
  18. return 0;
  19. }
  20.  
  21.  
Advertisement
RAW Paste Data Copied
Advertisement