.. default-domain:: py .. highlight:: py .. currentmodule:: InfernalRobotics Servo ===== .. class:: Servo Represents a servo. Obtained using :attr:`ServoGroup.servos`, :meth:`ServoGroup.servo_with_name` or :meth:`servo_with_name`. .. attribute:: name The name of the servo. :Attribute: Can be read or written :rtype: str :Game Scenes: Flight .. attribute:: uid The unique identifier of the servo. :Attribute: Read-only, cannot be set :rtype: int :Game Scenes: Flight .. attribute:: part The part containing the servo. :Attribute: Read-only, cannot be set :rtype: :class:`SpaceCenter.Part` :Game Scenes: Flight .. attribute:: mode Whether the part acts as a servo or a rotor. :Attribute: Read-only, cannot be set :rtype: :class:`ServoMode` :Game Scenes: Flight .. attribute:: highlight Whether the servo should be highlighted in-game. :Attribute: Write-only, cannot be read :rtype: bool :Game Scenes: Flight .. attribute:: position The position of the servo. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: min_config_position The minimum position of the servo, specified by the part configuration. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: max_config_position The maximum position of the servo, specified by the part configuration. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: min_position The minimum position of the servo, specified by the in-game tweak menu. :Attribute: Can be read or written :rtype: float :Game Scenes: Flight .. attribute:: max_position The maximum position of the servo, specified by the in-game tweak menu. :Attribute: Can be read or written :rtype: float :Game Scenes: Flight .. attribute:: config_speed The speed multiplier of the servo, specified by the part configuration. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: speed The speed multiplier of the servo, specified by the in-game tweak menu. :Attribute: Can be read or written :rtype: float :Game Scenes: Flight .. attribute:: current_speed The current speed at which the servo is moving. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: acceleration The current speed multiplier set in the UI. :Attribute: Can be read or written :rtype: float :Game Scenes: Flight .. attribute:: is_moving Whether the servo is moving. :Attribute: Read-only, cannot be set :rtype: bool :Game Scenes: Flight .. attribute:: is_free_moving Whether the servo is freely moving. :Attribute: Read-only, cannot be set :rtype: bool :Game Scenes: Flight .. attribute:: is_locked Whether the servo is locked. :Attribute: Can be read or written :rtype: bool :Game Scenes: Flight .. attribute:: is_axis_inverted Whether the servos axis is inverted. :Attribute: Can be read or written :rtype: bool :Game Scenes: Flight .. attribute:: target_position The target position the servo is moving towards. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: target_speed The target speed the servo is moving at. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: commanded_position The position the servo is currently being commanded to move to. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: default_position The default (built) position of the servo. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: force_limit The force limit of the servo, as a percentage of the maximum force. :Attribute: Can be read or written :rtype: float :Game Scenes: Flight .. attribute:: max_force The maximum force the servo can generate. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: max_acceleration The maximum acceleration the servo can achieve. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: max_speed The maximum speed the servo can achieve. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: electric_charge_required The rate at which the servo consumes electric charge, in units per second, when moving. :Attribute: Read-only, cannot be set :rtype: float :Game Scenes: Flight .. attribute:: spring_power The strength of the servo's spring, when it has one. :Attribute: Can be read or written :rtype: float :Game Scenes: Flight .. attribute:: damping_power The strength of the servo's damping. :Attribute: Can be read or written :rtype: float :Game Scenes: Flight .. attribute:: rotor_acceleration The acceleration of the servo when operating as a rotor. :Attribute: Can be read or written :rtype: float :Game Scenes: Flight .. attribute:: is_limited Whether the servo's range of movement is limited to the configured minimum and maximum positions. :Attribute: Can be read or written :rtype: bool :Game Scenes: Flight .. attribute:: is_rotational Whether the servo moves rotationally (as opposed to linearly). :Attribute: Read-only, cannot be set :rtype: bool :Game Scenes: Flight .. attribute:: is_servo Whether the part is operating as a servo (rather than a rotor). :Attribute: Read-only, cannot be set :rtype: bool :Game Scenes: Flight .. attribute:: can_have_limits Whether the servo can have its range of movement limited. :Attribute: Read-only, cannot be set :rtype: bool :Game Scenes: Flight .. attribute:: has_spring Whether the servo has a spring. :Attribute: Read-only, cannot be set :rtype: bool :Game Scenes: Flight .. attribute:: is_running Whether the servo is running, when operating as a rotor. :Attribute: Read-only, cannot be set :rtype: bool :Game Scenes: Flight .. attribute:: preset_positions The list of preset positions configured for the servo. :Attribute: Read-only, cannot be set :rtype: list(float) :Game Scenes: Flight .. method:: move_right() Moves the servo to the right. :Game Scenes: Flight .. method:: move_left() Moves the servo to the left. :Game Scenes: Flight .. method:: move_center() Moves the servo to the center. :Game Scenes: Flight .. method:: move_to(position, 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:: stop() Stops the servo. :Game Scenes: Flight .. method:: add_preset(position) Adds a preset position to the servo. :param float position: The position of the preset. :Game Scenes: Flight .. method:: remove_preset_at(index) Removes the preset position at the given index. :param int index: The index of the preset to remove. :Game Scenes: Flight .. method:: sort_presets() Sorts the preset positions of the servo into ascending order. :Game Scenes: Flight .. class:: ServoMode The mode a servo is operating in. See :attr:`Servo.mode`. .. data:: servo The part acts as a servo, driving towards a target position. .. data:: rotor The part acts as a rotor, spinning continuously.