1. A control device for controlling a machine tool for cutting an outer peripheral surface or an inner peripheral surface of a workpiece with a tool, the machine tool having a spindle for rotating the workpiece and the tool relative to each other around a central axis of the workpiece, at least one feed shaft for performing a relative feeding between the tool and the workpiece along a generatrix of the outer peripheral surface or the inner peripheral surface of the workpiece, and a position detector for detecting an actual position of the at least one feed shaft, the control device comprising:a position command generation part for generating a position command for the at least one feed shaft based a relative feed speed of the tool and the workpiece; and
a feed shaft control part for controlling the at least one feed shaft according to the position command, wherein
the feed shaft control part is configured to control the at least one feed shaft by generating a torque command based on a resultant command obtained by adding the oscillation command to a position deviation, which is a difference between the position command and the actual position of the at least one feed shaft detected by the position detector;
the feed shaft control part further comprises an elastic deformation amount calculation part for calculating, based on the torque command, an elastic deformation amount of a structure between an output terminal of the at least one feed shaft and a machine oscillation end which generates oscillation for the oscillation cutting;
the output terminal is the portion of a rotary motor rotating shaft which drives a feed mechanism of the feed shaft that is connected to the feed mechanism;
the machine oscillation end is a tip of the tool;
the elastic deformation amount is an expansion/contraction elastic deformation amount of the rotary motor in the axial direction, or the sum of an expansion/contraction elastic deformation amount of the rotary motor in the axial direction and a torsional elastic deformation amount about the axis of the rotary motor; and
the feed shaft control part comprises an oscillation command generation part that generates the oscillation command for the at least one feed shaft so that the tool performs oscillation cutting on the workpiece, and so as to generate, based on the rotation speed, the position command, and the elastic deformation amount, an oscillation frequency which is a positive non-integral multiple of the rotation speed.