Revision 3877047d client/python/hlrc_client/RobotEmotion.py
client/python/hlrc_client/RobotEmotion.py | ||
---|---|---|
26 | 26 |
""" |
27 | 27 |
|
28 | 28 |
class RobotEmotion: |
29 |
TYPE_DEFAULT = 0
|
|
30 |
TYPE_CURRENT = 1
|
|
31 |
|
|
32 |
NEUTRAL = 0
|
|
33 |
HAPPY = 1
|
|
34 |
SAD = 2
|
|
35 |
ANGRY = 3
|
|
36 |
SURPRISED = 4
|
|
37 |
FEAR = 5
|
|
38 |
|
|
39 |
def __init__(self, emotion = NEUTRAL):
|
|
40 |
self.value = emotion
|
|
41 |
self.time_ms = 1000
|
|
29 |
TYPE_DEFAULT = 0
|
|
30 |
TYPE_CURRENT = 1
|
|
31 |
|
|
32 |
NEUTRAL = 0
|
|
33 |
HAPPY = 1
|
|
34 |
SAD = 2
|
|
35 |
ANGRY = 3
|
|
36 |
SURPRISED = 4
|
|
37 |
FEAR = 5
|
|
38 |
|
|
39 |
def __init__(self, emotion = NEUTRAL):
|
|
40 |
self.value = emotion |
|
41 |
self.time_ms = 1000 |
|
42 | 42 |
|
43 | 43 |
def value_as_str(self): |
44 |
if (self.value == RobotEmotion.NEUTRAL):
|
|
45 |
return "neutral"
|
|
46 |
elif (self.value == RobotEmotion.HAPPY):
|
|
47 |
return "happy"
|
|
48 |
elif (self.value == RobotEmotion.SAD):
|
|
49 |
return "sad"
|
|
50 |
elif (self.value == RobotEmotion.ANGRY):
|
|
51 |
return "angry"
|
|
52 |
elif (self.value == RobotEmotion.SURPRISED):
|
|
53 |
return "surprised"
|
|
54 |
elif (self.value == RobotEmotion.FEAR):
|
|
55 |
return "fear"
|
|
56 |
else:
|
|
57 |
return "INVALID EMOTION TYPE"
|
|
58 |
|
|
59 |
def __str__(self): |
|
44 |
if (self.value == RobotEmotion.NEUTRAL):
|
|
45 |
return "neutral" |
|
46 |
elif (self.value == RobotEmotion.HAPPY):
|
|
47 |
return "happy" |
|
48 |
elif (self.value == RobotEmotion.SAD):
|
|
49 |
return "sad" |
|
50 |
elif (self.value == RobotEmotion.ANGRY):
|
|
51 |
return "angry" |
|
52 |
elif (self.value == RobotEmotion.SURPRISED):
|
|
53 |
return "surprised" |
|
54 |
elif (self.value == RobotEmotion.FEAR):
|
|
55 |
return "fear" |
|
56 |
else:
|
|
57 |
return "INVALID EMOTION TYPE" |
|
58 |
|
|
59 |
def __str__(self):
|
|
60 | 60 |
return "RobotEmotion = { value='%s', time_ms=%d }" % (self.value_as_str(), self.time_ms) |
61 | 61 |
|
Also available in: Unified diff