Main Page · Modules · All Classes · Class Hierarchy
MAEmotions.hpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include <boost/unordered_map.hpp>
25 
26 #include "core/MANum.hpp"
27 #include "core/MASignal.hpp"
28 #include "MARobotStateUpdater.hpp"
29 
30 class MABehavior;
31 
37 namespace MA
38 {
40 typedef enum
41 {
42  Happy = 0,
43  Angry,
44  Sad,
45  Bored
46 } EmotionType;
47 
49 typedef std::pair<MAIntervalNum<int>*, MANum<int>*> EmotionVariablePair;
51 typedef boost::unordered_map<MA::EmotionType, MA::EmotionVariablePair> EmotionVariableList;
52 
54 typedef std::pair<MA::EmotionVariablePair, float> EmotionWeight;
56 typedef boost::unordered_map<MABehavior*, EmotionWeight> BehaviorEmotionList;
57 }
58 
63 {
64  MA_SLOT_CLASS
65 
67  MAEmotions();
68  void BindBehavior(MABehavior& behavior, MA::EmotionType emotion, float weight);
69 
70 private:
71  virtual void UpdateRobotState(MARobotState& state) override;
72  void BehaviorDeleted(MABehavior& behavior);
73 
74 public:
75  /*
76  * The happy emotion
77  * 0 - Not happy 100 - Happy
78  */
79  MANum<int> Happy;
80  /*
81  * The angry emotion
82  * 0 - Not angry 100 - Angry
83  */
84  MANum<int> Angry;
85  /*
86  * The sad emotion
87  * 0 - Not sad 100 - Sad
88  */
89  MANum<int> Sad;
90  /*
91  * The bored emotion
92  * 0 - Not bored 100 - Bored
93  */
94  MANum<int> Bored;
95 private:
97  MAIntervalNum<int> HappyFactor;
99  MAIntervalNum<int> AngryFactor;
101  MAIntervalNum<int> SadFactor;
103  MAIntervalNum<int> BoredFactor;
105  MA::EmotionVariableList EmotionVariables;
107  MA::BehaviorEmotionList BehaviorEmotions;
108 };
109 
MAIntervalNum< int > AngryFactor
Angry factor.
Definition: MAEmotions.hpp:99
MA::BehaviorEmotionList BehaviorEmotions
Behavior emotion list.
Definition: MAEmotions.hpp:107
Behavior base class.
Definition: MABehavior.hpp:157
MAIntervalNum< int > SadFactor
Sad factor.
Definition: MAEmotions.hpp:101
MAIntervalNum< int > BoredFactor
Bored factor.
Definition: MAEmotions.hpp:103
MA::EmotionVariableList EmotionVariables
Emotion variable list.
Definition: MAEmotions.hpp:105
Robot state updater base class.
MAIntervalNum< int > HappyFactor
Happy factor.
Definition: MAEmotions.hpp:97
State indicators.
Definition: MAEmotions.hpp:62
Robot state.