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
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.
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).
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
Flightclass event handling logic to pass acceleration data to the parachute trigger callbacks.The trigger signature should ideally support:
Implementation Details
rocketpy/flight/flight.pyscipy.integrate), we need to explicitly callself.u_dot(t, y)to obtain the current derivatives.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.Acceptance Criteria
Flightclass to calculateu_dotinside the event checking loop.u_dot) to the user-defined trigger function.Additional Context
ycontains[x, y, z, vx, vy, vz, ...].[ax, ay, az]is only available after computing the derivativeu_dot.