Flight Class Usage#

The rocketpy.Flight class is the heart of RocketPy’s simulation engine. It takes a rocketpy.Rocket, an rocketpy.Environment, and launch parameters to simulate the complete flight trajectory of a rocket from launch to landing.

See also

For a complete example of Flight simulation, see the First Simulation guide.

Creating a Flight Simulation#

Basic Flight Creation#

The most basic way to create a Flight simulation requires three mandatory parameters: a rocket, an environment, and a rail length.

from rocketpy import Environment, SolidMotor, Rocket, Flight

# Assuming you have already defined env, motor, and rocket objects
# (See Environment, Motor, and Rocket documentation for details)

# Create a basic flight
flight = Flight(
    rocket=rocket,           # Your Rocket object
    environment=env,         # Your Environment object
    rail_length=5.2,         # Length of launch rail in meters
)

Once created, the Flight object automatically runs the simulation and stores all results internally.

Launch Parameters#

You can customize the launch conditions by specifying additional parameters:

flight_custom = Flight(
    rocket=rocket,
    environment=env,
    rail_length=5.2,
    inclination=85,          # Rail inclination angle (degrees from horizontal)
    heading=90,              # Launch direction (degrees from North)
)

Key Launch Parameters:

  • inclination: Rail inclination angle relative to ground (0° = horizontal, 90° = vertical)

  • heading: Launch direction in degrees from North (0° = North, 90° = East, 180° = South, 270° = West)

Understanding Flight Parameters#

Coordinate Systems and Positioning#

RocketPy uses a launch-centered coordinate system:

  • X-axis: Points East (positive values = East direction)

  • Y-axis: Points North (positive values = North direction)

  • Z-axis: Points upward (positive values = altitude above launch site)

The rocket’s position is tracked relative to the launch site throughout the flight.

Initial Conditions#

The Flight class automatically calculates appropriate initial conditions based on:

  • Rail inclination and heading angles

  • Rocket orientation (affected by rail button positions if present)

  • Environment conditions (wind, atmospheric properties)

You can also specify custom initial conditions by passing an initial_solution array or another Flight object to continue from a previous state.

Custom Initial Solution Vector

The initial_solution parameter accepts a 14-element array defining the complete initial state of the rocket:

initial_solution = [
    t_initial,    # Initial time (s)
    x_init,       # Initial X position - East coordinate (m)
    y_init,       # Initial Y position - North coordinate (m)
    z_init,       # Initial Z position - altitude above launch site (m)
    vx_init,      # Initial velocity in X direction - East (m/s)
    vy_init,      # Initial velocity in Y direction - North (m/s)
    vz_init,      # Initial velocity in Z direction - upward (m/s)
    e0_init,      # Initial Euler parameter 0 (quaternion scalar part)
    e1_init,      # Initial Euler parameter 1 (quaternion i component)
    e2_init,      # Initial Euler parameter 2 (quaternion j component)
    e3_init,      # Initial Euler parameter 3 (quaternion k component)
    w1_init,      # Initial angular velocity about rocket's x-axis (rad/s)
    w2_init,      # Initial angular velocity about rocket's y-axis (rad/s)
    w3_init       # Initial angular velocity about rocket's z-axis (rad/s)
]

Using a Previous Flight as Initial Condition

You can also continue a simulation from where another flight ended:

# Continue from the final state of a previous flight
continued_flight = Flight(
    rocket=rocket,
    environment=env,
    rail_length=0,  # Set to 0 when continuing from free flight
    initial_solution=flight  # Use previous Flight object
)

This is particularly useful for multi-stage simulations or when analyzing different scenarios from a specific flight condition.

Simulation Control Parameters#

Time Control:

  • max_time: Maximum simulation duration (default: 600 seconds)

  • max_time_step: Maximum integration step size (default: infinity)

  • min_time_step: Minimum integration step size (default: 0)

Note

These time control parameters can significantly help with integration stability in challenging simulation cases. This is particularly useful for liquid and hybrid motors, which often have more complex thrust curves and transient behaviors that can cause numerical integration difficulties.

Accuracy Control:

  • rtol: Relative tolerance for numerical integration (default: 1e-6)

  • atol: Absolute tolerance for numerical integration (default: auto-calculated)

Note

