Go to the documentation of this file.00001
00011
00012
00013
00014
00015 #include "ros/ros.h"
00016 #include "std_msgs/String.h"
00017
00021
00022 void chatterCallback(const std_msgs::String::ConstPtr& msg)
00023 {
00024 ROS_INFO("I heard: [%s]", msg->data.c_str());
00025 }
00026
00027
00028 int main(int argc, char **argv)
00029 {
00040 ros::init(argc, argv, "listener");
00041
00047 ros::NodeHandle n;
00048
00064
00065 ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback);
00066
00067
00073
00074 ros::spin();
00075
00076
00077 return 0;
00078 }
00079