Cannot get ROS_INFO output in callback function [closed]
Hi, I'm new to ROS and I'm trying to subscribe to the pose of a moving turtle and print it out. I believe I subscribed to the right topic but there is no ouput for ROS_INFO in callback function. Anyone can help? Thanks.
#include <ros/ros.h>
#include <turtlesim/Pose.h>
void poseCallback(const turtlesim::PoseConstPtr& msg)
{
ROS_INFO("%f %f %f", msg->x, msg->y, msg->theta);
}
int main(int argc, char** argv)
{
ros::init(argc, argv, "hw1_turtle2_listener");
ros::NodeHandle node;
ros::Subscriber sub = node.subscribe("turtle2/pose", 10, &poseCallback);
ros::spin();
eturn 0;
};