1. A robot control method capable of, by a control unit, controlling a robot so as to be driven according to a commanded trajectory,

detecting an actual trajectory along which the robot is driven, and controlling the commanded trajectory by learning based

on a trajectory error between the actual trajectory and a target trajectory, the method comprising:

calculating, by the control unit, a trajectory error; and

controlling, by the control unit, the commanded trajectory by learning,

the controlling by learning including

performing storing, by the control unit, such that in a case where the calculated trajectory error is less than a trajectory

error stored in a storage unit, the trajectory error stored in the storage unit is updated by the calculated trajectory error,

the calculated trajectory error is stored in the storage unit, and a commanded trajectory stored in the storage unit is updated

by a commanded trajectory based on which the calculated trajectory error is obtained,

changing, by the control unit, a first compensator to a second compensator such that in a case where the calculated trajectory

error is more than the trajectory error stored in the storage unit, the first compensator is changed to the second compensator

that is configured to calculate an amount of correction of the commanded trajectory from the trajectory error and that is

configured to calculate the amount of correction in a different manner from a manner in which the first compensator calculates

the amount of correction, and

calculating, by the control unit, a commanded trajectory in a next-time operation such that the amount of correction for the

commanded trajectory stored in the storage unit is calculated using a selected compensator, and the commanded trajectory in

the next-time operation is calculated from the calculated amount of correction and the commanded trajectory stored in the

storage unit,

wherein the second compensator is a proportional compensator, an integral compensator, a derivative compensator, a PID compensator,

a low pass filter, a second-order derivative compensator, a time delay compensator, a time advance compensator or a notch

filter, and

wherein in changing, by the control unit, the first compensator, when the first compensator is changed to the second compensator

configured to calculate the amount of correction in a different manner from the manner in which the first compensator calculates

the amount of correction, the first compensator is changed by changing a formula defining the second compensator and one or

more parameters included in the formula such that a value of each parameter is changed within a predetermined range, and the

formula is changed.