Increasing the tolerance values can speed up simulations but may reduce accuracy.

Simulation Behavior:

  • terminate_on_apogee: Stop simulation at apogee (default: False)

  • time_overshoot: Allow time step overshoot for efficiency (default: True)

Accessing Simulation Results#

Once a Flight simulation is complete, you can access a wealth of data about the rocket’s trajectory and performance.

Trajectory Data#

Basic position and velocity data:

# Position coordinates (as functions of time)
x_trajectory = flight.x          # East coordinate (m)
y_trajectory = flight.y          # North coordinate (m)
altitude = flight.z              # Altitude above launch site (m)

# Velocity components (as functions of time)
vx = flight.vx                   # East velocity (m/s)
vy = flight.vy                   # North velocity (m/s)
vz = flight.vz                   # Vertical velocity (m/s)

# Access specific values at given times
altitude_at_10s = flight.z(10)   # Altitude at t=10 seconds
max_altitude = flight.apogee     # Maximum altitude reached

Key Flight Events#

Important events during the flight:

# Rail departure
rail_departure_time = flight.out_of_rail_time
rail_departure_velocity = flight.out_of_rail_velocity

# Apogee
apogee_time = flight.apogee_time
apogee_altitude = flight.apogee
apogee_coordinates = (flight.apogee_x, flight.apogee_y)

# Landing/Impact
impact_time = flight.impact_state[0]
impact_velocity = flight.impact_velocity
impact_coordinates = (flight.x_impact, flight.y_impact)

Forces and Accelerations#

The Flight object provides access to all forces and accelerations acting on the rocket:

# Linear accelerations in inertial frame (m/s²)
ax = flight.ax                   # East acceleration
ay = flight.ay                   # North acceleration
az = flight.az                   # Vertical acceleration

# Aerodynamic forces in body frame (N)
R1 = flight.R1                   # X-axis aerodynamic force
R2 = flight.R2                   # Y-axis aerodynamic force
R3 = flight.R3                   # Z-axis aerodynamic force (drag)

# Aerodynamic moments in body frame (N⋅m)
M1 = flight.M1                   # Roll moment
M2 = flight.M2                   # Pitch moment
M3 = flight.M3                   # Yaw moment

Rail Button Forces and Bending Moments#

During the rail launch phase, RocketPy calculates reaction forces and internal bending moments at the rail button attachment points:

Rail Button Forces (N):

  • rail_button1_normal_force : Normal reaction force at upper rail button

  • rail_button1_shear_force : Shear (tangential) reaction force at upper rail button

  • rail_button2_normal_force : Normal reaction force at lower rail button

  • rail_button2_shear_force : Shear (tangential) reaction force at lower rail button

Rail Button Bending Moments (N⋅m):

  • rail_button1_bending_moment : Time-dependent bending moment at upper rail button attachment

  • max_rail_button1_bending_moment : Maximum absolute bending moment at upper rail button

  • rail_button2_bending_moment : Time-dependent bending moment at lower rail button attachment

  • max_rail_button2_bending_moment : Maximum absolute bending moment at lower rail button

Calculation Method:

Bending moments are calculated using beam theory assuming simple supports (rail buttons provide reaction forces but no moment reaction at rail contact). The total moment combines:

  1. Shear force × button height (cantilever moment from button standoff)

  2. Normal force × distance to center of dry mass (lever arm effect)

Moments are zero after rail departure and represent internal structural loads for airframe and fastener stress analysis. Requires button_height to be defined when adding rail buttons via rocket.set_rail_buttons().

Note

See Issue #893 for implementation details and validation approach.

Attitude and Orientation#

Rocket orientation throughout the flight:

# Euler parameters (quaternions)
e0, e1, e2, e3 = flight.e0, flight.e1, flight.e2, flight.e3

# Angular velocities in body frame (rad/s)
w1 = flight.w1                   # Roll rate
w2 = flight.w2                   # Pitch rate
w3 = flight.w3                   # Yaw rate

# Derived attitude angles
attitude_angle = flight.attitude_angle
path_angle = flight.path_angle

Performance Metrics#

Key performance indicators:

# Velocity and speed
total_speed = flight.speed
mach_number = flight.mach_number

# Stability indicators
static_margin = flight.static_margin
stability_margin = flight.stability_margin

