-
-
Notifications
You must be signed in to change notification settings - Fork 228
Description
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 fallingImplementation Details
- Target File:
rocketpy/flight/flight.py - Mechanism: Inside the event wrapper methods (which interface with
scipy.integrate), we need to explicitly callself.u_dot(t, y)to obtain the current derivatives. - Performance Note: Calling
u_dotinside 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
Flightclass to calculateu_dotinside 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
ycontains[x, y, z, vx, vy, vz, ...]. - The acceleration
[ax, ay, az]is only available after computing the derivativeu_dot.