AutoPilot¶
-
type krpc_SpaceCenter_AutoPilot_t¶
Provides basic auto-piloting utilities for a vessel. Created by calling
krpc_SpaceCenter_Vessel_AutoPilot()
.Note
If a client engages the auto-pilot and then closes its connection to the server, the auto-pilot will be disengaged and its target reference frame, direction and roll reset to default.
-
krpc_error_t krpc_SpaceCenter_AutoPilot_Engage(krpc_connection_t connection)¶
Engage the auto-pilot.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_Disengage(krpc_connection_t connection)¶
Disengage the auto-pilot.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_Wait(krpc_connection_t connection)¶
Blocks until the vessel is pointing in the target direction and has the target roll (if set). Throws an exception if the auto-pilot has not been engaged.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_Error(krpc_connection_t connection, float *result)¶
The error, in degrees, between the direction the ship has been asked to point in and the direction it is pointing in. Throws an exception if the auto-pilot has not been engaged and SAS is not enabled or is in stability assist mode.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_PitchError(krpc_connection_t connection, float *result)¶
The error, in degrees, between the vessels current and target pitch. Throws an exception if the auto-pilot has not been engaged.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_HeadingError(krpc_connection_t connection, float *result)¶
The error, in degrees, between the vessels current and target heading. Throws an exception if the auto-pilot has not been engaged.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_RollError(krpc_connection_t connection, float *result)¶
The error, in degrees, between the vessels current and target roll. Throws an exception if the auto-pilot has not been engaged or no target roll is set.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_ReferenceFrame(krpc_connection_t connection, krpc_SpaceCenter_ReferenceFrame_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_ReferenceFrame(krpc_SpaceCenter_ReferenceFrame_t value)¶
The reference frame for the target direction (
krpc_SpaceCenter_AutoPilot_TargetDirection()
).- Game Scenes:
Flight
Note
An error will be thrown if this property is set to a reference frame that rotates with the vessel being controlled, as it is impossible to rotate the vessel in such a reference frame.
-
krpc_error_t krpc_SpaceCenter_AutoPilot_TargetPitch(krpc_connection_t connection, float *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_TargetPitch(float value)¶
The target pitch, in degrees, between -90° and +90°.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_TargetHeading(krpc_connection_t connection, float *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_TargetHeading(float value)¶
The target heading, in degrees, between 0° and 360°.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_TargetRoll(krpc_connection_t connection, float *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_TargetRoll(float value)¶
The target roll, in degrees.
NaN
if no target roll is set.- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_TargetDirection(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_TargetDirection(const krpc_tuple_double_double_double_t *value)¶
Direction vector corresponding to the target pitch and heading. This is in the reference frame specified by
krpc_SpaceCenter_ReferenceFrame_t
.- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_TargetPitchAndHeading(krpc_connection_t connection, float pitch, float heading)¶
Set target pitch and heading angles.
- Parameters:
pitch – Target pitch angle, in degrees between -90° and +90°.
heading – Target heading angle, in degrees between 0° and 360°.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_SAS(krpc_connection_t connection, bool *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_SAS(bool value)¶
The state of SAS.
- Game Scenes:
Flight
Note
Equivalent to
krpc_SpaceCenter_Control_SAS()
-
krpc_error_t krpc_SpaceCenter_AutoPilot_SASMode(krpc_connection_t connection, krpc_SpaceCenter_SASMode_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_SASMode(krpc_SpaceCenter_SASMode_t value)¶
The current
krpc_SpaceCenter_SASMode_t
. 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
krpc_SpaceCenter_Control_SASMode()
-
krpc_error_t krpc_SpaceCenter_AutoPilot_RollThreshold(krpc_connection_t connection, double *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_RollThreshold(double value)¶
The threshold at which the autopilot will try to match the target roll angle, if any. Defaults to 5 degrees.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_StoppingTime(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_StoppingTime(const krpc_tuple_double_double_double_t *value)¶
The maximum amount of time that the vessel should need to come to a complete stop. This determines the maximum angular velocity of the vessel. A vector of three stopping times, in seconds, one for each of the pitch, roll and yaw axes. Defaults to 0.5 seconds for each axis.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_DecelerationTime(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_DecelerationTime(const krpc_tuple_double_double_double_t *value)¶
The time the vessel should take to come to a stop pointing in the target direction. This determines the angular acceleration used to decelerate the vessel. A vector of three times, in seconds, one for each of the pitch, roll and yaw axes. Defaults to 5 seconds for each axis.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_AttenuationAngle(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_AttenuationAngle(const krpc_tuple_double_double_double_t *value)¶
The angle at which the autopilot considers the vessel to be pointing close to the target. This determines the midpoint of the target velocity attenuation function. A vector of three angles, in degrees, one for each of the pitch, roll and yaw axes. Defaults to 1° for each axis.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_AutoTune(krpc_connection_t connection, bool *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_AutoTune(bool value)¶
Whether the rotation rate controllers PID parameters should be automatically tuned using the vessels moment of inertia and available torque. Defaults to
true
. Seekrpc_SpaceCenter_AutoPilot_TimeToPeak()
andkrpc_SpaceCenter_AutoPilot_Overshoot()
.- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_TimeToPeak(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_TimeToPeak(const krpc_tuple_double_double_double_t *value)¶
The target time to peak used to autotune the PID controllers. A vector of three times, in seconds, for each of the pitch, roll and yaw axes. Defaults to 3 seconds for each axis.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_Overshoot(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_Overshoot(const krpc_tuple_double_double_double_t *value)¶
The target overshoot percentage used to autotune the PID controllers. A vector of three values, between 0 and 1, for each of the pitch, roll and yaw axes. Defaults to 0.01 for each axis.
- Game Scenes:
Flight
-
krpc_error_t krpc_SpaceCenter_AutoPilot_PitchPIDGains(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_PitchPIDGains(const krpc_tuple_double_double_double_t *value)¶
Gains for the pitch PID controller.
- Game Scenes:
Flight
Note
When
krpc_SpaceCenter_AutoPilot_AutoTune()
is true, these values are updated automatically, which will overwrite any manual changes.
-
krpc_error_t krpc_SpaceCenter_AutoPilot_RollPIDGains(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_RollPIDGains(const krpc_tuple_double_double_double_t *value)¶
Gains for the roll PID controller.
- Game Scenes:
Flight
Note
When
krpc_SpaceCenter_AutoPilot_AutoTune()
is true, these values are updated automatically, which will overwrite any manual changes.
-
krpc_error_t krpc_SpaceCenter_AutoPilot_YawPIDGains(krpc_connection_t connection, krpc_tuple_double_double_double_t *result)¶
-
void krpc_SpaceCenter_AutoPilot_set_YawPIDGains(const krpc_tuple_double_double_double_t *value)¶
Gains for the yaw PID controller.
- Game Scenes:
Flight
Note
When
krpc_SpaceCenter_AutoPilot_AutoTune()
is true, these values are updated automatically, which will overwrite any manual changes.
-
krpc_error_t krpc_SpaceCenter_AutoPilot_Engage(krpc_connection_t connection)¶