Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #include "ros/ros.h"
00008 #include "std_msgs/String.h"
00009
00010
00011 void chatterCallback(const std_msgs::String::ConstPtr& msg)
00012 {
00013 ROS_INFO("[Listener] I heard: [%s]\n", msg->data.c_str());
00014 }
00015
00016 int main(int argc, char **argv)
00017 {
00018
00019 ros::init(argc, argv, "listener_node");
00020
00021 ros::NodeHandle node;
00022
00023
00024
00025 ros::Subscriber sub = node.subscribe("chatter", 1000, chatterCallback);
00026
00027
00028 ros::spin();
00029
00030 return 0;
00031 }