hlrc / client / python / hlrc_client / RobotAnimation.py @ master
History | View | Annotate | Download (2.162 KB)
1 | 0c286af0 | Simon Schulz | """
|
---|---|---|---|
2 | This file is part of hlrc
|
||
3 |
|
||
4 | Copyright(c) sschulz <AT> techfak.uni-bielefeld.de
|
||
5 | http://opensource.cit-ec.de/projects/hlrc
|
||
6 |
|
||
7 | This file may be licensed under the terms of the
|
||
8 | GNU General Public License Version 3 (the ``GPL''),
|
||
9 | or (at your option) any later version.
|
||
10 |
|
||
11 | Software distributed under the License is distributed
|
||
12 | on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
|
||
13 | express or implied. See the GPL for the specific language
|
||
14 | governing rights and limitations.
|
||
15 |
|
||
16 | You should have received a copy of the GPL along with this
|
||
17 | program. If not, go to http://www.gnu.org/licenses/gpl.html
|
||
18 | or write to the Free Software Foundation, Inc.,
|
||
19 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
20 |
|
||
21 | The development of this software was supported by the
|
||
22 | Excellence Cluster EXC 277 Cognitive Interaction Technology.
|
||
23 | The Excellence Cluster EXC 277 is a grant of the Deutsche
|
||
24 | Forschungsgemeinschaft (DFG) in the context of the German
|
||
25 | Excellence Initiative.
|
||
26 | """
|
||
27 | |||
28 | class RobotAnimation: |
||
29 | 3877047d | Simon Schulz | IDLE = 0
|
30 | HEAD_NOD = 1
|
||
31 | HEAD_SHAKE = 2
|
||
32 | EYEBLINK_L = 3
|
||
33 | EYEBLINK_R = 4
|
||
34 | EYEBLINK_BOTH = 5
|
||
35 | EYEBROWS_RAISE = 6
|
||
36 | EYEBROWS_LOWER = 7
|
||
37 | 0c286af0 | Simon Schulz | |
38 | 3877047d | Simon Schulz | def __init__(self, v = IDLE): |
39 | 70c54617 | Simon Schulz | self.value = v
|
40 | self.time_ms = 1000 |
||
41 | self.repetitions = 1 |
||
42 | self.scale = 1.0 |
||
43 | 0c286af0 | Simon Schulz | |
44 | 70c54617 | Simon Schulz | def value_as_str(self): |
45 | if (self.value == RobotAnimation.IDLE): |
||
46 | return "idle" |
||
47 | elif (self.value == RobotAnimation.HEAD_NOD): |
||
48 | return "head nod" |
||
49 | elif (self.value == RobotAnimation.HEAD_SHAKE): |
||
50 | return "head shake" |
||
51 | elif (self.value == RobotAnimation.EYEBLINK_L): |
||
52 | return "eyeblink l" |
||
53 | elif (self.value == RobotAnimation.EYEBLINK_R): |
||
54 | return "eyeblink r" |
||
55 | elif (self.value == RobotAnimation.EYEBROWS_RAISE): |
||
56 | return "eyebrows raise" |
||
57 | elif (self.value == RobotAnimation.EYEBROWS_LOWER): |
||
58 | return "eyebrows lower" |
||
59 | else:
|
||
60 | return "INVALID ANIMATION TYPE" |
||
61 | 0c286af0 | Simon Schulz | |
62 | 70c54617 | Simon Schulz | def __str__(self): |
63 | return "RobotAnimation = { value='%s', time_ms=%d repetitions=%d scale=%6.2f }" % \ |
||
64 | (self.value_as_str(), self.time_ms, self.repetitions, self.scale) |