One servo motor for each hip joint and knee joint.
The hip joint motor swings the leg by switching its target angle periodically.
The knee joint motor keeps to extend the knee of the support leg.
This knee joint motor makes walking more stable.
The green box is a cheat material for perfect balancing, but that is probably unnecessary.