.. default-domain:: cpp .. highlight:: cpp .. namespace:: krpc::services::Trajectories Service ======= .. namespace:: krpc::services .. class:: Trajectories : public krpc::RemoteService Provides functionality to interact with Trajectories. .. note:: Trajectories predicts the trajectory of the active vessel only. .. function:: Trajectories(krpc::Connection& connection) Construct an instance of this service. .. function:: bool available() Whether Trajectories is available. .. function:: std::optional impact_patch() The patch of the trajectory that ends in an impact. :returns: The patch, or ``NULL`` without an impact. :Game Scenes: Flight .. function:: std::optional> impact_position(SpaceCenter::ReferenceFrame reference_frame) The position of the impact, or ``NULL`` without one. :Parameters: * **reference_frame** -- The reference frame for the position. :Game Scenes: Flight .. note:: In a reference frame that rotates with the body, the position includes the rotation of the body until the impact. .. function:: std::optional> impact_velocity(SpaceCenter::ReferenceFrame reference_frame) The velocity at the impact, or ``NULL`` without one. :Parameters: * **reference_frame** -- The reference frame for the velocity. :Game Scenes: Flight .. note:: In a reference frame that rotates with the body, the velocity includes the rotation of the body until the impact. .. function:: std::vector patches() The patches of the trajectory. :Game Scenes: Flight .. function:: std::optional> planned_direction(SpaceCenter::ReferenceFrame reference_frame) The direction that the descent profile sets for the vessel. :Parameters: * **reference_frame** -- The reference frame for the direction. :returns: The direction, or ``NULL`` without a target. :Game Scenes: Flight .. function:: std::optional> corrected_direction(SpaceCenter::ReferenceFrame reference_frame) The :func:`planned_direction`, corrected to steer towards the target. :Parameters: * **reference_frame** -- The reference frame for the direction. :returns: The direction, or ``NULL`` without a target. :Game Scenes: Flight .. note:: Suitable as the target direction of the auto-pilot. .. function:: void set_target(SpaceCenter::ReferenceFrame reference_frame, std::tuple position, std::optional body = std::optional()) Sets the target. :Parameters: * **reference_frame** -- The reference frame for the position. * **position** -- The position of the target. * **body** -- The body of the target, by default the body the active vessel orbits. :Game Scenes: Flight .. function:: std::optional target_body() The body of the target, or ``NULL`` without a target. :Game Scenes: Flight .. function:: std::optional> target_position(SpaceCenter::ReferenceFrame reference_frame) The position of the target, or ``NULL`` without a target. :Parameters: * **reference_frame** -- The reference frame for the position. :Game Scenes: Flight .. function:: void clear_target() Clears the target. :Game Scenes: Flight .. function:: DescentProfile descent_profile() The descent profile. :Game Scenes: Flight .. function:: bool always_update() .. function:: void set_always_update(bool value) Whether Trajectories updates the trajectory continuously. :Game Scenes: Flight .. note:: When ``false``, :func:`update_trajectory` updates the trajectory. .. function:: void update_trajectory() Updates the trajectory. :Game Scenes: Flight