Accessing Raw Simulation Data#

For users who need direct access to the raw numerical simulation results, the Flight object provides the complete solution array through the solution and solution_array attributes.

Flight.solution

The Flight.solution attribute contains the raw simulation data as a list of state vectors, where each row represents the rocket’s complete state at a specific time:

# Access the raw solution list
raw_solution = flight.solution

# Each element is a 14-element state vector:
# [time, x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
initial_state = flight.solution[0]  # First time step
final_state = flight.solution[-1]   # Last time step

print(f"Initial state: {initial_state}")
print(f"Final state: {final_state}")
Initial state: [0, 0, 0, 1400, 0, 0, 0, np.float64(0.7044160264027587), np.float64(-0.06162841671621935), np.float64(0.061628416716219346), np.float64(-0.7044160264027586), 0, 0, 0]
Final state: [48.97384735429946, np.float64(2020.2862925767809), np.float64(-4.050875520969148), np.float64(1399.9999925844877), np.float64(25.06142128431837), np.float64(-0.16036044304468022), np.float64(-332.7602403313761), np.float64(0.7044160264027587), np.float64(-0.06162841671621935), np.float64(0.061628416716219346), np.float64(-0.7044160264027586), np.float64(0.0), np.float64(0.0), np.float64(0.0)]

Flight.solution_array

For easier numerical analysis, use solution_array which provides the same data as a NumPy array:

import numpy as np

# Get solution as NumPy array for easier manipulation
solution_array = flight.solution_array  # Shape: (n_time_steps, 14)

# Extract specific columns (state variables)
time_array = solution_array[:, 0]        # Time values
position_data = solution_array[:, 1:4]   # X, Y, Z positions
velocity_data = solution_array[:, 4:7]   # Vx, Vy, Vz velocities
quaternions = solution_array[:, 7:11]    # e0, e1, e2, e3
angular_velocities = solution_array[:, 11:14]  # w1, w2, w3

# Example: Calculate velocity magnitude manually
velocity_magnitude = np.sqrt(np.sum(velocity_data**2, axis=1))

State Vector Format

Each row in the solution array follows this 14-element format:

[time, x, y, z, vx, vy, vz, e0, e1, e2, e3, w1, w2, w3]
Where:
  • time: Simulation time in seconds

  • x, y, z: Position coordinates in meters (East, North, Up)

  • vx, vy, vz: Velocity components in m/s (East, North, Up)

  • e0, e1, e2, e3: Euler parameters (quaternions) for attitude

  • w1, w2, w3: Angular velocities in rad/s (body frame: roll, pitch, yaw rates)

Getting State at Specific Time

You can extract the rocket’s state at any specific time during the flight:

# Get complete state vector at t=10 seconds
state_at_10s = flight.get_solution_at_time(10.0)

print(f"State at t=10s: {state_at_10s}")

# Extract specific values from the state vector
time_10s = state_at_10s[0]
altitude_10s = state_at_10s[3]  # Z coordinate
speed_10s = np.sqrt(state_at_10s[4]**2 + state_at_10s[5]**2 + state_at_10s[6]**2)

print(f"At t={time_10s}s: altitude={altitude_10s:.1f}m, speed={speed_10s:.1f}m/s")
State at t=10s: [ 9.90115629e+00  4.22777948e+02 -1.44711401e-01  3.36364247e+03
  4.63350579e+01 -3.35013414e-02  1.71332669e+02  7.04416026e-01
 -6.16284167e-02  6.16284167e-02 -7.04416026e-01  0.00000000e+00
  0.00000000e+00  0.00000000e+00]
At t=9.901156294200378s: altitude=3363.6m, speed=177.5m/s

This raw data access is particularly useful for:

  • Custom post-processing and analysis

  • Exporting data to external tools

  • Implementing custom flight metrics

  • Monte Carlo analysis and statistical studies

  • Integration with other simulation frameworks

Plotting Flight Data#

The Flight class provides comprehensive plotting capabilities through the plots attribute.

Trajectory Visualization#

# 3D trajectory plot
flight.plots.trajectory_3d()

# 2D trajectory (ground track)
flight.plots.linear_kinematics_data()

Flight Data Plots#

# Velocity and acceleration plots
flight.plots.linear_kinematics_data()

