Przeglądaj źródła

Registry setting for ROS2 camera pipeline modification. (#781)

Signed-off-by: Michał Pełka <[email protected]>
Co-authored-by: Jan Hanca <[email protected]>
Co-authored-by: Steve Pham <[email protected]>
Michał Pełka 10 miesięcy temu
rodzic
commit
0b51bcca14

+ 16 - 2
Gems/ROS2/Code/Source/Camera/CameraSensor.cpp

@@ -17,6 +17,7 @@
 #include <Atom/RPI.Public/RenderPipeline.h>
 #include <Atom/RPI.Public/Scene.h>
 #include <AzCore/Math/MatrixUtils.h>
+#include <AzCore/Settings/SettingsRegistry.h>
 #include <AzFramework/Components/TransformComponent.h>
 #include <AzFramework/Scene/SceneSystemInterface.h>
 #include <PostProcess/PostProcessFeatureProcessor.h>
@@ -27,6 +28,8 @@ namespace ROS2
 {
     namespace Internal
     {
+        constexpr AZStd::string_view AllowCameraPipelineModificationKey = "/O3DE/ROS2/Camera/AllowPipelineModification";
+
         /// @FormatMappings - contains the mapping from RHI to ROS image encodings. List of supported
         /// ROS image encodings lives in `sensor_msgs/image_encodings.hpp`
         /// We are not including `image_encodings.hpp` since it uses exceptions.
@@ -107,7 +110,18 @@ namespace ROS2
 
     void CameraSensor::SetupPasses()
     {
-        AZ_TracePrintf("CameraSensor", "Initializing pipeline for %s\n", m_cameraSensorDescription.m_cameraName.c_str());
+        bool allowModification = false;
+        auto* registry = AZ::SettingsRegistry::Get();
+        AZ_Assert(registry, "No Registry available");
+        if (registry)
+        {
+            registry->Get(allowModification, Internal::AllowCameraPipelineModificationKey);
+        }
+        AZ_Trace(
+            "CameraSensor",
+            "Initializing pipeline for %s, pipeline modification : %s\n",
+            m_cameraSensorDescription.m_cameraName.c_str(),
+            allowModification ? "yes" : "no");
 
         const AZ::Name viewName = AZ::Name("MainCamera");
         m_view = AZ::RPI::View::CreateView(viewName, AZ::RPI::View::UsageCamera);
@@ -123,7 +137,7 @@ namespace ROS2
             m_entityId.ToString().c_str());
         AZ::RPI::RenderPipelineDescriptor pipelineDesc;
         pipelineDesc.m_mainViewTagName = "MainCamera";
-        pipelineDesc.m_allowModification = true;
+        pipelineDesc.m_allowModification = allowModification;
         pipelineDesc.m_name = m_pipelineName;
 
         pipelineDesc.m_rootPassTemplate = GetPipelineTemplateName();

+ 20 - 0
Templates/Ros2FleetRobotTemplate/Template/Registry/ros2.setreg

@@ -0,0 +1,20 @@
+{
+    "O3DE":
+    {
+        "InputSystem":
+        {
+            "Mouse":
+            {
+                "CaptureMouseCursor": false
+            }
+        },
+        "ROS2":
+        {
+            "SteadyClock" : true,
+            "Camera":
+            {
+                "AllowPipelineModification": true
+            }
+        }
+    }
+}

+ 4 - 0
Templates/Ros2FleetRobotTemplate/template.json

@@ -151,6 +151,10 @@
             "file": "Registry/physxsystemconfiguration.setreg",
             "isTemplated": false
         },
+        {
+            "file": "Registry/ros2.setreg",
+            "isTemplated": false
+        },
         {
             "file": "Resources/GameSDK.ico",
             "isTemplated": false

+ 20 - 0
Templates/Ros2ProjectTemplate/Template/Registry/ros2.setreg

@@ -0,0 +1,20 @@
+{
+    "O3DE":
+    {
+        "InputSystem":
+        {
+            "Mouse":
+            {
+                "CaptureMouseCursor": false
+            }
+        },
+        "ROS2":
+        {
+            "SteadyClock" : true,
+            "Camera":
+            {
+                "AllowPipelineModification": false
+            }
+        }
+    }
+}

+ 4 - 0
Templates/Ros2ProjectTemplate/template.json

@@ -234,6 +234,10 @@
             "file": "Registry/sceneassetimporter.setreg",
             "isTemplated": false
         },
+        {
+            "file": "Registry/ros2.setreg",
+            "isTemplated": false
+        },
         {
             "file": "Resources/GameSDK.ico",
             "isTemplated": false

+ 20 - 0
Templates/Ros2RoboticManipulationTemplate/Template/Registry/ros2.setreg

@@ -0,0 +1,20 @@
+{
+    "O3DE":
+    {
+        "InputSystem":
+        {
+            "Mouse":
+            {
+                "CaptureMouseCursor": false
+            }
+        },
+        "ROS2":
+        {
+            "SteadyClock" : true,
+            "Camera":
+            {
+                "AllowPipelineModification": true
+            }
+        }
+    }
+}

+ 4 - 0
Templates/Ros2RoboticManipulationTemplate/template.json

@@ -618,6 +618,10 @@
             "file": "Registry/sceneassetimporter.setreg",
             "isTemplated": false
         },
+        {
+            "file": "Registry/ros2.setreg",
+            "isTemplated": false
+        },
         {
             "file": "Resources/GameSDK.ico",
             "isTemplated": false