papillon/src/control.cpp
2016-06-15 01:06:55 +02:00

44 lines
828 B
C++

#include "ros/ros.h"
#include <papillon/BoundingBox.h>
#include <geometry_msgs/Twist.h>
#include <opencv/cv.h>
#include <sstream>
using namespace std;
class Drone_control {
public:
cv::Rect objectBoundingRectangle = cv::Rect(0,0,0,0);
ros::NodeHandle n;
ros::Publisher pub_cmd;
ros::Subscriber sub_box;
Drone_control() : n("~") {
pub_cmd = n.advertise<geometry_msgs::Twist>("/bebop/cmd_vel", 1);
sub_box = n.subscribe<papillon::BoundingBox>("/papillon/bbox", 1, &Drone_control::on_msg, this);
ROS_INFO("Built !");
}
// This processes an image and publishes the result.
void on_msg(const papillon::BoundingBox::ConstPtr& bbox) {
ROS_INFO("plop");
}
};
int main(int argc, char **argv)
{
ros::init(argc, argv, "control");
Drone_control con=Drone_control();
ros::spin();
return 0;
}