# Attitude and angular motion
flight.plots.attitude_data()
flight.plots.angular_kinematics_data()

# Flight path and orientation
flight.plots.flight_path_angle_data()

3D Flight Animation#

RocketPy can produce real-time interactive 3D animations of the simulated flight using PyVista, a scientific visualization library built on top of VTK. Two complementary animation modes are provided:

Method

What it shows

flight.plots.animate_trajectory()

The rocket 3D model moves through space following the simulated trajectory. The scene includes the simulated and flown paths, live telemetry, velocity and wind vectors, and flight-event markers.

flight.plots.animate_rotate()

The rocket 3D model stays centred in the scene; only its attitude is animated. A reference sphere, inertial horizon, body axes and live attitude/rate telemetry make the quaternion solution easier to inspect. Inertial velocity and wind directions are shown alongside the body axes.

Note

The animation normally opens in an interactive VTK window. A local desktop Python or Jupyter environment provides the best experience. A compatible PyVista Jupyter backend is required for inline notebook rendering.

Installation

The pyvista dependency is not installed by default. Add the optional extra before calling either animation method:

pip install rocketpy[animation]

If pyvista is not available when an animation method is called, RocketPy raises an ImportError with the above install command embedded in the message.

animate_trajectory — full 6-DOF trajectory animation

# Quickstart: uses RocketPy's built-in default STL rocket model
flight.plots.animate_trajectory()

# Customise the time window and frame rate
flight.plots.animate_trajectory(
    start=0.0,                    # start time in seconds (default: 0)
    stop=flight.t_final,          # end time in seconds (default: t_final)
    time_step=0.05,               # seconds per frame (default: 0.1)
    playback_speed=2.0,           # twice real-time playback (default: 1)
    background_color="#A8CBE0",   # optional launch-background override
    color_by="dynamic_pressure",   # speed, Mach, q, acceleration or altitude
    show_kinematic_plots=True,      # altitude, speed and acceleration
    camera_mode="follow",           # static, follow, ground or body
    trajectory_line_width=8,      # flown-path width (default: 4)
    show_subrocket_point=True,  # ground projection (default: True)
)

# Provide your own 3D model (any STL file)
flight.plots.animate_trajectory(
    file_name="my_rocket.stl",
    start=0.0,
    stop=flight.t_final,
    time_step=0.05,
)

animate_rotate — attitude-only animation

Useful for inspecting roll, pitch, and yaw behaviour without the distraction of the trajectory translation. The rocket mesh remains centred and rotates in an East-North-Up inertial reference scene according to the quaternion solution.

flight.plots.animate_rotate(
    start=0.0,
    stop=flight.t_final,
    time_step=0.05,
    show_attitude_plots=True,
    show_cp_cm=True,
)

Deterministic export uses a fixed simulation-time grid derived from the output frame rate and playback_speed:

flight.plots.animate_trajectory(
    export_file="flight.mp4",
    export_fps=30,
    export_resolution=(1920, 1080),
    camera_mode="follow",
)

Parameters

Both methods share the same signature:

Parameter

Default

Description

file_name

None

Path to a .stl model file. When None, the built-in default rocket shape packaged with RocketPy is used.

start

0

Animation start time in seconds. Must be within [0, flight.t_final].

stop

None

Animation end time in seconds. None defaults to flight.t_final.

time_step

0.1

Simulation-time interval between frames, in seconds. Smaller values produce smoother interactive playback at the cost of more rendering work. Must be > 0.

playback_speed

1.0

Ratio of simulation time to wall-clock time. For example, 2 plays at twice real time. Must be > 0. The animation control strip always provides 0.5x, 1x, 2x and 3x choices.

**kwargs

RocketPy visualization options listed below, plus arguments forwarded to pyvista.Plotter, such as window_size, notebook or off_screen.

The following RocketPy-specific options are supplied through **kwargs and are removed before the remaining arguments are forwarded to PyVista:

Keyword

Default

Description

background_color

None

Color-like launch-background override, such as "#A8CBE0", "lightblue" or an RGB tuple. None selects daylight or night colors from the environment’s local launch time.

playback_controls

True

Show the play/pause button, draggable flight-time bar and playback-speed selector.

show_subrocket_point

True

In the trajectory view, show the rocket’s vertical projection onto the ground plane.

ground_image

