ScavTaskColorShirt.h
Go to the documentation of this file.
00001 
00002 #ifndef SCAVTASKCOLORSHIRT_H
00003 #define SCAVTASKCOLORSHIRT_H
00004 
00005 #include <ros/ros.h>
00006 #include <ros/package.h>
00007 // #include <opencv2/improc/improc.hpp>
00008 #include <opencv2/highgui/highgui.hpp>
00009 #include <cv_bridge/cv_bridge.h>
00010 #include <image_transport/image_transport.h>
00011 #include <sensor_msgs/image_encodings.h>
00012 #include <pcl_ros/point_cloud.h>
00013 #include <pcl/point_types.h>
00014 #include <string>
00015 #include <boost/thread.hpp>
00016 #include <boost/bind.hpp>
00017 
00018 #include "ScavTask.h"
00019 #include "SearchPlanner.h"
00020 
00021 typedef pcl::PointCloud<pcl::PointXYZRGB> PointCloud;
00022 
00023 enum Color{ RED, GREEN, BLUE, YELLOW, ORANGE, COLOR_LENGTH}; 
00024 
00025 struct Rgb {
00026     float r; float g; float b;        
00027     Rgb() : r(), g(), b() {}
00028     Rgb( float rr, float gg, float bb ) : r(rr), g(gg), b(bb) {}
00029 };
00030 
00031 class ScavTaskColorShirt : public ScavTask {
00032 
00033 public:
00034  
00035     ScavTaskColorShirt(); 
00036 
00037     ScavTaskColorShirt(ros::NodeHandle *node_handle, std::string path_of_dir, Color shirt_color); 
00038 
00039     void executeTask(int timeout, TaskResult &result, std::string &record); 
00040     void stopEarly(); 
00041     void visionThread();
00042     void motionThread(); 
00043 
00044     SearchPlannerSimple *search_planner_simple; 
00045 
00046     Color color; 
00047     std::string directory; 
00048     bool task_completed; 
00049 
00050     void callback_image_saver(const sensor_msgs::ImageConstPtr& msg); 
00051     void callback_human_detection(const PointCloud::ConstPtr& msg); 
00052 
00053     // to compute the distance between a Rgb struct and a PCL RGB
00054     float getColorDistance(const pcl::PointXYZRGB *c1, const Rgb *c2) 
00055     {
00056         return pow(pow(c1->r- c2->r, 2.0) + pow(c1->g - c2->g, 2.0) + pow(c1->b - c2->b, 2.0), 0.5);
00057     }
00058 
00059 }; 
00060 
00061 #endif


bwi_scavenger
Author(s): Shiqi Zhang
autogenerated on Thu Jun 6 2019 17:57:53