Revision 70c54617 client/python/hlrc_client/RobotEmotion.py
client/python/hlrc_client/RobotEmotion.py | ||
---|---|---|
37 | 37 |
FEAR = 5 |
38 | 38 |
|
39 | 39 |
def __init__(self, emotion = NEUTRAL): |
40 |
self.value = emotion |
|
41 |
self.time_ms = 1000 |
|
42 |
|
|
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): |
|
60 |
return "RobotEmotion = { value='%s', time_ms=%d }" % (self.value_as_str(), self.time_ms) |
|
61 |
|
|
40 |
self.value = emotion |
|
41 |
self.time_ms = 1000 |
|
42 |
|
|
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): |
|
60 |
return "RobotEmotion = { value='%s', time_ms=%d }" % (self.value_as_str(), self.time_ms) |
Also available in: Unified diff