Project: engagement_recognition License: BSD Dependencies:
Used by:
None |
engagement_recognition/src/recognition/states/state.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 _STATE_H 00035 #define _STATE_H 00036 00037 #include <ros/ros.h> 00038 #include <vector> 00039 #include <string> 00040 #include "../events/event_sink.h" 00041 00042 // Include the messages and the Actor and Robot classes 00043 #include "../lib/engagement_declarations.h" 00044 #include "../actors/actor.h" 00045 #include "../actors/robot.h" 00046 00047 class Actor; 00048 class Robot; 00049 00060 class State : public EventSink 00061 { 00062 protected: 00064 std::string name_; 00065 00067 std::string actor_; 00068 private: 00076 virtual Event received(std::string topic, engagement_msgs::ActorID *message); 00077 00085 virtual Event received(std::string topic, engagement_msgs::ActorIDStatus *message); 00086 00094 virtual Event received(std::string topic, engagement_msgs::Empty *message); 00095 00103 virtual Event received(std::string topic, bml_msgs::Entity *message); 00104 00112 virtual Event received(std::string topic, bml_msgs::Flag *message); 00113 00121 virtual Event received(std::string topic, 00122 engagement_msgs::HumanAdjacencyPair *message); 00123 00131 virtual Event received(std::string topic, 00132 engagement_msgs::HumanBackchannel *message); 00133 00141 virtual Event received(std::string topic, 00142 engagement_msgs::HumanDirectedGaze *message); 00143 00151 virtual Event received(std::string topic, 00152 engagement_msgs::HumanMutualFacialGaze *message); 00153 00161 virtual Event received(std::string topic, engagement_msgs::Performance *message); 00162 00170 virtual Event received(std::string topic, 00171 engagement_srvs::ActorStatistics::Request *message); 00172 00180 virtual Event received(std::string topic, 00181 engagement_srvs::RobotAdjacencyPair::Request *message); 00182 00190 virtual Event received(std::string topic, 00191 engagement_srvs::RobotDirectedGaze::Request *message); 00192 00200 virtual Event received(std::string topic, 00201 engagement_srvs::RobotMutualFacialGaze::Request *message); 00202 00210 virtual Event received(std::string topic, engagement_msgs::Speech *message); 00211 public: 00215 State(); 00216 00224 State(std::string name, std::string actor, EventSink *sink); 00225 00229 virtual ~State(); 00230 00238 void castEvent(Event event); 00239 00247 bool compareAdditional(std::vector<std::string> additional, 00248 std::string compare); 00249 00257 Event received(std::string topic, ros::Message *message); 00258 00264 Actor *getActor(); 00265 00271 const char *getName(); 00272 00274 #define STATE_SUBSCRIBE(h, t, c) h->subscribe(t, MAX_BUFFER, c, this) 00275 }; 00276 00277 #endif // _STATE_H |