3 #include "../header/Aa_faceDetection.h"
12 detectedFaceConsec = 0;
14 this->pubPlat = pubPlat;
23 void Aa_faceDetection::subImgDetectCallbackRight(
const opencv_apps::FaceArrayStamped &msgFacesRight){
25 look_caresses_pkg::platform_control msgVel;
27 if (msgFacesRight.faces.empty()) {
30 msgVel.body_vel.angular.z = 0.1;
31 detectedFaceConsec = 0;
35 msgVel.body_vel.angular.z = 0.2;
36 detectedFaceConsec = 0;
42 msgVel.body_vel.angular.z = 0;
47 msgVel.body_vel.angular.z = -0.1;
48 detectedFaceConsec = 0;
52 pubPlat.publish(msgVel);
60 void Aa_faceDetection::subImgDetectCallbackLeft(
const opencv_apps::FaceArrayStamped &msgFacesLeft){
62 if (msgFacesLeft.faces.empty()) {
79 detectedFaceConsec = 0;
81 ROS_INFO(
"[Aa] Started");
84 ros::Rate loop_rate(10);
85 while (detectedFaceConsec <= 15){
90 look_caresses_pkg::platform_control plat_msgs_saw;
91 ros::Rate loop_rate2(1);
92 for (
int i =0; i<5; i++){
93 plat_msgs_saw.sound_index_P2 = rand()%20;
94 pubPlat.publish(plat_msgs_saw);
99 ROS_INFO(
"[Aa] I saw you consecutevely for 1.5 seconds");
102 ROS_INFO(
"[Aa] Finished");
109 void Aa_faceDetection::subTopics(){
111 subImageDetectRight = nh.subscribe(
"/right/face_detection/faces", 1000, &Aa_faceDetection::subImgDetectCallbackRight,
this);
112 subImageDetectLeft = nh.subscribe(
"/left/face_detection/faces", 1000, &Aa_faceDetection::subImgDetectCallbackLeft,
this);
120 void Aa_faceDetection::unsubTopics(){
121 subImageDetectRight.shutdown();
122 subImageDetectLeft.shutdown();
int main()
The main for face detection task. It make MiRo turns around z axis until a face is visible in both ca...
Aa_faceDetection(ros::NodeHandle nh, ros::Publisher pubPlat)
Costructor for phase Aa task.