Loading...
Searching...
No Matches
Rocket Class Reference

Represents a complete rocket vehicle composed of stages, motors, and recovery systems. More...

`#include <Rocket.h>`

## Public Member Functions

| Rocket (const std::string &name)
| Constructs a new Rocket with a given name.
| ~Rocket ()=default
| Default destructor.
double | getTotalMass () const
| Returns the total mass of the rocket (including all stages and payloads).
double | getTotalPropellantMass () const
| Returns the total remaining propellant mass of all motors.
double | getCenterOfGravity () const
| Returns the current center of gravity (CG) of the rocket.
double | getCenterOfPressure () const
| Returns the current center of pressure (CP) of the rocket.
double | getStabilityMargin () const
| Calculates the rocket's stability margin.
void | addStage (std::unique_ptr< Stage > stage)
| Adds a new stage to the rocket.
const std::vector< std::unique_ptr< Stage > > & | getStages () const
| Returns a const reference to the list of stages.
void | updateMassProperties ()
| Recalculates total mass, CG, CP, and stability margin.
void | prepareForFlight (const Environment &env)
| Prepares the rocket for flight simulation.
void | applyFlightState (const FlightState &state)
| Applies a given flight state to the rocket.
const std::string & | getName () const
| Gets the name of the rocket.
void | setName (const std::string &name)
| Sets the name of the rocket.

## Private Attributes

std::string | name_
| Name of the rocket.
std::vector< std::unique_ptr< Stage > > | stages_
| List of rocket stages.
double | totalMass_
| Total mass of the rocket [kg].
double | totalPropellantMass_
| Total remaining propellant mass [kg].
double | centerOfGravity_
| Center of gravity location [m].
double | centerOfPressure_
| Center of pressure location [m].

## Detailed Description

Represents a complete rocket vehicle composed of stages, motors, and recovery systems.

The Rocket class encapsulates the full vehicle configuration, including mass properties, center of gravity (CG), center of pressure (CP), and stability margin calculations. It is the central object for design, simulation, and flight state management.

## Constructor & Destructor Documentation

## Rocket()

Rocket::Rocket | ( | const std::string & | name | ) |

Constructs a new Rocket with a given name.

Parameters

  name | The name of the rocket.

## ~Rocket()

Rocket::~Rocket | ( |  | ) |

default

Default destructor.

## Member Function Documentation

## addStage()

void Rocket::addStage | ( | std::unique_ptr< Stage > | stage | ) |

Adds a new stage to the rocket.

Parameters

  stage | A unique_ptr to the Stage object to add.

## applyFlightState()

void Rocket::applyFlightState | ( | const FlightState & | state | ) |

Applies a given flight state to the rocket.

Intended for advanced simulation stages, including 6-DoF dynamics.

Parameters

  state | The current flight state.

## getCenterOfGravity()

double Rocket::getCenterOfGravity | ( |  | ) | const

Returns the current center of gravity (CG) of the rocket.

Returns
  Distance from reference point (e.g., nose tip) in meters.

## getCenterOfPressure()

double Rocket::getCenterOfPressure | ( |  | ) | const

Returns the current center of pressure (CP) of the rocket.

Returns
  Distance from reference point (e.g., nose tip) in meters.

## getName()

const std::string & Rocket::getName | ( |  | ) | const

Gets the name of the rocket.

Returns
  Rocket name as a constant reference.

## getStabilityMargin()

double Rocket::getStabilityMargin | ( |  | ) | const

Calculates the rocket's stability margin.

Defined as the normalized distance between CG and CP. Positive margin indicates stable configuration.

Returns
  Stability margin (calibers).

## getStages()

const std::vector< std::unique_ptr< Stage > > & Rocket::getStages | ( |  | ) | const

Returns a const reference to the list of stages.

Returns
  Vector of unique_ptr to Stage objects.

## getTotalMass()

double Rocket::getTotalMass | ( |  | ) | const

Returns the total mass of the rocket (including all stages and payloads).

Returns
  Total mass in kilograms.

## getTotalPropellantMass()

double Rocket::getTotalPropellantMass | ( |  | ) | const

Returns the total remaining propellant mass of all motors.

Returns
  Propellant mass in kilograms.

## prepareForFlight()

void Rocket::prepareForFlight | ( | const Environment & | env | ) |

Prepares the rocket for flight simulation.

Typically called once at simulation setup to adjust for environmental conditions.

Parameters

  env | The environment (atmospheric conditions) at launch.

## setName()

void Rocket::setName | ( | const std::string & | name | ) |

Sets the name of the rocket.

Parameters

  name | The new name.

## updateMassProperties()

void Rocket::updateMassProperties | ( |  | ) |

Recalculates total mass, CG, CP, and stability margin.

Should be called after any modification to the rocket structure.

## Member Data Documentation

## centerOfGravity_

double Rocket::centerOfGravity_

private

Center of gravity location [m].

## centerOfPressure_

double Rocket::centerOfPressure_

private

Center of pressure location [m].

## name_

std::string Rocket::name_

private

Name of the rocket.

## stages_

std::vector<std::unique_ptr<Stage> > Rocket::stages_

private

List of rocket stages.

## totalMass_

double Rocket::totalMass_

private

Total mass of the rocket [kg].

## totalPropellantMass_

double Rocket::totalPropellantMass_

private

Total remaining propellant mass [kg].

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

- include/Rocket.h
- src/Rocket.cpp