A control device for a rotating machine having a stator including a first winding set (M1) and a second winding set (M2), the control device comprising: a relay configured for supplying or interrupting current from a DC power supply ; a capacitor configured for suppressing variation in current supplied from the DC power supply ; the relay being connected between the DC power supply and the capacitor ; relay control means configured for controlling opening and closing of the relay, control command generation means configured for generating a first control command that specifies current to flow through the first winding set (M1), and a second control command that specifies current to flow through the second winding set (M2); voltage calculation means configured for calculating a first voltage command from the first control command and calculating a second voltage command from the second control command; first voltage application means configured for applying voltage to the first winding set (M1) on the basis of the first voltage command; and second voltage application means configured for applying voltage to the second winding set (M2) on the basis of the second voltage command, characterized in that electric discharge control configured for electric discharge of the capacitor is performed in a state in which the relay is opened, while torque generated by current flowing from the capacitor to the first winding set (M1) and torque generated by current flowing from the capacitor to the second winding set (M2) are cancelled out with each other; wherein the first control command and the second control command are a first current command and a second current command in a rotating two-axis coordinate system, respectively, and the first current command and the second current command have phases opposite to each other. a relay configured for supplying or interrupting current from a DC power supply ; a capacitor configured for suppressing variation in current supplied from the DC power supply ; the relay being connected between the DC power supply and the capacitor ; relay control means configured for controlling opening and closing of the relay, control command generation means configured for generating a first control command that specifies current to flow through the first winding set (M1), and a second control command that specifies current to flow through the second winding set (M2); voltage calculation means configured for calculating a first voltage command from the first control command and calculating a second voltage command from the second control command; first voltage application means configured for applying voltage to the first winding set (M1) on the basis of the first voltage command; and second voltage application means configured for applying voltage to the second winding set (M2) on the basis of the second voltage command, characterized in that electric discharge control configured for electric discharge of the capacitor is performed in a state in which the relay is opened, while torque generated by current flowing from the capacitor to the first winding set (M1) and torque generated by current flowing from the capacitor to the second winding set (M2) are cancelled out with each other; wherein the first control command and the second control command are a first current command and a second current command in a rotating two-axis coordinate system, respectively, and the first current command and the second current command have phases opposite to each other. <EOS>