Watch: Single Leg Prototype - Test 2 (Smooth control, ground contact reaction)
As discussed in the previous post, smoothness is something I want to work on: it helps reduce vibrations that a clunky mechanical movement would otherwise cause. In addition, it is more visually appealing.
I used the pigpio library, and I controlled the motors smoothly using a function that I called servo_smooth(motor, angle, speed)
. The distance between the current servo angle and the target angle is subdivided into small steps that act as a time delay: by changing this value, it is possible to control the movement speed. Additionally, using the function servo_sync(motor1, angle1, speed1, motor2, angle2, speed2)
in multithreading, two threads run the servos (one each), allowing me to set a certain angle and the speed I want the motor to run, moving synchronously and smoothly. Finally, I implemented a simple ground contact check by snap-fitting a limit switch in the lower plastic linkage. The program I was running in the video lifts the leg as much as possible, reacting when a force is applied to the foot. This is just an "ON/OFF" configuration, which is quite not the best solution for sensing the ground correctly.