130s

subscribeDelay_listener_C++_11Nov1

Nov 1st, 2011
131
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using namespace std;
  2. ros::Publisher marker_pub;
  3. int cwdNum = 0;
  4. int iterated = 0;
  5. void cwdAllocListnerCallback(const cwdnav_common::Swarm::ConstPtr& msg) {
  6. cwdNum = 0;
  7. ros::Rate r(30)
  8. for (int i = 0; i < msg->cwds.size(); i++) {
  9. cwdnav_common::CwdElement p = msg->cwds[i];
  10. std::cout << p.header.stamp << " ," << p.position.x << " ," << p.position.y << std::endl; // <--- Print here is compared.
  11. }
  12. }
  13.  
  14. void initROS() {
  15. ros::NodeHandle n;
  16. ros::Subscriber sub = n.subscribe(CwdSensorInteraction::TOPICNAME_SWM, 10,
  17. cwdAllocListnerCallback);
  18. marker_pub = n.advertise<visualization_msgs::Marker>("visualization_marker", 1);
  19. ros::spin();
  20. }
  21.  
  22. int main(int argc, char **argv) {
  23. ros::init(argc, argv, "CwdSensor");
  24. initROS();
  25. return 0;
  26. }
RAW Paste Data