A leg mechanism of a humanoid robot includes: an upper leg, a lower leg rotatably coupled to the upper leg, a knee module actuator mounted to the upper leg, a foot rotatably connected to the lower leg, a knee transmission mechanism connected to the knee module actuator and the lower leg and configured to transmit rotary motion from the knee module actuator to the lower leg, at least one ankle module actuator mounted to the upper leg, at least one ankle transmission mechanism connected to the at least one ankle module actuator and the foot and configured to transmit rotary motion from the at least one ankle module actuator to the foot.