None

Path, pyvista.Texture, or mapping with image, bounds, coordinates and optional flip_y entries. Explicit bounds place the image geographically instead of fitting it to the trajectory.

ground_image_bounds

None

Image bounds (west, east, south, north) in ENU metres or longitude and latitude, according to ground_image_coordinates.

ground_image_coordinates

"enu"

Ground-bound coordinate system: "enu" or "latlon". Latitude and longitude bounds use a local equirectangular conversion around the environment launch coordinates.

ground_image_flip_y

False

Flip the texture vertically when required by the source image’s row orientation.

color_by

"speed"

Color the trajectory by "speed", "mach", "dynamic_pressure", "acceleration" or "altitude". Use False or None for fixed path colors.

show_kinematic_plots

False

Show synchronized altitude AGL, speed and acceleration histories in SI units in either animation.

camera_mode

"static"

Camera preset: "static", "follow", "ground" or "body". True selects "follow" and False selects "static".

camera_path

None

Callable receiving flight time and returning a PyVista camera position, or two or more camera positions interpolated uniformly over the selected time interval. Overrides camera_mode.

show_attitude_plots

False

In animate_rotate, show synchronized angle-of-attack and sideslip, 3-1-3 Euler-angle, and body-angular-rate histories.

show_cp_cm

False

In animate_rotate, show dynamic center-of-mass and center-of-pressure markers plus their physical stations and static margin in telemetry.

export_file

None

Deterministically export to a .gif or .mp4 instead of opening an interactive animation.

export_fps

30

Export frame rate. Simulation time advances by playback_speed / fps between output frames.

export_resolution

None

Output (width, height) in pixels. The normal window size is used when omitted.

transparent_background

False

Request an alpha background for GIF export. MP4 does not support this option.

color_scheme

None

Mapping of keys from _animation_color_scheme() to replacement colors or colormap names. Overrides are merged into the default scheme.

backend

"auto"

Visualization backend: "auto", "none", "trame" or "client".

force_external

False

Force an external rendering window. This sets the plotter’s notebook and off_screen options to False and overrides backend with "none".

shadows

False

Enable scene shadows. Colored paths, event points and direction vectors remain unlit so their colors do not darken as the camera moves.

trajectory_line_width

7

Width of the flown trajectory line. The simulated-path width scales proportionally from this value.

Tips

  • A time_step of 0.05 (20 fps) is a good balance between smoothness and performance for flights lasting tens of seconds.

  • Use the mouse to orbit, pan and zoom; press q or close the PyVista window to exit.

  • Use PLAY / PAUSE to stop or resume the animation, drag FLIGHT TIME to inspect any simulated instant, and use the speed selector to change playback between 0.5x, 1x, 2x and 3x. Replaying after the end restarts at start.

  • The trajectory view display-scales the rocket so it remains visible while all coordinates, paths and telemetry retain their physical SI values.

  • Scalar trajectory coloring uses one fixed color range over the selected time interval, so colors remain comparable while scrubbing and exporting.

  • Fixed-size markers identify the selected interval’s start and end, motor burnout, apogee, and each parachute trigger and fully-open time when present.

  • The cyan ground-projection point tracks the rocket’s horizontal position; set show_subrocket_point=False to hide it.

  • Wind arrows point toward the direction in which the air mass is moving.

  • With no background override, launch times from 06:00 through 19:59 local time use a light sky palette and other launch times use a night palette. If the environment has no launch date, RocketPy assumes daylight. The background blends linearly toward near-space navy between launch altitude and 50 km AGL; this is a visual cue rather than an atmospheric or solar model.

  • Telemetry and legends use compact bordered annotation boxes so their values remain readable over both daylight and night backgrounds.

  • Center-of-mass and center-of-pressure markers preserve their physical axial ordering and separation but are mapped onto the display model, whose geometry may not match the simulated rocket exactly.

  • Both methods validate start, stop, time_step, and the STL path before any rendering begins, raising a ValueError with a descriptive message on invalid input.

Forces and Moments#

# Aerodynamic forces
flight.plots.aerodynamic_forces()

# Rail button forces (if applicable)
flight.plots.rail_buttons_forces()

Energy Analysis#

# Energy plots
flight.plots.energy_data()

# Stability analysis
flight.plots.stability_and_control_data()

