Created
May 4, 2018 11:19
-
-
Save jdumont0201/e2ab5e198482ab72ea68bc2e4808a889 to your computer and use it in GitHub Desktop.
Minimal ROS 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/Int32> | |
void counterCallback(const std_msgs::Int32::ConstPtr& msg) | |
{ | |
ROS_INFO("%d", msg->data); | |
} | |
int main(int argc, char** argv) { | |
ros::init(argc, argv, "topic_subscriber"); | |
ros::NodeHandle nh; | |
ros::Subscriber sub = nh.subscribe("counter", 1000, counterCallback); | |
ros::spin(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment