Skip to content

ENH: Acceleration data to trigger parachutes #156

@giovaniceotto

Description

@giovaniceotto

Is your feature request related to a problem? Please describe.
Currently, custom functions used to trigger parachutes (events) only have access to Pressure and the State Vector (position, velocity, attitude, angular rates).

However, real-world flight computers (avionics) heavily rely on Accelerometers (IMU) to detect flight phases (e.g., Liftoff, Motor Burnout, Apogee).

  • Example: A user wants to deploy a drogue parachute only if the rocket detects it is under free-fall (approx 0g total acceleration) or has detected a specific deceleration curve.

Because RocketPy does not expose acceleration to the trigger, users cannot simulate these realistic avionics algorithms.

Describe the solution you'd like
I would like to update the Flight class event handling logic to pass acceleration data to the parachute trigger callbacks.

The trigger signature should ideally support:

def my_trigger(p, y, u_dot):
    # p = pressure
    # y = state vector [x, y, z, vx, vy, vz...]
    # u_dot = derivative [vx, vy, vz, ax, ay, az...]
    
    vertical_acceleration = u_dot[5] 
    return vertical_acceleration < -9.0 # Deploy if falling

Implementation Details

  • Target File: rocketpy/flight/flight.py
  • Mechanism: Inside the event wrapper methods (which interface with scipy.integrate), we need to explicitly call self.u_dot(t, y) to obtain the current derivatives.
  • Performance Note: Calling u_dot inside the event checker effectively doubles the physics load for event detection. This is acceptable for the gained accuracy, but we should document it.
  • Noise: Ideally, we should allow a way to inject "sensor noise" into this acceleration before passing it to the trigger, simulating a real MEMS accelerometer.

Acceptance Criteria

  • Update Flight class to calculate u_dot inside the event checking loop.
  • Pass the acceleration components (or the full u_dot) to the user-defined trigger function.
  • Add a tutorial example showing how to trigger a parachute based on "Motor Burnout" (sudden drop in acceleration).

Additional Context

  • Currently, the state vector y contains [x, y, z, vx, vy, vz, ...].
  • The acceleration [ax, ay, az] is only available after computing the derivative u_dot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ControllersControlling rocket flight methodsEnhancementNew feature or request, including adjustments in current codesParachuteRelated to parachutes methods and usage

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions