From 17b238fc626f981b43f20e61d72523234f873fb0 Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Sun, 27 Apr 2025 00:28:43 +0200
Subject: [PATCH] [alpha-phi][Rocket] Added option to not load highAOA matrices

---
 classes/@Rocket/Rocket.m                         | 16 ++++++++++------
 .../config/rocketConfig.m                        |  1 +
 .../config/rocketConfig.m                        |  1 +
 .../config/rocketConfig.m                        |  1 +
 .../config/rocketConfig.m                        |  1 +
 .../config/rocketConfig.m                        |  2 +-
 .../config/rocketConfig.m                        |  1 +
 .../config/rocketConfig.m                        |  1 +
 .../config/rocketConfig.m                        |  1 +
 .../config/rocketConfig.m                        |  3 ++-
 10 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/classes/@Rocket/Rocket.m b/classes/@Rocket/Rocket.m
index 825e836..30c76a4 100644
--- a/classes/@Rocket/Rocket.m
+++ b/classes/@Rocket/Rocket.m
@@ -52,7 +52,8 @@ classdef Rocket < Config
         parachutes                  cell            % [-]       (nParachutes, nStages) Parachutes onboard
 
         dynamicDerivatives  (1, 1)  logical         % [-]       True if dynamic derivatives will be loaded
-        
+        highAOACoefficients (1, 1)  logical         % [-]       True if highAOACoefficients are loaded
+
         coefficients                Coefficient     % [-]       Aerodynamic coefficients
         coefficientsHighAOA         Coefficient     % [-]       Aerodynamic coefficients at high angle of attack
     end
@@ -150,13 +151,16 @@ classdef Rocket < Config
                     fullfile(mission.dataPath, 'aeroCoefficients.mat'), ...
                     coeffName);
 
-                obj.coefficientsHighAOA = Coefficient( ...
-                    fullfile(mission.dataPath, 'aeroCoefficientsHighAOA.mat'), ...
-                    coeffName);
+                if obj.highAOACoefficients
+                    obj.coefficientsHighAOA = Coefficient( ...
+                        fullfile(mission.dataPath, 'aeroCoefficientsHighAOA.mat'), ...
+                        coeffName);
+                end
 
                 answer = '';
                 
-                if isempty(obj.coefficients.static) || isempty(obj.coefficientsHighAOA.static)
+                if isempty(obj.coefficients.static) || ...
+                        (obj.highAOACoefficients && isempty(obj.coefficientsHighAOA.static))
                     answer = questdlg(['Coefficient matrices not found. ' ...
                         'Do you want to create new matrices?']);
                 elseif options.checkGeometry
@@ -195,7 +199,7 @@ classdef Rocket < Config
                         parserPath = fullfile(mission.msaPath, 'autoMatricesProtub');
                         addpath(genpath(parserPath));
                         [obj.coefficients, obj.coefficientsHighAOA] = ...
-                            mainAutoMatProtub(obj);
+                            mainAutoMatProtub(obj, 'computeHighAOA', obj.highAOACoefficients);
                     case 'Cancel'
                         error('Rocket creation aborted')
                     otherwise
diff --git a/missions/2021_Lynx_Portugal_October/config/rocketConfig.m b/missions/2021_Lynx_Portugal_October/config/rocketConfig.m
index 160c5b0..cb26401 100644
--- a/missions/2021_Lynx_Portugal_October/config/rocketConfig.m
+++ b/missions/2021_Lynx_Portugal_October/config/rocketConfig.m
@@ -20,6 +20,7 @@ rocket.lengthCenterNoMot = 1.7640;                                     % [m]
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
 rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PLD - Includes Parafoil + Nose
 parafoil = Parafoil();
diff --git a/missions/2021_Lynx_Roccaraso_September/config/rocketConfig.m b/missions/2021_Lynx_Roccaraso_September/config/rocketConfig.m
index d0dc3df..0851f94 100644
--- a/missions/2021_Lynx_Roccaraso_September/config/rocketConfig.m
+++ b/missions/2021_Lynx_Roccaraso_September/config/rocketConfig.m
@@ -20,6 +20,7 @@ rocket.lengthCenterNoMot = 1.7840;                                     % [m]
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
 rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PLD - Includes Parafoil + Nose
 parafoil = Parafoil();
