A ZMP equilibrium equation stating the relationship of various moments
applied to a robot body of a robot, based on desirable motion data made
up by trajectories of respective parts, imaginarily divided from the
robot body, is generated, and moment errors in a ZMP equilibrium equation
are calculated. A priority sequence of the parts, the target trajectories
of which are corrected to cancel out the moment errors, is set. The
target trajectories are corrected from one part to another, in a sequence
corresponding to the priority sequence, to compensate the moment errors.