ArDrone navdata reading error
I am trying to read navdata from ardrone using following callback function,
int state, battery;
void callBack(const ardrone_autonomy::Navdata::ConstPtr& msg) {
state = msg->state;
battery = msg->batteryPercent;
std::cout<<"State is: " << state << std::endl;
std::cout<<"battery is: " << battery;
}
But this is always returing 0 value, but when i echo navdata in linux terminal, these topics are publishing non-zero value. where is the error?
Edit: After some debugging i found that this callBack function is not being called at all. I wrote my subscriber node like this ros::Subscriber sub = ardrone.subscribe<ardrone_autonomy::Navdata>("/ardrone/navdata",1,callBack);
What is going wrong here?
Asked by Ameer Hamza Khan on 2015-11-01 05:33:57 UTC
Comments
are you doing a ros::spin() or ros::spin_once() in your main loop?
Asked by Gary Servin on 2015-11-01 11:22:53 UTC
@Gray Servin, yes that was missing. Thanks.
Asked by Ameer Hamza Khan on 2015-11-01 23:32:44 UTC