ast2000tools.space_mission.LandingSequence¶
-
class
ast2000tools.space_mission.
LandingSequence
(mission, assume_uniform_gravity_atmosphere=True, verbose=True)¶ Bases:
ast2000tools.space_mission._SpacecraftJourney
Represents a landing process with your spacecraft at the destination planet.
Note
Do not create instances of this class directly, use
begin_landing_sequence()
instead.- Raises
RuntimeError – When called before the destination of the interplanetary travel has been recorded.
RuntimeError – When the recorded position is not sufficiently close to the destination planet.
Methods
Activates the landing thruster.
adjust_landing_thruster
([force, min_height])Modifies landing thruster parameters.
adjust_parachute_area
(area)Sets the parachute area.
boost
(delta_v)Adds the given velocity difference to the current spacecraft velocity.
Deploys the parachute.
fall
(duration[, tolerance])Integrates the spacecraft/lander trajectory for a given duration and updates the current position and velocity.
fall_until_time
(end_time[, tolerance])Integrates the spacecraft/lander 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.
launch_lander
(delta_v)Launches the landing module from the spacecraft with the given boost.
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, position and velocity for the spacecraft/lander.
restart
()Resets the spacecraft and system to the state at the beginning of the landing sequence.
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/lander camera orientation.
Attributes
Whether the landing module has been launched.
Whether the landing thruster has been activated.
The mission that the spacecraft journey is associated with.
Whether the parachute was destroyed.
Whether the parachute has been deployed.
Whether the surface has been reached.
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.
-
adjust_parachute_area
(area)¶ Sets the parachute area.
- Parameters
area (float) – The area to use for the parachute, in square meters.
- Raises
RuntimeError – When the parachute has already been deployed.
-
adjust_landing_thruster
(force=None, min_height=None)¶ Modifies landing thruster parameters.
Note
The default force and minimum height are both zero.
- Parameters
force (float, optional) – The force to use for the landing thruster, in Newtons. By default, the force remains at the previous value.
min_height (float, optional) – The height below which the thruster will be automatically activated, in meters. Cannot exceed 500 m. By default, the minimum height remains at the previous value.
- Raises
RuntimeError – When the landing thrusted has already been activated.
-
fall
(duration, tolerance=1e-09)¶ Integrates the spacecraft/lander trajectory for a given duration and updates the current position and velocity.
-
fall_until_time
(end_time, tolerance=1e-09)¶ Integrates the spacecraft/lander 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.
- Parameters
delta_v (1-D array_like) – Array of shape (3,) containing the x, y and z-component of the change in velocity, in meters per second.
- Raises
RuntimeError – When the landing module has been launched.
RuntimeError – When the lander has already been able to land.
-
launch_lander
(delta_v)¶ Launches the landing module from the spacecraft with the given boost.
- Parameters
delta_v (1-D array_like) – Array of shape (3,) containing the x and y-component of the change in velocity, in meters per seconds.
- Raises
RuntimeError – When the landing module has already been launched.
RuntimeError – When the spacecraft has already been able to land.
-
deploy_parachute
()¶ Deploys the parachute.
- Raises
RuntimeError – When the parachute has already been deployed.
RuntimeError – When the lander has already been able to land.
-
activate_landing_thruster
()¶ Activates the landing thruster.
Note
Does nothing if the lander is farther than 500 m from the surface.
- Raises
RuntimeError – When the landing thruster has already been activated.
RuntimeError – When the lander has already been able to land.
-
orient
()¶ Returns the current time, position and velocity for the spacecraft/lander.
- Returns
float – The current time after the initial landing sequence time, in seconds.
1-D
numpy.ndarray
– Array of shape (3,) containing the current position in meters relative to the planet center.1-D
numpy.ndarray
– Array of shape (3,) containing the current velocity in meters per second relative to the planet center.
-
take_picture
(filename='landing_picture.xml')¶ Generates a picture viewable in MCAst, with framing decided by the current spacecraft/lander camera orientation.
- Parameters
filename (str, optional) – Name of the XML file to generate inside the data directory. Default is “landing_picture.xml”.
-
start_video
()¶ Starts recording what the spacecraft/lander camera sees.
- Raises
RuntimeError – When called while video mode is active.
-
finish_video
(filename='landing_video.xml', number_of_frames=1000, radial_camera_offset=100000.0)¶ Ends the recording and generates a corresponding video viewable in MCAst.
- Parameters
filename (str, optional) – Name of the XML file to generate inside the data directory. Default is “landing_video.xml”.
number_of_frames (int, optional) – The number of video frames to generate. Default is 1000, but must be at least 100.
radial_camera_offset (float, optional) – The distance from the planet surface to offset the camera in order to avoid clipping during landing, in meters. Default is 10^5 meters.
- 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=None, 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, optional) – The index of the planet to track. By default the planet being landed on is used.
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.
-
restart
()¶ Resets the spacecraft and system to the state at the beginning of the landing sequence.
Note
If a new interplanetary travel destination has been recorded since the landing sequence began, the new destination state will be used as initial condition.
Also be aware that any recorded landing site coordinates will be cleared.
- Raises
RuntimeError – When called while video recording is active.