For this assignment we wanted to make one hand follow the other. The goal is to create a system in which one hand is the “master” and the other is the “student,” such that the student attempts to copy the master until it is able to achieve the same movement as the master with stability and success.

To make the movement appear more organic, we added random noise to one of the arms. We also increased frequency and reduced damping ratio to give the appearance of more erratic movement. Combined, these effects created a “stable” arm and an “unstable” arm. Reducing the noise over multiple iterations created the effect of the student getting “better.”

The following is the modified code for the exercise:

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
###################
# In exercise4.py #
###################
def addRandomness(target, factor):
    noise = random.randint(-300, 300)
    return target + int(noise * (factor/100))
 
#################
# In ex4demo.py #
#################
def sequenceOne(self):
 
        self.write('1st down')
         
        self.send_cue('gains', 0.5, 1.0)       
        self.send_pose('reset')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead1')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead2')
        self.sleep_unless_stop(1)
 
        self.send_cue('gains', 0.6, 0.8)       
        self.sleep_unless_stop(1)
 
        self.send_pose('lead3')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead4')
        self.sleep_unless_stop(1)
 
        self.write("1st & 3")
        return
 
    def sequenceTwo(self):
 
        self.write("2nd down")
 
        self.send_cue('gains', 0.5, 1.0)       
        self.send_pose('reset')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead5')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead6')
        self.sleep_unless_stop(1)
 
        self.send_cue('gains', 0.6, 0.8)
        self.sleep_unless_stop(1)
 
        self.send_cue('lead7')
        self.sleep_unless_stop(1)
 
        self.send_cue('lead8')
        self.sleep_unless_stop(1)
 
        self.write("2nd & 2")
        return
 
    def sequenceThree(self):
 
        self.write("3rd down")
 
        self.send_cue('gains', 0.5, 1.0)       
        self.send_pose('reset')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead9')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead10')
        self.sleep_unless_stop(1)
 
        self.send_cue('gains', 0.6, 0.8)       
        self.sleep_unless_stop(1)
 
        self.send_cue('lead11')
        self.sleep_unless_stop(1)
 
        self.send_cue('lead12')
        self.sleep_unless_stop(1)
 
        self.write("3rd & 1")
        return
 
    def sequenceFour(self):
 
        self.write("4th down")
 
        self.send_cue('gains', 0.5, 1.0)       
        self.send_pose('reset')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead13')
        self.sleep_unless_stop(1)
 
        self.send_pose('lead14')
        self.sleep_unless_stop(1)
 
        self.send_cue('gains', 0.6, 0.8)
        self.sleep_unless_stop(1)
 
        self.send_cue('lead15')
        self.sleep_unless_stop(1)
 
        self.send_cue('lead16')
        self.sleep_unless_stop(1)
 
        self.write("4th & goal")
        return
 
    def sequence(self):
 
        self.write("Script starting.")
        timer = 0
        while(timer <= 1):
            self.write("new sequence")
            self.sequenceOne()
            timer += 1
        while(timer <= 3):
            self.write("new sequence")
            self.sequenceTwo()
            timer += 1
        while(timer <= 5):
            self.write("new sequence")
            self.sequenceThree()
            timer += 1
        while(timer <= 7):
            self.write("new sequence")
            self.sequenceFour()
            timer += 1
        self.write("goal")
        return