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:
################### # 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
Comments are closed.