From 59db294dfd27fc2869f2050e524b4539664cef8e Mon Sep 17 00:00:00 2001 From: Mauco03 <marco.gaibotti@skywarder.eu> Date: Sun, 20 Apr 2025 10:45:11 +0200 Subject: [PATCH] [coeff-transport][Rocket] Added option to load dynamic derivatives --- classes/@Rocket/Rocket.m | 30 +++++++++++++++---- .../config/rocketConfig.m | 5 ++++ .../config/rocketConfig.m | 5 ++++ .../config/rocketConfig.m | 5 ++++ .../config/rocketConfig.m | 5 ++++ .../config/rocketConfig.m | 6 ++++ .../config/rocketConfig.m | 5 ++++ .../config/rocketConfig.m | 5 ++++ .../config/rocketConfig.m | 5 ++++ .../config/rocketConfig.m | 9 ++++-- .../config/rocketConfig.m | 5 ++++ 11 files changed, 78 insertions(+), 7 deletions(-) diff --git a/classes/@Rocket/Rocket.m b/classes/@Rocket/Rocket.m index a06283b..7e39e87 100644 --- a/classes/@Rocket/Rocket.m +++ b/classes/@Rocket/Rocket.m @@ -50,9 +50,11 @@ classdef Rocket < Config properties pitot Pitot % [-] Pitot component parachutes cell % [-] (nParachutes, nStages) Parachutes onboard + + dynamicDerivatives (1, 1) logical % [-] True if dynamic derivatives will be loaded - coefficients struct % [-] Aerodynamic coefficients - coefficientsHighAOA struct % [-] Aerodynamic coefficients at high angle of attack + coefficients Coefficient % [-] Aerodynamic coefficients + coefficientsHighAOA Coefficient % [-] Aerodynamic coefficients at high angle of attack end properties(Access = private) @@ -138,9 +140,20 @@ classdef Rocket < Config obj.parachutes = paraLoader.parachutes; if options.loadCoefficients - obj = obj.loadData(); + if obj.dynamicDerivatives, coeffName = obj.motor.name; + else, coeffName = 'generic'; + end + + obj.coefficients = Coefficient( ... + fullfile(mission.dataPath, 'aeroCoefficients.mat'), ... + coeffName); + + obj.coefficientsHighAOA = Coefficient( ... + fullfile(mission.dataPath, 'aeroCoefficientsHighAOA.mat'), ... + coeffName); + answer = ''; - if isempty(obj.coefficients) || isempty(obj.coefficientsHighAOA) + if isempty(obj.coefficients.static) || isempty(obj.coefficientsHighAOA.static) answer = questdlg(['Coefficient matrices not found. ' ... 'Do you want to create new matrices?']); elseif options.checkGeometry && ~all(obj.checkGeometry()) @@ -153,7 +166,14 @@ classdef Rocket < Config parserPath = fullfile(mission.msaPath, 'autoMatricesProtub'); addpath(genpath(parserPath)); mainAutoMatProtub(obj); - obj = obj.loadData(); + + obj.coefficients = Coefficient( ... + fullfile(mission.dataPath, 'aeroCoefficients.mat'), ... + coeffName); + + obj.coefficientsHighAOA = Coefficient( ... + fullfile(mission.dataPath, 'aeroCoefficientsHighAOA.mat'), ... + coeffName); 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 4df34a1..160c5b0 100644 --- a/missions/2021_Lynx_Portugal_October/config/rocketConfig.m +++ b/missions/2021_Lynx_Portugal_October/config/rocketConfig.m @@ -16,6 +16,11 @@ rocket.inertiaNoMotor = [0.0786; 12.972; 12.972]; % [kg*m^2] OVERRIDE iner rocket.xCgNoMotor = 1.6025; % [m] OVERRIDE xCg without motor rocket.lengthCenterNoMot = 1.7640; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% 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 83f6476..d0dc3df 100644 --- a/missions/2021_Lynx_Roccaraso_September/config/rocketConfig.m +++ b/missions/2021_Lynx_Roccaraso_September/config/rocketConfig.m @@ -16,6 +16,11 @@ rocket.inertiaNoMotor = [0.06; 7.511; 7.512]; % [kg*m^2] OVERRIDE inertia rocket.xCgNoMotor = 1.1986; % [m] OVERRIDE xCg without motor rocket.lengthCenterNoMot = 1.7840; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% 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 8cdcf2b..2f949bf 100644 --- a/missions/2022_Pyxis_Portugal_October/config/rocketConfig.m +++ b/missions/2022_Pyxis_Portugal_October/config/rocketConfig.m @@ -16,6 +16,11 @@ rocket.inertiaNoMotor = [0.06303; 9.62497; 9.62524]; % [kg*m^2] OVERRIDE i rocket.xCgNoMotor = 1.2239; % [m] OVERRIDE xCg without motor rocket.lengthCenterNoMot = 1.4470; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% 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 bec3d20..ee3a3c7 100644 --- a/missions/2022_Pyxis_Roccaraso_September/config/rocketConfig.m +++ b/missions/2022_Pyxis_Roccaraso_September/config/rocketConfig.m @@ -18,6 +18,11 @@ rocket.xCgNoMotor = 1.2957; % [m] % settings.Lcenter - motors(iMotor).L/1000 rocket.lengthCenterNoMot = 1.61; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% 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 610966a..401c415 100644 --- a/missions/2023_Gemini_Portugal_October/config/rocketConfig.m +++ b/missions/2023_Gemini_Portugal_October/config/rocketConfig.m @@ -15,6 +15,12 @@ rocket.inertiaNoMotor = [0.06535397; 17.21019828; 17.21056483]; % [kg*m^2] rocket.xCgNoMotor = 1.254; % [m] OVERRIDE xCg without motor rocket.lengthCenterNoMot = 1.517; % [m] OVERRIDE Center length - no nose, no motor +% 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 + + %% 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 600065a..fc2715b 100644 --- a/missions/2023_Gemini_Roccaraso_September/config/rocketConfig.m +++ b/missions/2023_Gemini_Roccaraso_September/config/rocketConfig.m @@ -15,6 +15,11 @@ rocket.inertiaNoMotor = [0.06535397; 12.07664659; 12.07701314]; % [kg*m^2] rocket.xCgNoMotor = 1.149; % [m] OVERRIDE xCg without motor rocket.lengthCenterNoMot = 1.517; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% 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 2369c08..f87640c 100644 --- a/missions/2024_Lyra_Portugal_October/config/rocketConfig.m +++ b/missions/2024_Lyra_Portugal_October/config/rocketConfig.m @@ -9,6 +9,11 @@ rocket.inertiaNoMotor = []; % [kg*m^ rocket.xCgNoMotor = []; % [m] OVERRIDE xCg without motor rocket.lengthCenterNoMot = []; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% 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 b2ca5cb..2939db0 100644 --- a/missions/2024_Lyra_Roccaraso_September/config/rocketConfig.m +++ b/missions/2024_Lyra_Roccaraso_September/config/rocketConfig.m @@ -15,6 +15,11 @@ rocket.lengthCenterNoMot = []; % [m] % rocket.xCgNoMotor = 1.28; % [m] OVERRIDE xCg without motor % rocket.lengthCenterNoMot = 1.778; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% 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 c879160..6a13ec2 100644 --- a/missions/2025_Orion_Portugal_October/config/rocketConfig.m +++ b/missions/2025_Orion_Portugal_October/config/rocketConfig.m @@ -3,12 +3,17 @@ %% ROCKET - OVERRIDES BAYS CONFIG rocket = Rocket(); -rocket.diameter = 0.15; % [m] Rocket diameter +rocket.diameter = 0.15; % [m] Rocket diameter % rocket.massNoMotor = []; % [kg] OVERRIDE mass without motor % rocket.inertiaNoMotor = []; % [kg*m^2] OVERRIDE inertia without motor - body axes reference % rocket.xcgNoMotor = []; % [m] OVERRIDE xCg without motor % rocket.lengthCenterNoMot = []; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% PRF - Includes Parafoil + Nose parafoil = Parafoil(); @@ -69,7 +74,7 @@ airbrakes.servoTau = 0.0374588; %% MOTOR motor = Motor(); -motor.name = 'HRE_ARM_OPT_3_Update'; +motor.name = 'HRE_ARM_EuRoC_2024'; motor.cutoffTime = []; % [s] OVERRIDE Cutoff time motor.ignitionTransient = 0.3; % [s] Ignition transient diff --git a/missions/2025_Orion_Roccaraso_September/config/rocketConfig.m b/missions/2025_Orion_Roccaraso_September/config/rocketConfig.m index dfc372f..c4e1ffc 100644 --- a/missions/2025_Orion_Roccaraso_September/config/rocketConfig.m +++ b/missions/2025_Orion_Roccaraso_September/config/rocketConfig.m @@ -15,6 +15,11 @@ rocket.lengthCenterNoMot = []; % [m] % rocket.xCgNoMotor = 1.28; % [m] OVERRIDE xCg without motor % rocket.lengthCenterNoMot = 1.778; % [m] OVERRIDE Center length - no nose, no motor +% 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 + %% PLD - Includes Parafoil + Nose parafoil = Parafoil(); -- GitLab