.. default-domain:: java .. highlight:: java .. package:: krpc.client.services.InfernalRobotics Servo ===== .. type:: public class Servo Represents a servo. Obtained using :meth:`ServoGroup.getServos()`, :meth:`ServoGroup.servoWithName(String)` or :meth:`servoWithName(SpaceCenter.Vessel, String)`. .. method:: String getName() .. method:: void setName(String value) The name of the servo. :Game Scenes: Flight .. method:: int getUID() The unique identifier of the servo. :Game Scenes: Flight .. method:: SpaceCenter.Part getPart() The part containing the servo. :Game Scenes: Flight .. method:: ServoMode getMode() Whether the part acts as a servo or a rotor. :Game Scenes: Flight .. method:: void setHighlight(boolean value) Whether the servo should be highlighted in-game. :Game Scenes: Flight .. method:: float getPosition() The position of the servo. :Game Scenes: Flight .. method:: float getMinConfigPosition() The minimum position of the servo, specified by the part configuration. :Game Scenes: Flight .. method:: float getMaxConfigPosition() The maximum position of the servo, specified by the part configuration. :Game Scenes: Flight .. method:: float getMinPosition() .. method:: void setMinPosition(float value) The minimum position of the servo, specified by the in-game tweak menu. :Game Scenes: Flight .. method:: float getMaxPosition() .. method:: void setMaxPosition(float value) The maximum position of the servo, specified by the in-game tweak menu. :Game Scenes: Flight .. method:: float getConfigSpeed() The speed multiplier of the servo, specified by the part configuration. :Game Scenes: Flight .. method:: float getSpeed() .. method:: void setSpeed(float value) The speed multiplier of the servo, specified by the in-game tweak menu. :Game Scenes: Flight .. method:: float getCurrentSpeed() The current speed at which the servo is moving. :Game Scenes: Flight .. method:: float getAcceleration() .. method:: void setAcceleration(float value) The current speed multiplier set in the UI. :Game Scenes: Flight .. method:: boolean getIsMoving() Whether the servo is moving. :Game Scenes: Flight .. method:: boolean getIsFreeMoving() Whether the servo is freely moving. :Game Scenes: Flight .. method:: boolean getIsLocked() .. method:: void setIsLocked(boolean value) Whether the servo is locked. :Game Scenes: Flight .. method:: boolean getIsAxisInverted() .. method:: void setIsAxisInverted(boolean value) Whether the servos axis is inverted. :Game Scenes: Flight .. method:: float getTargetPosition() The target position the servo is moving towards. :Game Scenes: Flight .. method:: float getTargetSpeed() The target speed the servo is moving at. :Game Scenes: Flight .. method:: float getCommandedPosition() The position the servo is currently being commanded to move to. :Game Scenes: Flight .. method:: float getDefaultPosition() The default (built) position of the servo. :Game Scenes: Flight .. method:: float getForceLimit() .. method:: void setForceLimit(float value) The force limit of the servo, as a percentage of the maximum force. :Game Scenes: Flight .. method:: float getMaxForce() The maximum force the servo can generate. :Game Scenes: Flight .. method:: float getMaxAcceleration() The maximum acceleration the servo can achieve. :Game Scenes: Flight .. method:: float getMaxSpeed() The maximum speed the servo can achieve. :Game Scenes: Flight .. method:: float getElectricChargeRequired() The rate at which the servo consumes electric charge, in units per second, when moving. :Game Scenes: Flight .. method:: float getSpringPower() .. method:: void setSpringPower(float value) The strength of the servo's spring, when it has one. :Game Scenes: Flight .. method:: float getDampingPower() .. method:: void setDampingPower(float value) The strength of the servo's damping. :Game Scenes: Flight .. method:: float getRotorAcceleration() .. method:: void setRotorAcceleration(float value) The acceleration of the servo when operating as a rotor. :Game Scenes: Flight .. method:: boolean getIsLimited() .. method:: void setIsLimited(boolean value) Whether the servo's range of movement is limited to the configured minimum and maximum positions. :Game Scenes: Flight .. method:: boolean getIsRotational() Whether the servo moves rotationally (as opposed to linearly). :Game Scenes: Flight .. method:: boolean getIsServo() Whether the part is operating as a servo (rather than a rotor). :Game Scenes: Flight .. method:: boolean getCanHaveLimits() Whether the servo can have its range of movement limited. :Game Scenes: Flight .. method:: boolean getHasSpring() Whether the servo has a spring. :Game Scenes: Flight .. method:: boolean getIsRunning() Whether the servo is running, when operating as a rotor. :Game Scenes: Flight .. method:: java.util.List getPresetPositions() The list of preset positions configured for the servo. :Game Scenes: Flight .. method:: void moveRight() Moves the servo to the right. :Game Scenes: Flight .. method:: void moveLeft() Moves the servo to the left. :Game Scenes: Flight .. method:: void moveCenter() Moves the servo to the center. :Game Scenes: Flight .. method:: void moveTo(float position, float speed) Moves the servo to *position* and sets the speed multiplier to *speed*. :param float position: The position to move the servo to. :param float speed: Speed multiplier for the movement. :Game Scenes: Flight .. method:: void stop() Stops the servo. :Game Scenes: Flight .. method:: void addPreset(float position) Adds a preset position to the servo. :param float position: The position of the preset. :Game Scenes: Flight .. method:: void removePresetAt(int index) Removes the preset position at the given index. :param int index: The index of the preset to remove. :Game Scenes: Flight .. method:: void sortPresets() Sorts the preset positions of the servo into ascending order. :Game Scenes: Flight .. type:: public enum ServoMode The mode a servo is operating in. See :meth:`Servo.getMode()`. .. field:: public ServoMode SERVO The part acts as a servo, driving towards a target position. .. field:: public ServoMode ROTOR The part acts as a rotor, spinning continuously.