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::createVocab('s','e','t');
43 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_GET = yarp::os::createVocab('g','e','t');
44 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_IS = yarp::os::createVocab('i','s');
45 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_FAILED = yarp::os::createVocab('f','a','i','l');
46 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_OK = yarp::os::createVocab('o','k');
47 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_HELP = yarp::os::createVocab('h','e','l','p');
48 
49 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_MOUTH = yarp::os::createVocab('m','o','u');
50 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_EYELIDS = yarp::os::createVocab('e','l','i');
51 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_LEFTEYEBROW = yarp::os::createVocab('l','e','b');
52 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_RIGHTEYEBROW = yarp::os::createVocab('r','e','b');
53 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_ALL = yarp::os::createVocab('a','l','l');
54 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_RAW = yarp::os::createVocab('r','a','w');
55 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_COLOR = yarp::os::createVocab('c','o','l');
56 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_BRIG = yarp::os::createVocab('b','r','i','g');
57 constexpr yarp::conf::vocab32_t EMOTION_VOCAB_MASK = yarp::os::createVocab('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).isVocab() && response.get(0).asVocab() == EMOTION_VOCAB_FAILED) {
64  return false;
65  }
66  }
67  else
68  return false;
69 
70  return true;
71 }
72 
73 #endif
74 
75 
iCub::contrib::IEmotionInterface::setLeftEyebrow
virtual bool setLeftEyebrow(const std::string s)=0
iCub
This file contains the definition of unique IDs for the body parts and the skin parts of the robot.
Definition: emotionInterface.h:17
EMOTION_CHECK_FAIL
bool EMOTION_CHECK_FAIL(bool ok, yarp::os::Bottle &response)
Definition: emotionInterface.h:61
iCub::contrib::IEmotionInterface::setRaw
virtual bool setRaw(const std::string s)=0
EMOTION_VOCAB_IS
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_IS
Definition: emotionInterface.h:44
iCub::contrib::IEmotionInterface::setMouth
virtual bool setMouth(const std::string s)=0
EMOTION_VOCAB_EYELIDS
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_EYELIDS
Definition: emotionInterface.h:50
EMOTION_VOCAB_COLOR
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_COLOR
Definition: emotionInterface.h:55
iCub::contrib::IEmotionInterface::~IEmotionInterface
virtual ~IEmotionInterface()
Definition: emotionInterface.h:31
EMOTION_VOCAB_HELP
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_HELP
Definition: emotionInterface.h:47
iCub::contrib::IEmotionInterface::setRightEyebrow
virtual bool setRightEyebrow(const std::string s)=0
EMOTION_VOCAB_RIGHTEYEBROW
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_RIGHTEYEBROW
Definition: emotionInterface.h:52
EMOTION_VOCAB_LEFTEYEBROW
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_LEFTEYEBROW
Definition: emotionInterface.h:51
EMOTION_VOCAB_SET
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_SET
Definition: emotionInterface.h:42
EMOTION_VOCAB_FAILED
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_FAILED
Definition: emotionInterface.h:45
iCub::contrib::IEmotionInterface::setEyelids
virtual bool setEyelids(const std::string s)=0
EMOTION_VOCAB_OK
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_OK
Definition: emotionInterface.h:46
EMOTION_VOCAB_MASK
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_MASK
Definition: emotionInterface.h:57
EMOTION_VOCAB_GET
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_GET
Definition: emotionInterface.h:43
state::ok
@ ok
iCub::contrib::IEmotionInterface
Interface for the Facial Expressions.
Definition: emotionInterface.h:27
string
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") include_directories($
Definition: CMakeLists.txt:9
EMOTION_VOCAB_ALL
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_ALL
Definition: emotionInterface.h:53
iCub::contrib::IEmotionInterface::setAll
virtual bool setAll(const std::string s)=0
EMOTION_VOCAB_MOUTH
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_MOUTH
Definition: emotionInterface.h:49
EMOTION_VOCAB_RAW
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_RAW
Definition: emotionInterface.h:54
EMOTION_VOCAB_BRIG
constexpr yarp::conf::vocab32_t EMOTION_VOCAB_BRIG
Definition: emotionInterface.h:56