From 76c4431a7cb88d0dee7a73fa7d65d64efb520ceb Mon Sep 17 00:00:00 2001
From: "Pier Francesco A. Bachini" <pierfrancesco.bachini@skywarder.eu>
Date: Mon, 1 Jul 2024 11:18:25 +0200
Subject: [PATCH] update descentParachute with accelerometer measurement
 generation

---
 functions/odeFunctions/descentParachute.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/functions/odeFunctions/descentParachute.m b/functions/odeFunctions/descentParachute.m
index 83720d0..6e3e77d 100644
--- a/functions/odeFunctions/descentParachute.m
+++ b/functions/odeFunctions/descentParachute.m
@@ -1,4 +1,4 @@
-function [dY, parout] = descentParachute(~, Y, rocket, environment, wind, descentData, wrapper)
+function [dY, parout] = descentParachute(~, Y, rocket, environment, wind, descentData, wrapper, Q)
 arguments
     ~
     Y
@@ -7,6 +7,7 @@ arguments
     wind            % WindCustom {mustBeA(wind, {'WindCustom', 'WindMatlab'})}
     descentData     struct
     wrapper                = [] %DataWrapper = DataWrapper.empty
+    Q               = [1 0 0 0]
 end
 % descentParachute - ode function of the 3DOF parachute model
 % 
@@ -111,6 +112,7 @@ L = 0.5*rho*V_norm^2*S*CL*n_vers';       % [N] Lift vector
 Fg = m*g*[0 0 1]';                       % [N] Gravitational Force vector
 F = L + Fg + D;                          % [N] total forces vector
 
+F_acc = F - Fg;
 %% STATE DERIVATIVES
 % velocity
 du = F(1)/m;
@@ -142,6 +144,7 @@ if nargout == 2 || ~isempty(wrapper)
     parout.air.P = P;
 
     parout.accelerations.body = [du; dv; dw];
+    parout.accelerometer.body_acc = quatrotate(Q,(F_acc/m)');
     
     parout.coeff = [];
     parout.uncertanty = [];
-- 
GitLab