.. default-domain:: cpp .. highlight:: cpp .. namespace:: krpc::services::SpaceCenter Control ======= .. class:: Control Used to manipulate the controls of a vessel. This includes adjusting the throttle, enabling/disabling systems such as SAS and RCS, or altering the direction in which the vessel is pointing. Obtained by calling :func:`Vessel::control`. .. note:: Control inputs (pitch, yaw, roll, translation, wheel throttle, wheel steering and the custom axes) are zeroed when all clients that have set one or more of these inputs are no longer connected. The throttle is an exception: it keeps its value when clients disconnect. .. function:: ControlSource source() The source of the vessels control, for example by a kerbal or a probe core. :Game Scenes: Flight .. function:: ControlState state() The control state of the vessel. :Game Scenes: Flight .. function:: bool sas() .. function:: void set_sas(bool value) The state of SAS. :Game Scenes: Flight .. note:: Equivalent to :func:`AutoPilot::sas`. Throws an exception if set to ``true`` while the auto-pilot is engaged, as the auto-pilot holds SAS off for as long as it is flying the vessel. .. function:: SASMode sas_mode() .. function:: void set_sas_mode(SASMode value) The current :func:`Control::sas_mode`. These modes are equivalent to the mode buttons to the left of the navball that appear when SAS is enabled. :Game Scenes: Flight .. note:: Equivalent to :func:`AutoPilot::sas_mode` .. function:: SpeedMode speed_mode() .. function:: void set_speed_mode(SpeedMode value) The current :func:`Control::speed_mode` of the navball. This is the mode displayed next to the speed at the top of the navball. :Game Scenes: Flight .. function:: bool engine_gimbals() .. function:: void set_engine_gimbals(bool value) Returns whether all gimballed engines on the vessel have gimbal enabled, and sets the gimbal enabled state of all gimballed engines. See :func:`Engine::gimbal_locked`. :Game Scenes: Flight .. function:: bool thrust_reversers() .. function:: void set_thrust_reversers(bool value) Returns whether all engines with a thrust reverser on the vessel have their thrust reverser engaged, and sets the thrust reverser state of all such engines. See :func:`Engine::thrust_reversed`. :Game Scenes: Flight .. function:: bool aero_surfaces() .. function:: void set_aero_surfaces(bool value) Returns whether all control surfaces on the vessel have pitch, yaw and roll enabled, and sets the pitch, yaw and roll enabled state of all control surfaces. See :func:`ControlSurface::pitch_enabled`, :func:`ControlSurface::yaw_enabled` and :func:`ControlSurface::roll_enabled`. :Game Scenes: Flight .. function:: bool rcs() .. function:: void set_rcs(bool value) The state of RCS. :Game Scenes: Flight .. function:: bool reaction_wheels() .. function:: void set_reaction_wheels(bool value) Returns whether all reactive wheels on the vessel are active, and sets the active state of all reaction wheels. See :func:`ReactionWheel::active`. :Game Scenes: Flight .. function:: bool gear() .. function:: void set_gear(bool value) The state of the landing gear/legs. :Game Scenes: Flight .. function:: bool legs() .. function:: void set_legs(bool value) Returns whether all landing legs on the vessel are deployed, and sets the deployment state of all landing legs. Does not include wheels (for example landing gear). See :func:`Leg::deployed`. :Game Scenes: Flight .. function:: bool wheels() .. function:: void set_wheels(bool value) Returns whether all wheels on the vessel are deployed, and sets the deployment state of all wheels. Does not include landing legs. See :func:`Wheel::deployed`. :Game Scenes: Flight .. function:: bool lights() .. function:: void set_lights(bool value) The state of the lights. :Game Scenes: Flight .. function:: bool brakes() .. function:: void set_brakes(bool value) The state of the wheel brakes. :Game Scenes: Flight .. function:: bool antennas() .. function:: void set_antennas(bool value) Returns whether all antennas on the vessel are deployed, and sets the deployment state of all antennas. See :func:`Antenna::deployed`. :Game Scenes: Flight .. function:: bool cargo_bays() .. function:: void set_cargo_bays(bool value) Returns whether any of the cargo bays on the vessel are open, and sets the open state of all cargo bays. See :func:`CargoBay::open`. :Game Scenes: Flight .. function:: bool intakes() .. function:: void set_intakes(bool value) Returns whether all of the air intakes on the vessel are open, and sets the open state of all air intakes. See :func:`Intake::open`. :Game Scenes: Flight .. function:: bool parachutes() .. function:: void set_parachutes(bool value) Returns whether all parachutes on the vessel are deployed, and sets the deployment state of all parachutes. Cannot be set to ``false``. See :func:`Parachute::deployed`. :Game Scenes: Flight .. function:: bool radiators() .. function:: void set_radiators(bool value) Returns whether all radiators on the vessel are deployed, and sets the deployment state of all radiators. See :func:`Radiator::deployed`. :Game Scenes: Flight .. function:: bool resource_harvesters() .. function:: void set_resource_harvesters(bool value) Returns whether all of the resource harvesters on the vessel are deployed, and sets the deployment state of all resource harvesters. See :func:`ResourceHarvester::deployed`. :Game Scenes: Flight .. function:: bool resource_harvesters_active() .. function:: void set_resource_harvesters_active(bool value) Returns whether any of the resource harvesters on the vessel are active, and sets the active state of all resource harvesters. See :func:`ResourceHarvester::active`. :Game Scenes: Flight .. function:: bool solar_panels() .. function:: void set_solar_panels(bool value) Returns whether all solar panels on the vessel are deployed, and sets the deployment state of all solar panels. See :func:`SolarPanel::deployed`. :Game Scenes: Flight .. function:: bool abort() .. function:: void set_abort(bool value) The state of the abort action group. :Game Scenes: Flight .. function:: float throttle() .. function:: void set_throttle(float value) The state of the throttle. A value between 0 and 1. Unlike the other control inputs, the throttle is not zeroed when the clients that set it disconnect. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: ControlInputMode input_mode() .. function:: void set_input_mode(ControlInputMode value) Sets the behavior of the pitch, yaw, roll and translation control inputs. When set to additive, these inputs are added to the vessels current inputs. This mode is the default. When set to override, these inputs (if non-zero) override the vessels inputs. This mode prevents keyboard control, or SAS, from interfering with the controls when they are set. :Game Scenes: Flight .. function:: float pitch() .. function:: void set_pitch(float value) The state of the pitch control. A value between -1 and 1. Equivalent to the w and s keys. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: float yaw() .. function:: void set_yaw(float value) The state of the yaw control. A value between -1 and 1. Equivalent to the a and d keys. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: float roll() .. function:: void set_roll(float value) The state of the roll control. A value between -1 and 1. Equivalent to the q and e keys. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: float pitch_trim() .. function:: void set_pitch_trim(float value) The state of the pitch trim. A value between -1 and 1. Equivalent to the Alt+W and Alt+S keys. This is a persistent trim that remains latched until changed or reset, and can only be accessed for the active vessel. Unlike the pitch, yaw and roll control inputs, the trim is not cleared when clients disconnect. :Game Scenes: Flight .. function:: float yaw_trim() .. function:: void set_yaw_trim(float value) The state of the yaw trim. A value between -1 and 1. Equivalent to the Alt+A and Alt+D keys. This is a persistent trim that remains latched until changed or reset, and can only be accessed for the active vessel. Unlike the pitch, yaw and roll control inputs, the trim is not cleared when clients disconnect. :Game Scenes: Flight .. function:: float roll_trim() .. function:: void set_roll_trim(float value) The state of the roll trim. A value between -1 and 1. Equivalent to the Alt+Q and Alt+E keys. This is a persistent trim that remains latched until changed or reset, and can only be accessed for the active vessel. Unlike the pitch, yaw and roll control inputs, the trim is not cleared when clients disconnect. :Game Scenes: Flight .. function:: float forward() .. function:: void set_forward(float value) The state of the forward translational control. A value between -1 and 1. Equivalent to the h and n keys. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: float up() .. function:: void set_up(float value) The state of the up translational control. A value between -1 and 1. Equivalent to the i and k keys. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: float right() .. function:: void set_right(float value) The state of the right translational control. A value between -1 and 1. Equivalent to the j and l keys. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: float wheel_throttle() .. function:: void set_wheel_throttle(float value) The state of the wheel throttle. A value between -1 and 1. A value of 1 rotates the wheels forwards, a value of -1 rotates the wheels backwards. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: float wheel_steering() .. function:: void set_wheel_steering(float value) The state of the wheel steering. A value between -1 and 1. A value of 1 steers to the left, and a value of -1 steers to the right. :Game Scenes: Flight .. note:: The getter returns the input currently applied to the vessel, which combines the input set by kRPC with any keyboard, SAS and trim input. It refreshes one physics tick after a set, so a read immediately after a set returns the previously applied value rather than the value just set. .. function:: float custom_axis01() .. function:: void set_custom_axis01(float value) The state of CustomAxis01. A value between -1 and 1. :Game Scenes: Flight .. function:: float custom_axis02() .. function:: void set_custom_axis02(float value) The state of CustomAxis02. A value between -1 and 1. :Game Scenes: Flight .. function:: float custom_axis03() .. function:: void set_custom_axis03(float value) The state of CustomAxis03. A value between -1 and 1. :Game Scenes: Flight .. function:: float custom_axis04() .. function:: void set_custom_axis04(float value) The state of CustomAxis04. A value between -1 and 1. :Game Scenes: Flight .. function:: int32_t current_stage() The current stage of the vessel. Corresponds to the stage number in the in-game UI. :Game Scenes: Flight .. function:: std::vector activate_next_stage() Activates the next stage. Equivalent to pressing the space bar in-game. :returns: A list of vessel objects that are jettisoned from the active vessel. :Game Scenes: Flight .. note:: When called, the active vessel may change. It is therefore possible that, after calling this function, the object(s) returned by previous call(s) to :func:`active_vessel` no longer refer to the active vessel. Throws an exception if staging is locked. .. function:: bool stage_lock() .. function:: void set_stage_lock(bool value) Whether staging is locked on the vessel. :Game Scenes: Flight .. note:: This is equivalent to locking the staging using Alt+L .. function:: bool get_action_group(uint32_t group) Returns ``true`` if the given action group is enabled. :Parameters: * **group** -- A number between 0 and 9 inclusive, or between 0 and 250 inclusive when the `Extended Action Groups mod `_ is installed. :Game Scenes: Flight .. function:: void set_action_group(uint32_t group, bool state) Sets the state of the given action group. :Parameters: * **group** -- A number between 0 and 9 inclusive, or between 0 and 250 inclusive when the `Extended Action Groups mod `_ is installed. :Game Scenes: Flight .. function:: void toggle_action_group(uint32_t group) Toggles the state of the given action group. :Parameters: * **group** -- A number between 0 and 9 inclusive, or between 0 and 250 inclusive when the `Extended Action Groups mod `_ is installed. :Game Scenes: Flight .. function:: std::vector get_action_group_actions(uint32_t group) Returns a list of all the part actions that are assigned to the given action group. Each entry identifies the part, the part module, and the action's name and identifier. Returns an empty list if no actions are assigned to the group. :Parameters: * **group** -- A number between 0 and 9 inclusive, or between 0 and 250 inclusive when the `Extended Action Groups mod `_ is installed. :Game Scenes: Flight .. note:: For stock action groups, the assignments are read from each part action directly. When the Extended Action Groups mod is installed, the assignments are queried from the mod instead, so that actions assigned to its additional groups are included. .. function:: Node add_node(double ut, float prograde = 0.0, float normal = 0.0, float radial = 0.0) Creates a maneuver node at the given universal time, and returns a :class:`Node` object that can be used to modify it. Optionally sets the magnitude of the delta-v for the maneuver node in the prograde, normal and radial directions. :Parameters: * **ut** -- Universal time of the maneuver node. * **prograde** -- Delta-v in the prograde direction. * **normal** -- Delta-v in the normal direction. * **radial** -- Delta-v in the radial direction. :Game Scenes: Flight .. function:: std::vector nodes() Returns a list of all existing maneuver nodes, ordered by time from first to last. :Game Scenes: Flight .. function:: void remove_nodes() Remove all maneuver nodes. :Game Scenes: Flight .. class:: ActionGroupAction An action, belonging to a part module, that is assigned to an action group. Obtained by calling :func:`Control::get_action_group_actions`. .. function:: Part part() The part that the action acts on. .. function:: Module module() The part module that the action belongs to. Returns ``NULL`` for a part-level action that is not associated with a module. This only occurs when the Extended Action Groups mod is installed, as it can assign actions defined directly on a part, rather than on one of its modules, to an action group. .. function:: std::string name() The human-readable name of the action, as shown in the action group editor. .. function:: std::string id() The non-localized identifier for the action. .. namespace:: krpc::services::SpaceCenter .. enum-struct:: ControlState The control state of a vessel. See :func:`Control::state`. .. enumerator:: full Full controllable. .. enumerator:: partial Partially controllable. .. enumerator:: none Not controllable. .. namespace:: krpc::services::SpaceCenter .. enum-struct:: ControlSource The control source of a vessel. See :func:`Control::source`. .. enumerator:: kerbal Vessel is controlled by a Kerbal. .. enumerator:: probe Vessel is controlled by a probe core. .. enumerator:: none Vessel is not controlled. .. namespace:: krpc::services::SpaceCenter .. enum-struct:: SASMode The behavior of the SAS auto-pilot. See :func:`AutoPilot::sas_mode`. .. enumerator:: stability_assist Stability assist mode. Dampen out any rotation. .. enumerator:: maneuver Point in the burn direction of the next maneuver node. .. enumerator:: prograde Point in the prograde direction. .. enumerator:: retrograde Point in the retrograde direction. .. enumerator:: normal Point in the orbit normal direction. .. enumerator:: anti_normal Point in the orbit anti-normal direction. .. enumerator:: radial Point in the orbit radial direction. .. enumerator:: anti_radial Point in the orbit anti-radial direction. .. enumerator:: target Point in the direction of the current target. .. enumerator:: anti_target Point away from the current target. .. namespace:: krpc::services::SpaceCenter .. enum-struct:: SpeedMode The mode of the speed reported in the navball. See :func:`Control::speed_mode`. .. enumerator:: orbit Speed is relative to the vessel's orbit. .. enumerator:: surface Speed is relative to the surface of the body being orbited. .. enumerator:: target Speed is relative to the current target. .. namespace:: krpc::services::SpaceCenter .. enum-struct:: ControlInputMode See :func:`Control::input_mode`. .. enumerator:: additive Control inputs are added to the vessels current control inputs. .. enumerator:: override Control inputs (when they are non-zero) override the vessels current control inputs.