Servo#

class Servo#

Represents a servo. Obtained using ServoGroup::servos(), ServoGroup::servo_with_name() or servo_with_name().

std::string name()#
void set_name(std::string value)#

The name of the servo.

Game Scenes:

Flight

uint32_t uid()#

The unique identifier of the servo.

Game Scenes:

Flight

SpaceCenter::Part part()#

The part containing the servo.

Game Scenes:

Flight

ServoMode mode()#

Whether the part acts as a servo or a rotor.

Game Scenes:

Flight

void set_highlight(bool value)#

Whether the servo should be highlighted in-game.

Game Scenes:

Flight

float position()#

The position of the servo.

Game Scenes:

Flight

float min_config_position()#

The minimum position of the servo, specified by the part configuration.

Game Scenes:

Flight

float max_config_position()#

The maximum position of the servo, specified by the part configuration.

Game Scenes:

Flight

float min_position()#
void set_min_position(float value)#

The minimum position of the servo, specified by the in-game tweak menu.

Game Scenes:

Flight

float max_position()#
void set_max_position(float value)#

The maximum position of the servo, specified by the in-game tweak menu.

Game Scenes:

Flight

float config_speed()#

The speed multiplier of the servo, specified by the part configuration.

Game Scenes:

Flight

float speed()#
void set_speed(float value)#

The speed multiplier of the servo, specified by the in-game tweak menu.

Game Scenes:

Flight

float current_speed()#

The current speed at which the servo is moving.

Game Scenes:

Flight

float acceleration()#
void set_acceleration(float value)#

The current speed multiplier set in the UI.

Game Scenes:

Flight

bool is_moving()#

Whether the servo is moving.

Game Scenes:

Flight

bool is_free_moving()#

Whether the servo is freely moving.

Game Scenes:

Flight

bool is_locked()#
void set_is_locked(bool value)#

Whether the servo is locked.

Game Scenes:

Flight

bool is_axis_inverted()#
void set_is_axis_inverted(bool value)#

Whether the servos axis is inverted.

Game Scenes:

Flight

float target_position()#

The target position the servo is moving towards.

Game Scenes:

Flight

float target_speed()#

The target speed the servo is moving at.

Game Scenes:

Flight

float commanded_position()#

The position the servo is currently being commanded to move to.

Game Scenes:

Flight

float default_position()#

The default (built) position of the servo.

Game Scenes:

Flight

float force_limit()#
void set_force_limit(float value)#

The force limit of the servo, as a percentage of the maximum force.

Game Scenes:

Flight

float max_force()#

The maximum force the servo can generate.

Game Scenes:

Flight

float max_acceleration()#

The maximum acceleration the servo can achieve.

Game Scenes:

Flight

float max_speed()#

The maximum speed the servo can achieve.

Game Scenes:

Flight

float electric_charge_required()#

The rate at which the servo consumes electric charge, in units per second, when moving.

Game Scenes:

Flight

float spring_power()#
void set_spring_power(float value)#

The strength of the servo’s spring, when it has one.

Game Scenes:

Flight

float damping_power()#
void set_damping_power(float value)#

The strength of the servo’s damping.

Game Scenes:

Flight

float rotor_acceleration()#
void set_rotor_acceleration(float value)#

The acceleration of the servo when operating as a rotor.

Game Scenes:

Flight

bool is_limited()#
void set_is_limited(bool value)#

Whether the servo’s range of movement is limited to the configured minimum and maximum positions.

Game Scenes:

Flight

bool is_rotational()#

Whether the servo moves rotationally (as opposed to linearly).

Game Scenes:

Flight

bool is_servo()#

Whether the part is operating as a servo (rather than a rotor).

Game Scenes:

Flight

bool can_have_limits()#

Whether the servo can have its range of movement limited.

Game Scenes:

Flight

bool has_spring()#

Whether the servo has a spring.

Game Scenes:

Flight

bool is_running()#

Whether the servo is running, when operating as a rotor.

Game Scenes:

Flight

std::vector<float> preset_positions()#

The list of preset positions configured for the servo.

Game Scenes:

Flight

void move_right()#

Moves the servo to the right.

Game Scenes:

Flight

void move_left()#

Moves the servo to the left.

Game Scenes:

Flight

void move_center()#

Moves the servo to the center.

Game Scenes:

Flight

void move_to(float position, float speed)#

Moves the servo to position and sets the speed multiplier to speed.

Parameters:
  • position – The position to move the servo to.

  • speed – Speed multiplier for the movement.

Game Scenes:

Flight

void stop()#

Stops the servo.

Game Scenes:

Flight

void add_preset(float position)#

Adds a preset position to the servo.

Parameters:
  • position – The position of the preset.

Game Scenes:

Flight

void remove_preset_at(int32_t index)#

Removes the preset position at the given index.

Parameters:
  • index – The index of the preset to remove.

Game Scenes:

Flight

void sort_presets()#

Sorts the preset positions of the servo into ascending order.

Game Scenes:

Flight

enum struct ServoMode#

The mode a servo is operating in. See Servo::mode().

enumerator servo#

The part acts as a servo, driving towards a target position.

enumerator rotor#

The part acts as a rotor, spinning continuously.