There is provided a servomotor which can precisely control the position of a driven body and a counterforce received by the driven body. There are provided: a position command calculation unit that calculates a position command specifying a target position of a body driven by a servomotor; a counterforce command calculation unit that calculates a counterforce command that specifies a target counterforce that should be received by the driven body; a position obtaining unit that obtains an actual position of the driven body; a position reference drive control unit that generates a position reference drive signal to bring the position closer to the target position; a counter force maintenance unit that receives a counter force received by the driven body; a counterforce reference drive control unit that generates a counterforce reference drive signal to bring the counterforce closer to the target counterforce; and a drive signal selection unit that selects one of the position reference drive signal and the counterforce reference drive signal; wherein the position command calculating unit calculates the position command such that the target position becomes a relationship of a second or higher order relative to time, and the opposing force command calculating unit calculates the opposing force command such that a relationship between the target opposing force and the target position becomes substantially linear.
展开▼