Loading...
Searching...
No Matches
FlightSimulator Class Reference

Manages the simulation of a rocket flight from launch to landing. More...

`#include <FlightSimulator.h>`

## Public Member Functions

| FlightSimulator (std::shared_ptr< Rocket > rocket, std::shared_ptr< Environment > environment)
| Constructs a new FlightSimulator.
| ~FlightSimulator ()=default
| Default destructor.
void | run (double maxSimulationTime, double timeStep)
| Runs the full flight simulation.
const std::vector< FlightState > & | getFlightLog () const
| Returns the recorded flight states over time.

## Private Member Functions

void | initialize ()
| Initializes simulation (prepare rocket, set initial conditions).
void | step (double deltaTime)
| Advances the simulation by one time step.
void | handleEvents (FlightState &state)
| Detects and processes key events (burnout, separation, recovery).
bool | checkTermination (const FlightState &state)
| Checks if simulation termination conditions are met (e.g., landed).
void | updateMotors (double deltaTime)

## Private Attributes

std::shared_ptr< Rocket > | rocket_
| Rocket being simulated.
std::shared_ptr< Environment > | environment_
| Atmospheric and gravity conditions.
std::shared_ptr< ForcesModel > | forcesModel_
| Computes forces and moments on the rocket.
std::unique_ptr< Integrator > | integrator_
| Integrates equations of motion.
std::vector< FlightState > | flightLog_
| Time history of flight state snapshots.
bool | hasLaunched_ = false
| Have we left the lauch pad/rail?

## Detailed Description

Manages the simulation of a rocket flight from launch to landing.

The FlightSimulator coordinates the rocket, environment, force models, and numerical integration to simulate rocket flight dynamics over time.

## Constructor & Destructor Documentation

## FlightSimulator()

FlightSimulator::FlightSimulator | ( | std::shared_ptr< Rocket > | rocket,
|  | std::shared_ptr< Environment > | environment )

Constructs a new FlightSimulator.

Parameters

  rocket | Pointer to the rocket to simulate.
  environment | Pointer to the launch environment.

## ~FlightSimulator()

FlightSimulator::~FlightSimulator | ( |  | ) |

default

Default destructor.

## Member Function Documentation

## checkTermination()

bool FlightSimulator::checkTermination | ( | const FlightState & | state | ) |

private

Checks if simulation termination conditions are met (e.g., landed).

Parameters

  state | Current flight state.

Returns
  True if simulation should stop.

Here is the call graph for this function:
Here is the caller graph for this function:

## getFlightLog()

const std::vector< FlightState > & FlightSimulator::getFlightLog | ( |  | ) | const

Returns the recorded flight states over time.

Returns
  Vector of FlightState snapshots.

Here is the caller graph for this function:

## handleEvents()

void FlightSimulator::handleEvents | ( | FlightState & | state | ) |

private

Detects and processes key events (burnout, separation, recovery).

Parameters

  state | Current flight state.

Here is the caller graph for this function:

## initialize()

void FlightSimulator::initialize | ( |  | ) |

private

Initializes simulation (prepare rocket, set initial conditions).

Here is the caller graph for this function:

## run()

void FlightSimulator::run | ( | double | maxSimulationTime,
|  | double | timeStep )

Runs the full flight simulation.

Parameters

  maxSimulationTime | Maximum allowable simulation time (seconds).
  timeStep | Initial time step for integration (seconds).

Here is the call graph for this function:
Here is the caller graph for this function:

## step()

void FlightSimulator::step | ( | double | deltaTime | ) |

private

Advances the simulation by one time step.

Parameters

  deltaTime | The time step size (seconds).

Here is the call graph for this function:
Here is the caller graph for this function:

## updateMotors()

void FlightSimulator::updateMotors | ( | double | deltaTime | ) |

private

Here is the caller graph for this function:

## Member Data Documentation

## environment_

std::shared_ptr<Environment> FlightSimulator::environment_

private

Atmospheric and gravity conditions.

## flightLog_

std::vector<FlightState> FlightSimulator::flightLog_

private

Time history of flight state snapshots.

## forcesModel_

std::shared_ptr<ForcesModel> FlightSimulator::forcesModel_

private

Computes forces and moments on the rocket.

## hasLaunched_

bool FlightSimulator::hasLaunched_ = false

private

Have we left the lauch pad/rail?

## integrator_

std::unique_ptr<Integrator> FlightSimulator::integrator_

private

Integrates equations of motion.

## rocket_

std::shared_ptr<Rocket> FlightSimulator::rocket_

private

Rocket being simulated.

The documentation for this class was generated from the following files:

- include/FlightSimulator.h
- src/FlightSimulator.cpp