tum-vision / tum_ardrone

Repository for the tum_ardrone ROS package, implementing autonomous flight with PTAM-based visual navigation for the Parrot AR.Drone.
http://wiki.ros.org/tum_ardrone
GNU General Public License v3.0
226 stars 192 forks source link

Subscribing filter_state #71

Open Sriherams opened 8 years ago

Sriherams commented 8 years ago

How to subscribe the topic tum_ardrone/filter_state in a program?

What are the dependencies, header files that are need to be added with my program?

whatgit commented 8 years ago

This is from the code I wrote almost about 2-3 years ago, I'm not sure it still works with current version of things. For example, I subscribed to "ardrone/predictedPose" topic by the code below.

the header file (I'm not sure about the include section, I have more but I think only ros.h is relevant here)

#include "ros/ros.h"

std::string dronepose_channel;
ros::NodeHandle nh;  
ros::Subscriber subPose

In cpp file

dronepose_channel = nh.resolveName("ardrone/predictedPose");
subPose = nh.subscribe(dronepose_channel,10, &NodeGenerator::posCb, this);

I think the "posCb" is a callback function. I don't remember now