.. default-domain:: c .. highlight:: c Debug ===== .. type:: krpc_KSA_Debug_t Changes the state of the simulation directly, as the game's debug windows and console commands do: teleporting a vehicle, setting its attitude, refilling its tanks. .. function:: krpc_error_t krpc_KSA_Debug_SetCircularOrbit(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, krpc_KSA_Body_t body, double altitude) Move a vehicle onto a circular orbit around a body, and return once it is there. :Parameters: * **vehicle** -- The vehicle. * **body** -- The body to orbit. * **altitude** -- The altitude of the orbit above the mean radius, in meters. .. note:: Throws an exception if the game cannot compute the vehicle's trajectory on the orbit. .. function:: krpc_error_t krpc_KSA_Debug_SetOrbit(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, krpc_KSA_Body_t body, double semiMajorAxis, double eccentricity, double inclination, double longitudeOfAscendingNode, double argumentOfPeriapsis, double meanAnomalyAtEpoch, double epoch) Move a vehicle onto the orbit with the given elements, and return once it is there. The angles are those of :type:`krpc_KSA_Orbit_t`. :Parameters: * **vehicle** -- The vehicle. * **body** -- The body to orbit. * **semiMajorAxis** -- The semi-major axis, in meters. * **eccentricity** -- The eccentricity. * **inclination** -- The inclination, in radians. * **longitudeOfAscendingNode** -- The longitude of the ascending node, in radians. * **argumentOfPeriapsis** -- The argument of periapsis, in radians. * **meanAnomalyAtEpoch** -- The mean anomaly at the epoch, in radians. * **epoch** -- The universal time of the epoch, in seconds. .. note:: Throws an exception if the game cannot compute the vehicle's trajectory on the orbit. .. function:: krpc_error_t krpc_KSA_Debug_SetLanded(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, krpc_KSA_Body_t body, double latitude, double longitude) Place a vehicle on the surface of a body, as the game's teleport window does, and return once it is there. :Parameters: * **vehicle** -- The vehicle. * **body** -- The body to land on. * **latitude** -- The latitude, in degrees. * **longitude** -- The longitude, in degrees. .. note:: Throws an exception if the body has no surface. .. function:: krpc_error_t krpc_KSA_Debug_SetPosition(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, const krpc_tuple_double_double_double_t * position, krpc_KSA_ReferenceFrame_t referenceFrame) Move a vehicle to the given position, keeping its velocity, and return once it is there. :Parameters: * **vehicle** -- The vehicle. * **position** -- The position of the vehicle, in meters. * **referenceFrame** -- The reference frame of the position. .. note:: This is the inverse of :func:`krpc_KSA_Vehicle_Position`. The vehicle keeps orbiting the same body. .. function:: krpc_error_t krpc_KSA_Debug_SetVelocity(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, const krpc_tuple_double_double_double_t * velocity, krpc_KSA_ReferenceFrame_t referenceFrame) Set the velocity of a vehicle, keeping its position, and return once it is set. :Parameters: * **vehicle** -- The vehicle. * **velocity** -- The velocity of the vehicle, in meters per second. * **referenceFrame** -- The reference frame of the velocity. .. note:: This is the inverse of :func:`krpc_KSA_Vehicle_Velocity`. The vehicle keeps orbiting the same body. .. function:: krpc_error_t krpc_KSA_Debug_SetRotation(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, const krpc_tuple_double_double_double_double_t * rotation, krpc_KSA_ReferenceFrame_t referenceFrame) Set the rotation of a vehicle, and return once it is set. :Parameters: * **vehicle** -- The vehicle. * **rotation** -- The rotation of the vehicle, as a quaternion of the form ``(x, y, z, w)``. * **referenceFrame** -- The reference frame of the rotation. .. note:: This is the inverse of :func:`krpc_KSA_Vehicle_Rotation`. .. function:: krpc_error_t krpc_KSA_Debug_SetAngularVelocity(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle, const krpc_tuple_double_double_double_t * angularVelocity, krpc_KSA_ReferenceFrame_t referenceFrame) Set the angular velocity of a vehicle, and return once it is set. :Parameters: * **vehicle** -- The vehicle. * **angularVelocity** -- The angular velocity, in radians per second. The vector points along the axis of rotation, and its length is the rate. * **referenceFrame** -- The reference frame of the angular velocity. .. note:: This is the inverse of :func:`krpc_KSA_Vehicle_AngularVelocity`. .. function:: krpc_error_t krpc_KSA_Debug_FillResources(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle) Fill the propellant, batteries and other consumables of a vehicle, as the game's refill command does. :Parameters: * **vehicle** -- The vehicle. .. function:: krpc_error_t krpc_KSA_Debug_EmptyResources(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle) Empty the propellant, batteries and other consumables of a vehicle, as the game's empty command does. :Parameters: * **vehicle** -- The vehicle. .. function:: krpc_error_t krpc_KSA_Debug_DuplicateVehicle(krpc_connection_t connection, krpc_KSA_Vehicle_t * returnValue, krpc_KSA_Vehicle_t vehicle, const char * name) Create a copy of a vehicle beside it, as the game's duplicate command does, and return once it is created. :Parameters: * **vehicle** -- The vehicle to copy. * **name** -- The name of the copy. :returns: The copy. .. note:: Throws an exception if the name is in use. .. function:: krpc_error_t krpc_KSA_Debug_ExplodeVehicle(krpc_connection_t connection, krpc_KSA_Vehicle_t vehicle) Destroy a vehicle in an explosion, as the game's explode command does, and return once the vehicle is gone. Its crew are killed. :Parameters: * **vehicle** -- The vehicle. .. function:: krpc_error_t krpc_KSA_Debug_ShowVelocityArrows(krpc_connection_t connection, bool visible) Show or hide the game's debug arrows for the velocities of the vehicles. :Parameters: * **visible** -- Whether to show the arrows. .. function:: krpc_error_t krpc_KSA_Debug_RunCommand(krpc_connection_t connection, krpc_list_string_t * returnValue, const char * command) Run a command in the game's console, as typed in the console. :Parameters: * **command** -- The command and its arguments. :returns: The console output of the command, one line per message. .. note:: Most commands write their messages to the game's log, not the returned output. Throws an exception if the console has no such command, or the arguments are not valid.