I built my hobby servo choreography from the second sample program so that it can include linear motion along with an oscillating motion.
At the beginning, it swings in linear motion from side to side, and the range that it moves decreases over time. The speed of the movement also decreases over time as an indication of building momentum or tension. This draws the viewers attention in so that they are curious as to what will follow.
The hobby servo then stops moving for a brief moment as an indication of a change in motion. The servo will then oscillate in an arc, with different durations to build flow into the next motion and create sudden change in motion. The servo stops suddenly after the 3rd oscillation and pauses for a brief moment to create suspense.
After this pause, the servo will move in a quick motion to the indicated angle then move slowly in a linear motion. In real life, this motion looks as if the servo is “jumping back to life” in a sense. The speed increases the second time the servo moves in a linear arc and finally comes to an end with an oscillating motion that decreases in range over time.
print("Starting main script.") while True: # initial pause time.sleep(2.0) # begin the movement sequence, starting with some slow sweeps print("Starting linear motions.") linear_move(servo, 0.0, 180.0, speed=90) linear_move(servo, 180.0, 0.0, speed=45) linear_move(servo, 0.0, 45.0, speed=30) linear_move(servo, 45.0, 135.0, speed=20) # brief pause time.sleep(1.0) # start bouncy oscillation movements print("Starting ringing motions.") ringing_move(servo, 135.0, duration=3) ringing_move(servo, 100.0, duration=3) ringing_move(servo, 65.0, duration=1) #brief pause time.sleep(1.0) #swings linearly again print("Starting 2nd linear motion.") linear_move(servo, 65.0, 180.0, speed=20) linear_move(servo, 180.0, 0.0, speed=80) print("Starting final ringing motion.") ringing_move(servo, 90.0, q=90.0, qd=400, b=1.0, duration=12.0)
Leave a Reply
You must be logged in to post a comment.