A robot to operate accurately while canceling an affect of pitch-axis, roll-axis,
and yaw-axis moments, these moments being applied on the robot body during a leg-moving
operation such as walking. First, by calculating a pitch-axis moment and/or a roll-axis
moment generated on the robot body at a preset ZMP by set motions of upper limbs,
a trunk, and lower limbs, motions of the lower limbs and the trunk for canceling
the pitch-axis moment and/or the roll-axis moment are obtained. Then, by calculating
a yaw-axis moment generated on the robot body lying at the preset ZMP by the calculated
motions of the lower limbs and the trunk, a motion of the upper limbs for canceling
the yaw-axis moment is obtained.