A controller comprising: a casing having a rectangular solid shape and including a front panel including an intake port, a rear panel including a discharge port and arranged so as to be opposed to the front panel, and a heat transfer wall arranged so as to be perpendicular to the front panel and the rear panel, the heat transfer wall including an opening portion through which an inside and outside of the casing communicate with each other; a fan arranged inside the casing and configured to suck outside air into the casing through the intake port and supply the air to the inside of the casing; a regenerative resistor being detachably attached to a resistor attaching portion provided inside the opening portion of the casing, wherein the regenerative resistor attached to the resistor attaching portion is exposed to the outside through the opening portion of the heat transfer wall, the regenerative resistor being insertable and detachable through the opening portion; electronic parts provided inside the casing and including a servo amplifier which makes the regenerative resistor consume electric power; and a lid body detachably attached to the heat transfer wall and configured to seal the opening portion; characterized in that the controller further comprises covers (71,72,73) being attachable to and detachable from the casing, the covers (71,72,73) being configured to seal the intake port and the discharge port to convert the controller from an open-type controller into a sealed-type controller, and that in a state, in which the covers (71,72,73) are attached to the casing, a cooling passage extending along a surface of the heat transfer wall is formed inside the covers (71,72,73) and the regenerative resistor is arranged on a base provided on a bottom surface of the rear cover and outside the casing but inside the cooling passage. a casing having a rectangular solid shape and including a front panel including an intake port, a rear panel including a discharge port and arranged so as to be opposed to the front panel, and a heat transfer wall arranged so as to be perpendicular to the front panel and the rear panel, the heat transfer wall including an opening portion through which an inside and outside of the casing communicate with each other; a front panel including an intake port, a rear panel including a discharge port and arranged so as to be opposed to the front panel, and a heat transfer wall arranged so as to be perpendicular to the front panel and the rear panel, the heat transfer wall including an opening portion through which an inside and outside of the casing communicate with each other; a fan arranged inside the casing and configured to suck outside air into the casing through the intake port and supply the air to the inside of the casing; a regenerative resistor being detachably attached to a resistor attaching portion provided inside the opening portion of the casing, wherein the regenerative resistor attached to the resistor attaching portion is exposed to the outside through the opening portion of the heat transfer wall, the regenerative resistor being insertable and detachable through the opening portion; electronic parts provided inside the casing and including a servo amplifier which makes the regenerative resistor consume electric power; and a lid body detachably attached to the heat transfer wall and configured to seal the opening portion; characterized in that the controller further comprises covers (71,72,73) being attachable to and detachable from the casing, the covers (71,72,73) being configured to seal the intake port and the discharge port to convert the controller from an open-type controller into a sealed-type controller, and that in a state, in which the covers (71,72,73) are attached to the casing, a cooling passage extending along a surface of the heat transfer wall is formed inside the covers (71,72,73) and the regenerative resistor is arranged on a base provided on a bottom surface of the rear cover and outside the casing but inside the cooling passage.