In stopping a rotary body of an electric rotary excavator (a construction
machine), a control-system changing unit of a rotation control device
changes a control law from a speed control law to a position control law
when a target speed is judged to be smaller than a speed threshold value.
By changing to the position control, a larger braking torque can be
output to an electric motor as compared with that in the speed control,
thereby reliably maintaining the rotary body in a stationary state.