From c14ae924325460b9ff622d190e93f551d1e67c5c Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Tue, 5 Mar 2024 19:19:59 +0100
Subject: [PATCH] [msa-refactoring][classes] Updated LoadConfig, added
 Environment

---
 classes/Component.m              |  3 ++-
 classes/components/Environment.m | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/classes/Component.m b/classes/Component.m
index 0a1e53f..91d88c8 100644
--- a/classes/Component.m
+++ b/classes/Component.m
@@ -14,7 +14,8 @@ classdef Component < Config
                 varsIn = 0
             end
             obj.mission = mission;
-            if nargin == 0, return;  end
+            %if isempty(mission.name) && nargin > 0, warning('Mission arguments are empty. Returning an uninitialized component...'); end
+            if isempty(mission.name), return;  end
             if ~isstruct(varsIn) && varsIn == 0
                 obj.loadConfig(); 
             else
diff --git a/classes/components/Environment.m b/classes/components/Environment.m
index 35c2c91..41ebd8b 100644
--- a/classes/components/Environment.m
+++ b/classes/components/Environment.m
@@ -27,6 +27,20 @@ classdef Environment < Component
         motor Motor
     end
 
+    methods
+        function obj = Environment(mission, motor, varIn)
+            arguments(Input)
+                mission Mission = Mission()
+                motor Motor = Motor()
+                varIn = 0
+            end
+            if nargin > 0 && nargin < 2, error('Too few arguments. Type help for more info'); end
+            if nargin > 3, error('Too many arguments.'); end
+            obj@Component(mission, varIn);
+            obj.motor = motor;
+        end
+    end
+
     methods
         function g0 = get.g0(obj)
             g0 = gravitywgs84(obj.z0, obj.lat0);
-- 
GitLab