ardrone navdata callBack error
In my program after subscribing navdata using callBack function, the values returning as zero. The values inside the callBack is giving the actual rot.Z data, but after exiting the function the value 'roll' returned as 0.
//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);
cout<<endl<<"Roll :"<<roll<<endl;
ros::spinOnce();
}
void poseCallback(const ardrone_autonomy::Navdata::ConstPtr & pose_message )
{
roll= pose_message->rotX;
cout<<"navdata x"<<roll<<endl;
}