Comprehensive Analysis#

For a complete overview of all plots:

# Show all available plots
flight.all_info()

Initial Conditions

Initial time: 0.000 s
Position - x: 0.00 m | y: 0.00 m | z: 1400.00 m
Velocity - Vx: 0.00 m/s | Vy: 0.00 m/s | Vz: 0.00 m/s
Attitude (quaternions) - e0: 0.704 | e1: -0.062 | e2: 0.062 | e3: -0.704
Euler Angles - Spin φ : 0.00° | Nutation θ: -10.00° | Precession ψ: -90.00°
Angular Velocity - ω1: 0.00 rad/s | ω2: 0.00 rad/s | ω3: 0.00 rad/s
Initial Stability Margin: -1.836 c


Surface Wind Conditions

Frontal Surface Wind Speed: 0.00 m/s
Lateral Surface Wind Speed: 0.00 m/s


Launch Rail

Launch Rail Length: 5.2 m
Launch Rail Inclination: 80.00°
Launch Rail Heading: 90.00°


Rail Departure State

Rail Departure Time: 0.415 s
Rail Departure Velocity: 30.492 m/s
Rail Departure Stability Margin: -1.742 c
Rail Departure Angle of Attack: 0.000°
Rail Departure Thrust-Weight Ratio: 10.303
Rail Departure Reynolds Number: 2.373e+05


Burn out State

Burn out time: 3.900 s
Altitude at burn out: 2049.777 m (ASL) | 649.777 m (AGL)
Rocket speed at burn out: 280.008 m/s
Freestream velocity at burn out: 280.008 m/s
Mach Number at burn out: 0.844
Kinetic energy at burn out: 6.367e+05 J


Apogee State

Apogee Time: 25.343 s
Apogee Altitude: 4616.036 m (ASL) | 3216.036 m (AGL)
Apogee Freestream Speed: 42.593 m/s
Apogee X position: 1096.575 m
Apogee Y position: -1.080 m
Apogee latitude: 32.9902437°
Apogee longitude: -106.9632421°


Parachute Events

No Parachute Events Were Triggered.


Impact Conditions

Time of impact: 48.974 s
X impact: 2020.286 m
Y impact: -4.051 m
Altitude impact: 1400.000 m (ASL) | -0.000 m (AGL) 
Latitude: 32.9902157°
Longitude: -106.9533393°
Vertical velocity at impact: -332.760 m/s
Number of parachutes triggered until impact: 0


Stability Margin

Initial Stability Margin: -1.836 c at 0.00 s
Out of Rail Stability Margin: -1.742 c at 0.41 s
Maximum Stability Margin: -0.825 c at 3.91 s
Minimum Stability Margin: -1.836 c at 0.00 s


Maximum Values

Maximum Speed: 333.703 m/s at 48.97 s
Maximum Mach Number: 0.997 Mach at 48.97 s
Maximum Reynolds Number: 2.599e+06 at 48.97 s
Maximum Dynamic Pressure: 5.949e+04 Pa at 48.97 s
Maximum Acceleration During Motor Burn: 105.172 m/s² at 0.15 s
Maximum Gs During Motor Burn: 10.725 g at 0.15 s
Maximum Acceleration After Motor Burn: 38.552 m/s² at 48.97 s
Maximum Gs After Motor Burn: 3.931 Gs at 48.97 s
Maximum Stability Margin: -0.825 c at 3.91 s



Numerical Integration Settings

Maximum Allowed Flight Time: 600.00 s
Maximum Allowed Time Step: inf s
Minimum Allowed Time Step: 0.00e+00 s
Relative Error Tolerance: 1e-06
Absolute Error Tolerance: [0.001, 0.001, 0.001, 0.001, 0.001, 0.001, 1e-06, 1e-06, 1e-06, 1e-06, 0.001, 0.001, 0.001]
Allow Event Overshoot: True
Terminate Simulation on Apogee: False
Number of Time Steps Used: 220
Number of Derivative Functions Evaluation: 432
Average Function Evaluations per Time Step: 1.964



Trajectory 3d Plot

../_images/flight_11_1.png


Trajectory Kinematic Plots

../_images/flight_11_3.png


Angular Position Plots

../_images/flight_11_5.png


Path, Attitude and Lateral Attitude Angle Plots

