ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I was able to do it following these steps:
1) Added to the manifest file the dependency:
<depend package="ardrone_autonomy" />
2) Fixed the code in the following way:
#include <ros/ros.h>
#include "std_msgs/Int32.h"
#include "std_msgs/Float32.h"
#include "ardrone_autonomy/Navdata.h"
using namespace std;
ardrone_autonomy::Navdata msg_in;
float drone_altd;
void heightControl(const ardrone_autonomy::Navdata& msg_in)
{
drone_altd=msg_in.altd;
cout << drone_altd << endl;
}
int main(int argc, char **argv)
{
ros::init(argc,argv,"Altitude_Control");
ros::NodeHandle n;
ros::Subscriber sub = n.subscribe("/ardrone/navdata", 1, heightControl);
ros::spin();
return 0;
}
I hope this helps.