ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
The callback function for subscriber nodes are called on ros::spinOnce()
execution.
Modify your code like this:
//Initiate the ROS
ros::init(argc, argv, "waypoint_nav");
ros::NodeHandle n;
velocity_publisher = n.advertise<geometry_msgs::Twist>("/cmd_vel", 10);
pose_subscriber = n.subscribe("/ardrone/navdata", 10, poseCallback);
while(ros::ok())
{
ros::spinOnce();
cout<<endl<<"Roll :"<<roll<<endl;
}