-
Notifications
You must be signed in to change notification settings - Fork 279
/
recognize_posture.py
40 lines (29 loc) · 1.29 KB
/
recognize_posture.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'''In this exercise you need to use the learned classifier to recognize current posture of robot
* Tasks:
1. load learned classifier in `PostureRecognitionAgent.__init__`
2. recognize current posture in `PostureRecognitionAgent.recognize_posture`
* Hints:
Let the robot execute different keyframes, and recognize these postures.
'''
from angle_interpolation import AngleInterpolationAgent
from keyframes import hello
class PostureRecognitionAgent(AngleInterpolationAgent):
def __init__(self, simspark_ip='localhost',
simspark_port=3100,
teamname='DAInamite',
player_id=0,
sync_mode=True):
super(PostureRecognitionAgent, self).__init__(simspark_ip, simspark_port, teamname, player_id, sync_mode)
self.posture = 'unknown'
self.posture_classifier = None # LOAD YOUR CLASSIFIER
def think(self, perception):
self.posture = self.recognize_posture(perception)
return super(PostureRecognitionAgent, self).think(perception)
def recognize_posture(self, perception):
posture = 'unknown'
# YOUR CODE HERE
return posture
if __name__ == '__main__':
agent = PostureRecognitionAgent()
agent.keyframes = hello() # CHANGE DIFFERENT KEYFRAMES
agent.run()