diff --git a/missions/2022_Pyxis_Portugal_October/config/rocketConfig.m b/missions/2022_Pyxis_Portugal_October/config/rocketConfig.m
index 2f949bf..17d63ca 100644
--- a/missions/2022_Pyxis_Portugal_October/config/rocketConfig.m
+++ b/missions/2022_Pyxis_Portugal_October/config/rocketConfig.m
@@ -20,6 +20,7 @@ rocket.lengthCenterNoMot = 1.4470;                                     % [m]
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
 rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PLD - Includes Parafoil + Nose
 parafoil = Parafoil();
diff --git a/missions/2022_Pyxis_Roccaraso_September/config/rocketConfig.m b/missions/2022_Pyxis_Roccaraso_September/config/rocketConfig.m
index ee3a3c7..5b7406a 100644
--- a/missions/2022_Pyxis_Roccaraso_September/config/rocketConfig.m
+++ b/missions/2022_Pyxis_Roccaraso_September/config/rocketConfig.m
@@ -22,6 +22,7 @@ rocket.lengthCenterNoMot = 1.61;                                     % [m]
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
 rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PLD - Includes Parafoil + Nose
 parafoil = Parafoil();
diff --git a/missions/2023_Gemini_Portugal_October/config/rocketConfig.m b/missions/2023_Gemini_Portugal_October/config/rocketConfig.m
index 401c415..f9d6d4c 100644
--- a/missions/2023_Gemini_Portugal_October/config/rocketConfig.m
+++ b/missions/2023_Gemini_Portugal_October/config/rocketConfig.m
@@ -19,7 +19,7 @@ rocket.lengthCenterNoMot = 1.517;                                     % [m]
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
 rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
-
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PLD - Includes Parafoil + Nose
 parafoil = Parafoil();
diff --git a/missions/2023_Gemini_Roccaraso_September/config/rocketConfig.m b/missions/2023_Gemini_Roccaraso_September/config/rocketConfig.m
index fc2715b..cadbc7e 100644
--- a/missions/2023_Gemini_Roccaraso_September/config/rocketConfig.m
+++ b/missions/2023_Gemini_Roccaraso_September/config/rocketConfig.m
@@ -19,6 +19,7 @@ rocket.lengthCenterNoMot = 1.517;                                     % [m]
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
 rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PLD - Includes Parafoil + Nose
 parafoil = Parafoil();
diff --git a/missions/2024_Lyra_Portugal_October/config/rocketConfig.m b/missions/2024_Lyra_Portugal_October/config/rocketConfig.m
index f87640c..1d90d15 100644
--- a/missions/2024_Lyra_Portugal_October/config/rocketConfig.m
+++ b/missions/2024_Lyra_Portugal_October/config/rocketConfig.m
@@ -13,6 +13,7 @@ rocket.lengthCenterNoMot = [];                                          % [m]
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
 rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PLD - Includes Parafoil + Nose
 parafoil = Parafoil();
diff --git a/missions/2024_Lyra_Roccaraso_September/config/rocketConfig.m b/missions/2024_Lyra_Roccaraso_September/config/rocketConfig.m
index 2939db0..133be74 100644
--- a/missions/2024_Lyra_Roccaraso_September/config/rocketConfig.m
+++ b/missions/2024_Lyra_Roccaraso_September/config/rocketConfig.m
@@ -19,6 +19,7 @@ rocket.lengthCenterNoMot = [];                                          % [m]
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
 rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PLD - Includes Parafoil + Nose
 parafoil = Parafoil();
diff --git a/missions/2025_Orion_Portugal_October/config/rocketConfig.m b/missions/2025_Orion_Portugal_October/config/rocketConfig.m
index 6a13ec2..cab54ff 100644
--- a/missions/2025_Orion_Portugal_October/config/rocketConfig.m
+++ b/missions/2025_Orion_Portugal_October/config/rocketConfig.m
@@ -12,7 +12,8 @@ rocket.diameter = 0.15;                                                   % [m]
 % If dynamic derivatives are loaded, coefficient will depend on rocket xcg
 %   When false, coefficients are saved with current motor's name
 %   When true,  coefficients are saved as 'generic'
-rocket.dynamicDerivatives = false;                                    % [-]      True if dynamic derivatives will be loaded
+rocket.dynamicDerivatives = false;                                      % [-]      True if dynamic derivatives will be loaded
+rocket.highAOACoefficients = false;                                     % [-]      True if separate matrix for high AOA will be loaded
 
 %% PRF - Includes Parafoil + Nose
 parafoil = Parafoil();
-- 
GitLab