Project: engagement_recognition License: BSD Dependencies:
Used by:
None |
engagement_recognition/src/recognition/actors/actor.hGo to the documentation of this file.00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2010, Worcester Polytechnic Institute 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of Worcester Polytechnic Institute. nor the names 00018 * of its contributors may be used to endorse or promote products 00019 * derived from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 */ 00034 #ifndef _ACTOR_H 00035 #define _ACTOR_H 00036 00037 // Include vectors, strings and the handler object 00038 #include <vector> 00039 #include <string> 00040 #include "../handlers/handler.h" 00041 #include "../lib/engagement_declarations.h" 00042 #include "../logger/loggable.h" 00043 #include "../semaphores/semaphore.h" 00044 00045 // Include the service responses 00046 #include "../response/service_response.h" 00047 #include "../response/ap_service_response.h" 00048 00049 // Include the timeline class 00050 #include "../statistics/timeline.h" 00051 00052 class Handler; 00053 00061 class Actor : public Loggable 00062 { 00063 private: 00065 ConsoleLogger *logger_; 00066 00068 Semaphore *semaphore_; 00069 00071 bool engaged_; 00072 00074 std::string id_; 00075 00077 bool facial_gaze_; 00078 00080 bool speaking_; 00081 00083 std::vector<std::string> looking_; 00084 00086 std::vector<std::string> pointing_; 00087 00089 Handler *handler_; 00090 00092 Timeline *statistics_; 00093 00097 void createSemaphores(); 00098 public: 00102 ~Actor(); 00103 00107 Actor(); 00108 00114 Actor(std::string id); 00115 00122 void received(std::string topic, ros::Message *message); 00123 00132 void updateDirGazeRecognizers(std::vector<std::string> objects); 00133 00141 ServiceResponse dirGazeService(ros::Message *message, 00142 std::vector<std::string> objects); 00143 00150 ServiceResponse mfGazeService(ros::Message *message); 00151 00158 APServiceResponse adjPairService(ros::Message *message); 00159 00165 void setHandler(Handler *handler); 00166 00172 Handler *getHandler(); 00173 00179 void setEngaged(bool engaged); 00180 00186 bool getEngaged(); 00187 00193 std::string getID(); 00194 00201 bool isFacialGaze(); 00202 00208 bool isSpeaking(); 00209 00220 bool isLooking(std::vector<std::string> objects); 00221 00232 bool isPointing(std::vector<std::string> objects); 00233 00239 std::vector<std::string> getLooking(); 00240 00246 std::vector<std::string> getPointing(); 00247 00255 bool setFacialGaze(bool start); 00256 00263 bool setSpeaking(bool start); 00264 00272 bool setLooking(std::vector<std::string> objects, bool start); 00273 00281 bool setPointing(std::vector<std::string> objects, bool start); 00282 00293 void addEvent(std::string type, bool success, unsigned long start, 00294 unsigned long delay, unsigned long duration, std::string data); 00295 00305 std::vector<unsigned long> getStatistics(); 00306 }; 00307 00308 #endif //_ACTOR_H |