Browse Source

Remove calling system component from a contructor of helper configuration (#520)

Signed-off-by: Michał <[email protected]>
Michał Pełka 2 years ago
parent
commit
01455c63d9

+ 3 - 1
Gems/ROS2/Code/Source/Lidar/LidarRegistrarSystemComponent.cpp

@@ -114,7 +114,9 @@ namespace ROS2
 
     AZStd::string Details::GetDefaultLidarSystem()
     {
-        const auto& lidarSystemList = LidarRegistrarInterface::Get()->GetRegisteredLidarSystems();
+        const auto& lidarInterface = LidarRegistrarInterface::Get();
+        AZ_Assert(lidarInterface, "LidarRegistrarInterface is not registered.");
+        const auto& lidarSystemList = lidarInterface->GetRegisteredLidarSystems();
         if (lidarSystemList.empty())
         {
             AZ_Warning("ROS2LidarSensorComponent", false, "No LIDAR system for the sensor to use.");

+ 0 - 2
Gems/ROS2/Code/Source/Lidar/LidarSensorConfiguration.cpp

@@ -79,8 +79,6 @@ namespace ROS2
         m_lidarModel = m_availableModels.front();
         m_lidarParameters = LidarTemplateUtils::GetTemplate(m_lidarModel);
         m_lidarModelName = m_lidarParameters.m_name;
-
-        FetchLidarImplementationFeatures();
     }
 
     void LidarSensorConfiguration::FetchLidarImplementationFeatures()

+ 5 - 0
Gems/ROS2/Code/Source/Lidar/ROS2Lidar2DSensorComponent.cpp

@@ -99,6 +99,11 @@ namespace ROS2
         m_lidarCore.Deinit();
     }
 
+    void ROS2Lidar2DSensorComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
+    {
+        required.push_back(AZ_CRC_CE("ROS2Frame"));
+    }
+
     void ROS2Lidar2DSensorComponent::FrequencyTick()
     {
         RaycastResult lastScanResults = m_lidarCore.PerformRaycast();

+ 1 - 0
Gems/ROS2/Code/Source/Lidar/ROS2Lidar2DSensorComponent.h

@@ -32,6 +32,7 @@ namespace ROS2
         ROS2Lidar2DSensorComponent();
         ROS2Lidar2DSensorComponent(const SensorConfiguration& sensorConfiguration, const LidarSensorConfiguration& lidarConfiguration);
         ~ROS2Lidar2DSensorComponent() = default;
+        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
         static void Reflect(AZ::ReflectContext* context);
         //////////////////////////////////////////////////////////////////////////
         // Component overrides

+ 5 - 0
Gems/ROS2/Code/Source/Lidar/ROS2LidarSensorComponent.cpp

@@ -43,6 +43,11 @@ namespace ROS2
         }
     }
 
+    void ROS2LidarSensorComponent::GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required)
+    {
+        required.push_back(AZ_CRC_CE("ROS2Frame"));
+    }
+
     ROS2LidarSensorComponent::ROS2LidarSensorComponent()
         : m_lidarCore(LidarTemplateUtils::Get3DModels())
     {

+ 1 - 0
Gems/ROS2/Code/Source/Lidar/ROS2LidarSensorComponent.h

@@ -34,6 +34,7 @@ namespace ROS2
         ROS2LidarSensorComponent(const SensorConfiguration& sensorConfiguration, const LidarSensorConfiguration& lidarConfiguration);
         ~ROS2LidarSensorComponent() = default;
         static void Reflect(AZ::ReflectContext* context);
+        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
         //////////////////////////////////////////////////////////////////////////
         // Component overrides
         void Activate() override;