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/Vocab.h>
14 
15 #include <yarp/os/Bottle.h>
16 
17 namespace iCub {
18  namespace contrib {
19  class IEmotionInterface;
20  }
21 }
22 
28 {
29 public:
30 
31  virtual ~IEmotionInterface(){}
32 
33  virtual bool setEyelids(const std::string s)=0;
34  virtual bool setMouth(const std::string s)=0;
35  virtual bool setLeftEyebrow(const std::string s)=0;
36  virtual bool setRightEyebrow(const std::string s)=0;
37  virtual bool setAll(const std::string s)=0;
38  virtual bool setRaw(const std::string s)=0;
39 
40 };
41 
42 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_SET = yarp::os::createVocab32('s','e','t');
43 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_GET = yarp::os::createVocab32('g','e','t');
44 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_IS = yarp::os::createVocab32('i','s');
45 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_FAILED = yarp::os::createVocab32('f','a','i','l');
46 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_OK = yarp::os::createVocab32('o','k');
47 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_HELP = yarp::os::createVocab32('h','e','l','p');
48 
49 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_MOUTH = yarp::os::createVocab32('m','o','u');
50 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_EYELIDS = yarp::os::createVocab32('e','l','i');
51 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_LEFTEYEBROW = yarp::os::createVocab32('l','e','b');
52 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_RIGHTEYEBROW = yarp::os::createVocab32('r','e','b');
53 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_ALL = yarp::os::createVocab32('a','l','l');
54 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_RAW = yarp::os::createVocab32('r','a','w');
55 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_COLOR = yarp::os::createVocab32('c','o','l');
56 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_BRIG = yarp::os::createVocab32('b','r','i','g');
57 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_MASK = yarp::os::createVocab32('m','a','s','k');
58 
59 
60 
61 inline bool EMOTION_CHECK_FAIL(bool ok, yarp::os::Bottle& response) {
62  if (ok) {
63  if (response.get(0).isVocab32() && response.get(0).asVocab32() == EMOTION_VOCAB_FAILED) {
64  return false;
65  }
66  }
67  else
68  return false;
69 
70  return true;
71 }
72 
73 #endif
74 
75 
Interface for the Facial Expressions.
virtual bool setLeftEyebrow(const std::string s)=0
virtual bool setEyelids(const std::string s)=0
virtual bool setRightEyebrow(const std::string s)=0
virtual bool setAll(const std::string s)=0
virtual bool setMouth(const std::string s)=0
virtual bool setRaw(const std::string s)=0
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_BRIG
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_FAILED
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_SET
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_ALL
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_EYELIDS
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_RIGHTEYEBROW
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_GET
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_LEFTEYEBROW
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_MASK
bool EMOTION_CHECK_FAIL(bool ok, yarp::os::Bottle &response)
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_COLOR
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_OK
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_MOUTH
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_IS
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_HELP
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_RAW
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.