Avionics
Core avionics package for CURE flight computers
Loading...
Searching...
No Matches
ApogeeDetector Class Reference

Detects the apogee (peak altitude) of a rocket flight using estimated altitude and vertical velocity. More...

#include <ApogeeDetector.h>

Collaboration diagram for ApogeeDetector:
Collaboration graph

Public Member Functions

 ApogeeDetector (float apogeeThreshold_m)
 Constructs an ApogeeDetector with a custom drop threshold.
 ApogeeDetector ()
 Constructs an ApogeeDetector with the default threshold of 1.0 meter.
void init (ApogeeDetectorInitialState initialState)
 Initializes the detector with the starting altitude and timestamp.
void update (VerticalVelocityEstimator *verticalVelocityEstimator)
 Updates the detector using the latest estimated altitude and vertical velocity.
bool isApogeeDetected () const
 Checks if apogee has been detected.
DataPoint getApogee () const
 Retrieves the detected apogee.
float getEstimatedAltitude () const
 Gets the current estimated altitude.
float getEstimatedVelocity () const
 Gets the current estimated vertical velocity.
float getInertialVerticalAcceleration () const
 Gets the current inertial vertical acceleration.
int8_t getVerticalAxis () const
 Gets the configured vertical axis.
int8_t getVerticalDirection () const
 Gets the configured vertical direction (+1 or -1).

Detailed Description

Detects the apogee (peak altitude) of a rocket flight using estimated altitude and vertical velocity.

The detector uses data from a VerticalVelocityEstimator (e.g., a Kalman filter fusing an altimeter and accelerometer). Apogee is detected when:

  • The vertical velocity becomes negative.
  • The estimated altitude drops by at least a configurable threshold after reaching a maximum.

Acceleration assumptions:

  • The accelerometer (e.g., LSM6DSOX) measures the "normal force" and outputs ~9.81 m/s² at rest.
  • During free fall or coasting, its output approaches 0.
  • Therefore, inertial acceleration = measured acceleration − 9.81 m/s².
Note
When to use: flights where apogee-triggered events (e.g., drogue deployment) must be driven by fused altimeter/IMU estimates rather than a single sensor.

Definition at line 33 of file ApogeeDetector.h.

Constructor & Destructor Documentation

◆ ApogeeDetector() [1/2]

ApogeeDetector::ApogeeDetector ( float apogeeThreshold_m)
explicit

Constructs an ApogeeDetector with a custom drop threshold.

Parameters
apogeeThreshold_mMinimum drop in altitude (in meters) to confirm apogee.

Definition at line 5 of file ApogeeDetector.cpp.

◆ ApogeeDetector() [2/2]

ApogeeDetector::ApogeeDetector ( )
inline

Constructs an ApogeeDetector with the default threshold of 1.0 meter.

Definition at line 44 of file ApogeeDetector.h.

Member Function Documentation

◆ getApogee()

DataPoint ApogeeDetector::getApogee ( ) const

Retrieves the detected apogee.

Returns
A DataPoint containing the timestamp and altitude of apogee. If not detected, returns {0, 0.0F}.

Definition at line 43 of file ApogeeDetector.cpp.

◆ getEstimatedAltitude()

float ApogeeDetector::getEstimatedAltitude ( ) const

Gets the current estimated altitude.

Returns
Altitude in meters.

◆ getEstimatedVelocity()

float ApogeeDetector::getEstimatedVelocity ( ) const

Gets the current estimated vertical velocity.

Returns
Velocity in meters per second.

◆ getInertialVerticalAcceleration()

float ApogeeDetector::getInertialVerticalAcceleration ( ) const

Gets the current inertial vertical acceleration.

Returns
Vertical acceleration in m/s², corrected for gravity.

◆ getVerticalAxis()

int8_t ApogeeDetector::getVerticalAxis ( ) const

Gets the configured vertical axis.

Returns
Axis index used as vertical (0=X, 1=Y, 2=Z).

◆ getVerticalDirection()

int8_t ApogeeDetector::getVerticalDirection ( ) const

Gets the configured vertical direction (+1 or -1).

Returns
1 if increasing values mean upward, -1 otherwise.

◆ init()

void ApogeeDetector::init ( ApogeeDetectorInitialState initialState)

Initializes the detector with the starting altitude and timestamp.

Parameters
initialStateStruct containing initial altitude and timestamp.

Definition at line 10 of file ApogeeDetector.cpp.

◆ isApogeeDetected()

bool ApogeeDetector::isApogeeDetected ( ) const

Checks if apogee has been detected.

Returns
true if apogee has occurred, false otherwise.

Definition at line 37 of file ApogeeDetector.cpp.

◆ update()

void ApogeeDetector::update ( VerticalVelocityEstimator * verticalVelocityEstimator)

Updates the detector using the latest estimated altitude and vertical velocity.

Parameters
verticalVelocityEstimatorPointer to the estimator providing current flight state.

Definition at line 18 of file ApogeeDetector.cpp.


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