ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 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;
}