Created
July 17, 2018 18:01
-
-
Save tutorgaming/e10c4899eef4b067f6c2a7d502023f4c to your computer and use it in GitHub Desktop.
chatter_subscriber_tutorial - Subscriber
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "ros/ros.h" | |
#include "std_msgs/String.h" | |
void chatterCallback(const std_msgs::String::ConstPtr& msg) | |
{ | |
ROS_INFO("I heard: [%s]", msg->data.c_str()); | |
} | |
int main(int argc, char **argv) | |
{ | |
ros::init(argc, argv, "listener"); | |
ros::NodeHandle n; | |
ros::Subscriber sub = n.subscribe("chatter", 1000, chatterCallback); | |
ros::spin(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment