diff --git a/CMakeLists.txt b/CMakeLists.txt index 33f993b..85a9c62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ catkin_package(CATKIN_DEPENDS include_directories (${catkin_INCLUDE_DIRS}) add_executable (papillon src/papillon.cpp) +add_executable (control src/control.cpp) target_link_libraries(papillon ${catkin_LIBRARIES}) set_property (TARGET papillon APPEND PROPERTY INCLUDE_DIRECTORIES ${OpenCV_INCLUDE_DIRS}) set_property (TARGET papillon APPEND PROPERTY INCLUDE_DIRECTORIES ${catkin_INCLUDE_DIRS}) diff --git a/src/control.cpp b/src/control.cpp new file mode 100644 index 0000000..f33d3ce --- /dev/null +++ b/src/control.cpp @@ -0,0 +1,42 @@ +#include "ros/ros.h" +#include +#include + +#include + +#include + +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("/bebop/cmd_vel", 1); + sub_box = n.subscribe("/papillon/bbox", 1, &Drone_control::on_msg, this); + } + + + // 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; +} +