pigpio


Continuity

Single Leg Prototype - Test 2 (Smooth control, ground contact reaction)

enter image description here 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.


Single Leg Prototype - Test 1 (Synchronous movement)

enter image description here Watch: Single Leg Prototype - Test 1 (Synchronous movement)

I 3D printed and tested the first leg prototype: the structure is relatively strong, despite the thin thickness of the plastic joints. I used PVC tubes for the links high torque full-metal servo motors to power the leg. The control is achieved using basing sequential coding in forward kinematics. I used the library pigpio to move the motors, without caring about the movement smoothness. Instead, I tried to define some points the leg had to reach to achieve a step cycle. From the pigpio library, using pi.set_servo_pulsewidth(pin, angle), it is possible to control the servos easily. N.B.: The motors react immediately to the GPIO trigger, meaning that multiple commands can be sequenced, obtaining a parallel/simultaneous movement of the servos. However, this does not allow us to change their speed. This can be achieved by adding a delay between each leg position, even if the result is a bit clunky and definitely not smooth.