$search
00001 00002 /*************************************************************************** 00003 * subscriber.cpp - Example: Node monitoring state subscriber 00004 * 00005 * Created: Fri Apr 08 12:16:30 2011 00006 * Copyright 2011 Tim Niemueller [www.niemueller.de] 00007 * 2011 SRI International 00008 * 2011 Carnegie Mellon University 00009 * 2011 Intel Labs Pittsburgh 00010 * 2011 Columbia University in the City of New York 00011 * 00012 ****************************************************************************/ 00013 00014 /* This program is free software; you can redistribute it and/or modify 00015 * it under the terms of the 3-clase BSD License. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU Library General Public License for more details. 00021 * 00022 * Read the full text in the LICENSE file in the root directory. 00023 */ 00024 00025 #include <ros/ros.h> 00026 #include <nodemon_msgs/NodeState.h> 00027 00028 #include <cstdio> 00029 00030 void node_state_cb(const nodemon_msgs::NodeState::ConstPtr &msg) 00031 { 00032 printf("."); 00033 fflush(stdout); 00034 } 00035 00036 int 00037 main(int argc, char **argv) 00038 { 00039 ros::init(argc, argv, "nodemon_subex"); 00040 ros::NodeHandle n; 00041 00042 ros::Subscriber sub = n.subscribe("/nodemon/state", 10, node_state_cb); 00043 00044 ros::spin(); 00045 printf("\n"); 00046 }