simulation_start_epoch = 0.0 # s # Load spice kernels spice_interface.load_standard_kernels() # Define settings for celestial bodies bodies_to_create = ['Moon'] # Define coordinate system global_frame_origin = 'Moon' global_frame_orientation = 'ECLIPJ2000' # Create body settings # N.B.: all the bodies added after this function is called will automatically # be placed in the same reference frame, which is the same for the full # system of bodies body_settings = environment_setup.get_default_body_settings( bodies_to_create, global_frame_origin, global_frame_orientation) # Create bodies bodies = environment_setup.create_system_of_bodies(body_settings) ########################################################################### # CREATE VEHICLE ########################################################## ########################################################################### # Create vehicle object and add it to the existing system of bodies bodies.create_empty_body('Vehicle') # Set mass of vehicle bodies.get_body('Vehicle').set_constant_mass(vehicle_mass) ########################################################################### # CREATE ACCELERATIONS #################################################### ########################################################################### # Define bodies that are propagated and their central bodies of propagation
def create_simulation_bodies( itokawa_radius: float ) -> tudatpy.kernel.simulation.environment_setup.SystemOfBodies: """ It creates all the body settings and body objects required by the simulation. Parameters ---------- itokawa_radius : float Radius of Itokawa, assuming a spherical shape. Returns ------- tudatpy.kernel.simulation.environment_setup.SystemOfBodies System of bodies to be used in the simulation. """ ### CELESTIAL BODIES ### # Define Itokawa body frame name itokawa_body_frame_name = "Itokawa_Frame" # Create default body settings for selected celestial bodies bodies_to_create = ["Sun", "Earth", "Jupiter", "Saturn", "Mars"] # Create default body settings for bodies_to_create, with "Earth"/"J2000" as # global frame origin and orientation. This environment will only be valid # in the indicated time range [simulation_start_epoch --- simulation_end_epoch] body_settings = environment_setup.get_default_body_settings( bodies_to_create, "SSB", "ECLIPJ2000") # Add Itokawa body body_settings.add_empty_settings("Itokawa") # Gravity field definition itokawa_gravity_field_settings = get_itokawa_gravity_field_settings( itokawa_body_frame_name, itokawa_radius) # Adds Itokawa settings # Gravity field body_settings.get( "Itokawa").gravity_field_settings = itokawa_gravity_field_settings # Rotational model body_settings.get( "Itokawa").rotation_model_settings = get_itokawa_rotation_settings( itokawa_body_frame_name) # Ephemeris body_settings.get( "Itokawa").ephemeris_settings = get_itokawa_ephemeris_settings( itokawa_gravity_field_settings.gravitational_parameter) # Shape (spherical) body_settings.get("Itokawa").shape_settings = get_itokawa_shape_settings( itokawa_radius) # Create system of selected bodies bodies = environment_setup.create_system_of_bodies(body_settings) ### VEHICLE BODY ### # Create vehicle object bodies.create_empty_body("Spacecraft") bodies.get_body("Spacecraft").set_constant_mass(400.0) # Create radiation pressure settings, and add to vehicle reference_area_radiation = 4.0 radiation_pressure_coefficient = 1.2 radiation_pressure_settings = environment_setup.radiation_pressure.cannonball( "Sun", reference_area_radiation, radiation_pressure_coefficient) environment_setup.add_radiation_pressure_interface( bodies, "Spacecraft", radiation_pressure_settings) return bodies