Rotational Dynamics

Settings to propagate the rotational state of a body numerically can be created through the rotational() factory function, described in detail in the API documentation. In the current page, only the Tudat-specific aspects of the input will be briefly described. The default (processed) representation for solving the rotational equations of motion is by using a vector of 7 elements:

  • The quaternion elements (vector \(\mathbf{q}\) of size 4) of the rotation from body-fixed to inertial frame (see Definition of rotational state)

  • The angular velocity (vector \(\boldsymbol{\omega}\) of size 3) of the body w.r.t. the inertial frame, expressed in the body-fixed frame.

Several other formulations can be used if wanted (see below and Processed vs. Propagated State Elements).

Inputs

In addition to the settings described here, the definition of rotational dynamics settings requires:

  • A set of torque models (see Torque Model Setup);

  • The initial conditions for the propagation (rotational state as \([\mathbf{q};\boldsymbol{\omega}]\) and time)

  • A propagator type, since the rotational state can have different representations (listed in RotationalPropagatorType; default is quaternions and angular velocity).

Warning

The initial state must be provided as processed state formulation \([\mathbf{q};\boldsymbol{\omega}]\), regardless of the propagator type

Example

In the example below, the body “Spacecraft” will be propagated w.r.t. body “Earth”, using given torque models. A given initial state which defines the orientation of “Spacecraft” w.r.t. the inertial reference frame is defined. A Runge Kutta 4 integrator is defined with step-size of 2 seconds. The propagation will terminate once the simulation_end_epoch termination condition is reached. A rotational propagator that uses quaternions is defined. Next to that, the propagator is asked to save the total torque norm as dependent variable. The time and rotational state will be printed on the terminal once every 24 hours (simulation time).

Required Show/Hide

from tudatpy.kernel.numerical_simulation import propagation_setup
from tudatpy.kernel.astro import element_conversion
import numpy as np
# Create physical environment
bodies = environment_setup.create_system_of_bodies( ... )

# Define bodies that are propagated
bodies_to_propagate = ["Spacecraft"]

# Define torque models
# Define torque settings acting on spacecraft
torque_settings_spacecraft = dict( Sun=[propagation_setup.torque.second_degree_gravitational()])
torque_settings = {"Spacecraft": torque_settings_spacecraft}

# Create torque models.
torque_models = propagation_setup.create_torque_models( 
    bodies, torque_settings, bodies_to_propagate) 

# Below, we define the initial state in a somewhat trivial manner (body axes along global frame
# axes; no initial rotation). A real application should use a more realistic initial rotational state
# Set initial rotation matrix (identity matrix)
initial_rotation_matrix = np.eye(3)
# Set initial orientation by converting a rotation matrix to a Tudat-compatible quaternion
initial_state = element_conversion.rotation_matrix_to_quaternion_entries(initial_rotation_matrix)
# Complete initial state by adding angular velocity vector (zero in this case)
initial_state.append([0,0,0])

# Define numerical integrator (RK4; step size 2 seconds)
integrator_settings = propagation_setup.integrator.runge_kutta_4( 2.0 )

# Start of simulation
simulation_start_epoch = 9120.0 * constants.JULIAN_DAY 

# Define termination settings
simulation_end_epoch = 9140.0 * constants.JULIAN_DAY
termination_settings = propagation_setup.propagator.time_termination(
    simulation_end_epoch )

# Define propagator type
propagator_type = propagation_setup.propagator.modified_rodrigues_parameters

# Define dependent variables
dependent_variables_to_save = [propagation_setup.dependent_variable.total_torque_norm("Spacecraft")]

# Define rotational propagator settings
rotational_propagator_settings = propagation_setup.propagator.rotational(
    torque_models,
    bodies_to_propagate,
    initial_state,
    simulation_start_epoch,
    integrator_settings,
    termination_settings,
    propagator=propagator_type,
    output_variables=dependent_variables_to_save)