../_images/flight_11_7.png


Trajectory Angular Velocity and Acceleration Plots

../_images/flight_11_9.png


Aerodynamic Forces Plots

../_images/flight_11_11.png


Rail Buttons Bending Moments Plots



Rail Buttons Forces Plots



Trajectory Energy Plots

../_images/flight_11_15.png


Trajectory Fluid Mechanics Plots

../_images/flight_11_17.png


Trajectory Stability and Control Plots

../_images/flight_11_19.png


Rocket and Parachute Pressure Plots

../_images/flight_11_21.png

Printing Flight Information#

The Flight class also provides detailed text output through the prints attribute.

Flight Summary#

# Complete flight information
flight.info()

# All detailed information
flight.all_info()

Specific Information Sections#

# Initial conditions
flight.prints.initial_conditions()

# Wind and environment conditions
flight.prints.surface_wind_conditions()

# Launch rail information
flight.prints.launch_rail_conditions()

# Rail departure conditions
flight.prints.out_of_rail_conditions()

# Motor burn out conditions
flight.prints.burn_out_conditions()

# Apogee conditions
flight.prints.apogee_conditions()

# Landing/impact conditions
flight.prints.impact_conditions()

# Maximum values during flight
flight.prints.maximum_values()

Advanced Features#

Custom Equations of Motion#

RocketPy supports different sets of equations of motion:

# Standard 6-DOF equations (default)
flight_6dof = Flight(
    rocket=rocket,
    environment=env,
    rail_length=5.2,
    equations_of_motion="standard"
)

# Simplified solid propulsion equations (legacy)
# This may run a bit faster with no accuracy loss, but only works for solid motors
flight_simple = Flight(
    rocket=rocket,
    environment=env,
    rail_length=5.2,
    equations_of_motion="solid_propulsion"
)

Integration Method Selection#

You can choose different numerical integration methods using the ode_solver parameter. RocketPy supports the following integration methods from scipy.integrate.solve_ivp:

Available ODE Solvers:

  • ‘LSODA’ (default): Recommended for most flights. Automatically switches between stiff and non-stiff methods

  • ‘RK45’: Explicit Runge-Kutta method of order 5(4). Good for non-stiff problems

  • ‘RK23’: Explicit Runge-Kutta method of order 3(2). Faster but less accurate than RK45

  • ‘DOP853’: Explicit Runge-Kutta method of order 8. High accuracy for smooth problems

  • ‘Radau’: Implicit Runge-Kutta method of order 5. Good for stiff problems

  • ‘BDF’: Implicit multi-step variable-order method. Efficient for stiff problems

# High-accuracy integration (default, recommended for most cases)
flight_default = Flight(
    rocket=rocket,
    environment=env,
    rail_length=5.2,
    ode_solver="LSODA"
)

# Fast integration for quick simulations
flight_fast = Flight(
    rocket=rocket,
    environment=env,
    rail_length=5.2,
    ode_solver="RK45"
)

# Very high accuracy for smooth problems
flight_high_accuracy = Flight(
    rocket=rocket,
    environment=env,
    rail_length=5.2,
    ode_solver="DOP853"
)

# For stiff problems (e.g., complex motor thrust curves)
flight_stiff = Flight(
    rocket=rocket,
    environment=env,
    rail_length=5.2,
    ode_solver="BDF"
)

You can also pass a custom scipy.integrate.OdeSolver object for advanced use cases. For more information on integration methods, see the scipy documentation.

Exporting Flight Data#

You can export flight data for external analysis:

# Convert to dictionary format
flight_data = flight.to_dict(include_outputs=True)
# NOTE: RocketPy offers an unofficial json serializer, see rocketpy._encoders for details

Common Issues and Solutions#

Integration Problems:

  • Reduce max_time_step for more accuracy

  • Increase rtol for faster but less accurate simulations

  • Check rocket and environment definitions for unrealistic values

Missing Events:

  • Ensure max_time is sufficient for complete flight

  • Verify parachute trigger conditions

  • Check for premature termination conditions

  • You can set verbose=True in the Flight constructor to get detailed logs during simulation

Performance Issues:

  • Set time_overshoot=True for better performance

  • Use simpler integration methods for quick runs

  • Consider reducing the complexity of atmospheric models