A command generation device to control a motor, comprising: a command input unit to receive a first command; a first intermediate data calculation unit configured to calculate first intermediate data based on the first command; a delay time setting unit configured to determine a delay time based on the first command, a first time period during which positioning the motor based on the first command is completed when the first intermediate data is smoothed being longer by the delay time than a second time period during which positioning the motor based on the first command is completed when the first intermediate data is not smoothed; a second intermediate data calculation unit configured to calculate second intermediate data by smoothing the first intermediate data based on the delay time; and a command output unit configured to calculate, based on the second intermediate data, a second command according to which the motor is controlled; wherein the delay time setting unit determines the delay time to be shorter than an initial value when a maximum value of the first intermediate data calculated based on the first command does not reach a upper limit value of the first intermediate data; wherein the delay time setting unit is configured to calculate the delay time by multiplying the initial value of the delay time by a ratio of the maximum value to the upper limit value of the first intermediate data; wherein the delay time setting unit is configured to calculate the delay time when the command input unit receives the first command while the command output unit does not output the second command; wherein the command generation device is further characterized in that the delay time setting unit is configured to calculate the delay time at a timing at which an operation direction of the motor is reversed when the first command is changed by the command input unit while the command output unit outputs the second command. a command input unit to receive a first command; a first intermediate data calculation unit configured to calculate first intermediate data based on the first command; a delay time setting unit configured to determine a delay time based on the first command, a first time period during which positioning the motor based on the first command is completed when the first intermediate data is smoothed being longer by the delay time than a second time period during which positioning the motor based on the first command is completed when the first intermediate data is not smoothed; a second intermediate data calculation unit configured to calculate second intermediate data by smoothing the first intermediate data based on the delay time; and a command output unit configured to calculate, based on the second intermediate data, a second command according to which the motor is controlled; wherein the delay time setting unit determines the delay time to be shorter than an initial value when a maximum value of the first intermediate data calculated based on the first command does not reach a upper limit value of the first intermediate data; wherein the delay time setting unit is configured to calculate the delay time by multiplying the initial value of the delay time by a ratio of the maximum value to the upper limit value of the first intermediate data; wherein the delay time setting unit is configured to calculate the delay time when the command input unit receives the first command while the command output unit does not output the second command; wherein the command generation device is further characterized in that wherein the delay time setting unit determines the delay time to be shorter than an initial value when a maximum value of the first intermediate data calculated based on the first command does not reach a upper limit value of the first intermediate data; wherein the delay time setting unit is configured to calculate the delay time by multiplying the initial value of the delay time by a ratio of the maximum value to the upper limit value of the first intermediate data; wherein the delay time setting unit is configured to calculate the delay time when the command input unit receives the first command while the command output unit does not output the second command; wherein the command generation device is further characterized in that the delay time setting unit is configured to calculate the delay time at a timing at which an operation direction of the motor is reversed when the first command is changed by the command input unit while the command output unit outputs the second command.