To provide a legged robot enhancing follow-up capability to a target track and reducing the possibility of loss of balance.
This method of controlling the legged robot includes a FF (Feed Forward) torque calculation step, a recalculation step, a conversion step, a FB (Feed Back) torque calculation step and a command step. In the FF torque calculation step, FF torque for making gait data follow the legged robot is calculated by using a dynamics model of the legged robot. In the recalculation step, the gait data is corrected by reducing target moving speed of the gait data when the calculated FF torque exceeds allowable torque, and the FF torque is recalculated based on the corrected gait data. In the conversion step, a leg joint target angle is calculated based on the gait data. In the FB torque calculation step, FB torque for reducing a deviation between a measured value of a leg joint angle and the leg joint target angle is calculated. In the command step, the calculated FF torque and the FB torque are command to an actuator of the leg joint.