iCub-main
emotionInterface.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 /*
4  * Copyright (C) 2007 Alex Bernardino
5  * CopyPolicy: Released under the terms of the GNU GPL v2.0.
6  *
7  */
8 
9 #ifndef __EMOTIONINTERFACE__
10 #define __EMOTIONINTERFACE__
11 
12 #include <string>
13 #include <yarp/os/Bottle.h>
14 
15 namespace iCub {
16  namespace contrib {
17  class IEmotionInterface;
18  }
19 }
20 
26 {
27 public:
28 
29  virtual ~IEmotionInterface(){}
30 
31  virtual bool setEyelids(const std::string s)=0;
32  virtual bool setMouth(const std::string s)=0;
33  virtual bool setLeftEyebrow(const std::string s)=0;
34  virtual bool setRightEyebrow(const std::string s)=0;
35  virtual bool setAll(const std::string s)=0;
36  virtual bool setRaw(const std::string s)=0;
37 
38 };
39 
40 #define EMOTION_VOCAB_SET yarp::os::createVocab('s','e','t')
41 #define EMOTION_VOCAB_GET yarp::os::createVocab('g','e','t')
42 #define EMOTION_VOCAB_IS yarp::os::createVocab('i','s')
43 #define EMOTION_VOCAB_FAILED yarp::os::createVocab('f','a','i','l')
44 #define EMOTION_VOCAB_OK yarp::os::createVocab('o','k')
45 
46 #define EMOTION_VOCAB_MOUTH yarp::os::createVocab('m','o','u')
47 #define EMOTION_VOCAB_EYELIDS yarp::os::createVocab('e','l','i')
48 #define EMOTION_VOCAB_LEFTEYEBROW yarp::os::createVocab('l','e','b')
49 #define EMOTION_VOCAB_RIGHTEYEBROW yarp::os::createVocab('r','e','b')
50 #define EMOTION_VOCAB_ALL yarp::os::createVocab('a','l','l')
51 #define EMOTION_VOCAB_RAW yarp::os::createVocab('r','a','w')
52 
53 
54 inline bool EMOTION_CHECK_FAIL(bool ok, yarp::os::Bottle& response) {
55  if (ok) {
56  if (response.get(0).isVocab() && response.get(0).asVocab() == EMOTION_VOCAB_FAILED) {
57  return false;
58  }
59  }
60  else
61  return false;
62 
63  return true;
64 }
65 
66 #endif
67 
68 
virtual bool setAll(const std::string s)=0
virtual bool setRightEyebrow(const std::string s)=0
virtual bool setRaw(const std::string s)=0
#define EMOTION_VOCAB_FAILED
virtual bool setMouth(const std::string s)=0
virtual bool setEyelids(const std::string s)=0
This file contains the definition of unique IDs for the body parts and the skin parts of the robot...
Interface for the Facial Expressions.
virtual bool setLeftEyebrow(const std::string s)=0
bool EMOTION_CHECK_FAIL(bool ok, yarp::os::Bottle &response)