ast2000tools.space_mission.InterplanetaryTravel¶
-
class
ast2000tools.space_mission.
InterplanetaryTravel
(*args, **kwargs)¶ Bases:
ast2000tools.space_mission._SpacecraftJourney
Represents a journey with your spacecraft through interplanetary space.
Note
Do not create instances of this class directly, use
begin_interplanetary_travel()
instead.- Raises
RuntimeError – When initialized with a system where
verify_manual_orientation()
has not been called successfully.
Methods
boost
(delta_v)Adds the given velocity difference to the current spacecraft velocity and updates the amount of remaining fuel.
coast
(duration[, tolerance])Integrates the spacecraft trajectory for a given duration and updates the current position and velocity.
coast_until_time
(end_time[, tolerance])Integrates the spacecraft trajectory until a given end time and updates the current position and velocity.
finish_video
([filename, number_of_frames])Ends the recording and generates a corresponding video viewable in MCAst.
Makes the camera point towards a given angle relative to the direction of motion.
look_in_direction_of_planet
(planet_idx[, …])Makes the camera point towards a given angle relative to the direction of the planet.
look_in_fixed_direction
([polar_angle, …])Orients the camera in a fixed direction specified by the given spherical angles.
orient
()Returns the current time, spacecraft position and spacecraft velocity.
record_destination
(planet_idx)Saves the current time, spacecraft position and velocity, and destination planet index.
restart
()Resets the spacecraft and system to the initial state after launch.
set_camera_up_vector
(up_x, up_y, up_z)Specifies the up-vector to use for the camera.
Starts recording what the spacecraft/lander camera sees.
take_picture
([filename])Generates a picture viewable in MCAst, with framing decided by the current spacecraft camera orientation.
Attributes
The mission that the spacecraft journey is associated with.
The remaining fuel mass in kilograms.
The solar system in which the spacecraft journey takes place.
Whether non-essential messages will be printed during the journey.
Whether video is currently being recorded as the spacecraft moves.
-
property
mission
¶ The mission that the spacecraft journey is associated with.
- Type
-
property
system
¶ The solar system in which the spacecraft journey takes place.
-
coast
(duration, tolerance=1e-09)¶ Integrates the spacecraft trajectory for a given duration and updates the current position and velocity.
-
coast_until_time
(end_time, tolerance=1e-09)¶ Integrates the spacecraft trajectory until a given end time and updates the current position and velocity.
-
boost
(delta_v)¶ Adds the given velocity difference to the current spacecraft velocity and updates the amount of remaining fuel.
- Parameters
delta_v (1-D array_like) – Array of shape (2,) containing the x and y-component of the change in velocity, in astronomical units per year.
- Raises
RuntimeError – When running out of fuel.
-
orient
()¶ Returns the current time, spacecraft position and spacecraft velocity.
- Returns
float – The current time in years.
1-D
numpy.ndarray
– Array of shape (2,) containing the current position in astronomical units relative to the star.1-D
numpy.ndarray
– Array of shape (2,) containing the current velocity in astronomical units per second relative to the star.
-
take_picture
(filename='travel_picture.xml')¶ Generates a picture viewable in MCAst, with framing decided by the current spacecraft camera orientation.
- Parameters
filename (str, optional) – Name of the XML file to generate inside the data directory. Default is “travel_picture.xml”.
-
start_video
()¶ Starts recording what the spacecraft/lander camera sees.
- Raises
RuntimeError – When called while video mode is active.
-
finish_video
(filename='travel_video.xml', number_of_frames=1000)¶ Ends the recording and generates a corresponding video viewable in MCAst.
- Parameters
- Raises
RuntimeError – When called while video mode is not active.
-
look_in_fixed_direction
(polar_angle=1.5707963267948966, azimuth_angle=0)¶ Orients the camera in a fixed direction specified by the given spherical angles.
-
look_in_direction_of_planet
(planet_idx, relative_polar_angle=0, relative_azimuth_angle=0)¶ Makes the camera point towards a given angle relative to the direction of the planet.
- Parameters
planet_idx (int) – The index of the planet to track.
relative_polar_angle (float, optional) – The polar angle to offset the camera with relative to the direction towards the planet. Default is 0. Must be in the range [0, pi].
relative_azimuth_angle (float, optional) – The azimuthal angle to offset the camera with relative to the direction towards the planet. Default is 0.
-
look_in_direction_of_motion
(relative_polar_angle=0, relative_azimuth_angle=0)¶ Makes the camera point towards a given angle relative to the direction of motion.
- Parameters
relative_polar_angle (float, optional) – The polar angle to offset the camera with relative to the direction of motion. Default is 0. Must be in the range [0, pi].
relative_azimuth_angle (float, optional) – The azimuthal angle to offset the camera with relative to the direction of motion. Default is 0.
-
set_camera_up_vector
(up_x, up_y, up_z)¶ Specifies the up-vector to use for the camera.
-
record_destination
(planet_idx)¶ Saves the current time, spacecraft position and velocity, and destination planet index.
Note
The last recorded state is used as initial conditions for the landing procedure. You will only be able to initiate a landing sequence if the recorded position is sufficiently close to the specified planet.
- Parameters
planet_idx (int) – The index of the destination planet.
-
restart
()¶ Resets the spacecraft and system to the initial state after launch.
Note
If a new launch has been performed since the interplanetary travel began, the new post-launch state will be used as initial condition. But the new launch result must have been verified first.
Also be aware that any recorded destination state will be cleared.
- Raises
RuntimeError – When called while video recording is active.