Browse Source

Initial commit - created ROS2 gem

Signed-off-by: Adam Dąbrowski <[email protected]>
Adam Dąbrowski 3 years ago
parent
commit
59dc9e1ee8
45 changed files with 707 additions and 0 deletions
  1. 14 0
      Gems/ROS2/CMakeLists.txt
  2. 159 0
      Gems/ROS2/Code/CMakeLists.txt
  3. 31 0
      Gems/ROS2/Code/Include/ROS2/ROS2Bus.h
  4. 4 0
      Gems/ROS2/Code/Platform/Android/PAL_android.cmake
  5. 8 0
      Gems/ROS2/Code/Platform/Android/ros2_android_files.cmake
  6. 8 0
      Gems/ROS2/Code/Platform/Android/ros2_shared_android_files.cmake
  7. 4 0
      Gems/ROS2/Code/Platform/Linux/PAL_linux.cmake
  8. 8 0
      Gems/ROS2/Code/Platform/Linux/ros2_linux_files.cmake
  9. 8 0
      Gems/ROS2/Code/Platform/Linux/ros2_shared_linux_files.cmake
  10. 4 0
      Gems/ROS2/Code/Platform/Mac/PAL_mac.cmake
  11. 8 0
      Gems/ROS2/Code/Platform/Mac/ros2_mac_files.cmake
  12. 8 0
      Gems/ROS2/Code/Platform/Mac/ros2_shared_mac_files.cmake
  13. 4 0
      Gems/ROS2/Code/Platform/Windows/PAL_windows.cmake
  14. 8 0
      Gems/ROS2/Code/Platform/Windows/ros2_shared_windows_files.cmake
  15. 8 0
      Gems/ROS2/Code/Platform/Windows/ros2_windows_files.cmake
  16. 4 0
      Gems/ROS2/Code/Platform/iOS/PAL_ios.cmake
  17. 8 0
      Gems/ROS2/Code/Platform/iOS/ros2_ios_files.cmake
  18. 8 0
      Gems/ROS2/Code/Platform/iOS/ros2_shared_ios_files.cmake
  19. 38 0
      Gems/ROS2/Code/Source/ROS2EditorModule.cpp
  20. 54 0
      Gems/ROS2/Code/Source/ROS2EditorSystemComponent.cpp
  21. 33 0
      Gems/ROS2/Code/Source/ROS2EditorSystemComponent.h
  22. 17 0
      Gems/ROS2/Code/Source/ROS2Module.cpp
  23. 36 0
      Gems/ROS2/Code/Source/ROS2ModuleInterface.h
  24. 83 0
      Gems/ROS2/Code/Source/ROS2SystemComponent.cpp
  25. 47 0
      Gems/ROS2/Code/Source/ROS2SystemComponent.h
  26. 4 0
      Gems/ROS2/Code/Tests/ROS2EditorTest.cpp
  27. 4 0
      Gems/ROS2/Code/Tests/ROS2Test.cpp
  28. 5 0
      Gems/ROS2/Code/ros2_editor_files.cmake
  29. 4 0
      Gems/ROS2/Code/ros2_editor_shared_files.cmake
  30. 4 0
      Gems/ROS2/Code/ros2_editor_tests_files.cmake
  31. 7 0
      Gems/ROS2/Code/ros2_files.cmake
  32. 4 0
      Gems/ROS2/Code/ros2_shared_files.cmake
  33. 4 0
      Gems/ROS2/Code/ros2_tests_files.cmake
  34. 1 0
      Gems/ROS2/Platform/Android/android_gem.cmake
  35. 3 0
      Gems/ROS2/Platform/Android/android_gem.json
  36. 1 0
      Gems/ROS2/Platform/Linux/linux_gem.cmake
  37. 3 0
      Gems/ROS2/Platform/Linux/linux_gem.json
  38. 1 0
      Gems/ROS2/Platform/Mac/mac_gem.cmake
  39. 3 0
      Gems/ROS2/Platform/Mac/mac_gem.json
  40. 1 0
      Gems/ROS2/Platform/Windows/windows_gem.cmake
  41. 3 0
      Gems/ROS2/Platform/Windows/windows_gem.json
  42. 1 0
      Gems/ROS2/Platform/iOS/ios_gem.cmake
  43. 3 0
      Gems/ROS2/Platform/iOS/ios_gem.json
  44. 18 0
      Gems/ROS2/Registry/assetprocessor_settings.setreg
  45. 21 0
      Gems/ROS2/gem.json

+ 14 - 0
Gems/ROS2/CMakeLists.txt

@@ -0,0 +1,14 @@
+
+set(gem_path ${CMAKE_CURRENT_LIST_DIR})
+set(gem_json ${gem_path}/gem.json)
+o3de_restricted_path(${gem_json} gem_restricted_path gem_parent_relative_path)
+
+o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_parent_relative_path}")
+
+# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
+# project cmake for this platform.
+include(${pal_dir}/${PAL_PLATFORM_NAME_LOWERCASE}_gem.cmake)
+
+ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
+
+add_subdirectory(Code)

+ 159 - 0
Gems/ROS2/Code/CMakeLists.txt

@@ -0,0 +1,159 @@
+
+# Currently we are in the Code folder: ${CMAKE_CURRENT_LIST_DIR}
+# Get the platform specific folder ${pal_dir} for the current folder: ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME}
+# Note: o3de_pal_dir will take care of the details for us, as this may be a restricted platform
+#       in which case it will see if that platform is present here or in the restricted folder.
+#       i.e. It could here in our gem : Gems/ROS2/Code/Platform/<platorm_name>  or
+#            <restricted_folder>/<platform_name>/Gems/ROS2/Code
+o3de_pal_dir(pal_dir ${CMAKE_CURRENT_LIST_DIR}/Platform/${PAL_PLATFORM_NAME} "${gem_restricted_path}" "${gem_path}" "${gem_name}")
+
+# Now that we have the platform abstraction layer (PAL) folder for this folder, thats where we will find the
+# traits for this platform. Traits for a platform are defines for things like whether or not something in this gem
+# is supported by this platform.
+include(${pal_dir}/PAL_${PAL_PLATFORM_NAME_LOWERCASE}.cmake)
+
+# Add the ROS2.Static target
+# Note: We include the common files and the platform specific files which are set in ros2_common_files.cmake
+# and in ${pal_dir}/ros2_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
+ly_add_target(
+    NAME ROS2.Static STATIC
+    NAMESPACE Gem
+    FILES_CMAKE
+        ros2_files.cmake
+        ${pal_dir}/ros2_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
+    INCLUDE_DIRECTORIES
+        PUBLIC
+            Include
+        PRIVATE
+            Source
+    BUILD_DEPENDENCIES
+        PUBLIC
+            AZ::AzCore
+            AZ::AzFramework
+)
+
+# Here add ROS2 target, it depends on the ROS2.Static
+ly_add_target(
+    NAME ROS2 ${PAL_TRAIT_MONOLITHIC_DRIVEN_MODULE_TYPE}
+    NAMESPACE Gem
+    FILES_CMAKE
+        ros2_shared_files.cmake
+        ${pal_dir}/ros2_shared_${PAL_PLATFORM_NAME_LOWERCASE}_files.cmake
+    INCLUDE_DIRECTORIES
+        PUBLIC
+            Include
+        PRIVATE
+            Source
+    BUILD_DEPENDENCIES
+        PRIVATE
+            Gem::ROS2.Static
+)
+
+# By default, we will specify that the above target ROS2 would be used by
+# Client and Server type targets when this gem is enabled.  If you don't want it
+# active in Clients or Servers by default, delete one of both of the following lines:
+ly_create_alias(NAME ROS2.Clients NAMESPACE Gem TARGETS Gem::ROS2)
+ly_create_alias(NAME ROS2.Servers NAMESPACE Gem TARGETS Gem::ROS2)
+
+# If we are on a host platform, we want to add the host tools targets like the ROS2.Editor target which
+# will also depend on ROS2.Static
+if(PAL_TRAIT_BUILD_HOST_TOOLS)
+    ly_add_target(
+        NAME ROS2.Editor.Static STATIC
+        NAMESPACE Gem
+        FILES_CMAKE
+            ros2_editor_files.cmake
+        INCLUDE_DIRECTORIES
+            PRIVATE
+                Source
+            PUBLIC
+                Include
+        BUILD_DEPENDENCIES
+            PUBLIC
+                AZ::AzToolsFramework
+                Gem::ROS2.Static
+    )
+
+    ly_add_target(
+        NAME ROS2.Editor GEM_MODULE
+        NAMESPACE Gem
+        AUTOMOC
+        FILES_CMAKE
+            ros2_editor_shared_files.cmake
+        INCLUDE_DIRECTORIES
+            PRIVATE
+                Source
+            PUBLIC
+                Include
+        BUILD_DEPENDENCIES
+            PUBLIC
+                Gem::ROS2.Editor.Static
+    )
+
+    # By default, we will specify that the above target ROS2 would be used by
+    # Tool and Builder type targets when this gem is enabled.  If you don't want it
+    # active in Tools or Builders by default, delete one of both of the following lines:
+    ly_create_alias(NAME ROS2.Tools    NAMESPACE Gem TARGETS Gem::ROS2.Editor)
+    ly_create_alias(NAME ROS2.Builders NAMESPACE Gem TARGETS Gem::ROS2.Editor)
+
+
+endif()
+
+################################################################################
+# Tests
+################################################################################
+# See if globally, tests are supported
+if(PAL_TRAIT_BUILD_TESTS_SUPPORTED)
+    # We globally support tests, see if we support tests on this platform for ROS2.Static
+    if(PAL_TRAIT_ROS2_TEST_SUPPORTED)
+        # We support ROS2.Tests on this platform, add ROS2.Tests target which depends on ROS2.Static
+        ly_add_target(
+            NAME ROS2.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
+            NAMESPACE Gem
+            FILES_CMAKE
+                ros2_files.cmake
+                ros2_tests_files.cmake
+            INCLUDE_DIRECTORIES
+                PRIVATE
+                    Tests
+                    Source
+            BUILD_DEPENDENCIES
+                PRIVATE
+                    AZ::AzTest
+                    AZ::AzFramework
+                    Gem::ROS2.Static
+        )
+
+        # Add ROS2.Tests to googletest
+        ly_add_googletest(
+            NAME Gem::ROS2.Tests
+        )
+    endif()
+
+    # If we are a host platform we want to add tools test like editor tests here
+    if(PAL_TRAIT_BUILD_HOST_TOOLS)
+        # We are a host platform, see if Editor tests are supported on this platform
+        if(PAL_TRAIT_ROS2_EDITOR_TEST_SUPPORTED)
+            # We support ROS2.Editor.Tests on this platform, add ROS2.Editor.Tests target which depends on ROS2.Editor
+            ly_add_target(
+                NAME ROS2.Editor.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
+                NAMESPACE Gem
+                FILES_CMAKE
+                    ros2_editor_tests_files.cmake
+                INCLUDE_DIRECTORIES
+                    PRIVATE
+                        Tests
+                        Source
+                BUILD_DEPENDENCIES
+                    PRIVATE
+                        AZ::AzTest
+                        Gem::ROS2.Editor
+            )
+
+            # Add ROS2.Editor.Tests to googletest
+            ly_add_googletest(
+                NAME Gem::ROS2.Editor.Tests
+            )
+        endif()
+    endif()
+endif()

+ 31 - 0
Gems/ROS2/Code/Include/ROS2/ROS2Bus.h

@@ -0,0 +1,31 @@
+
+#pragma once
+
+#include <AzCore/EBus/EBus.h>
+#include <AzCore/Interface/Interface.h>
+
+namespace ROS2
+{
+    class ROS2Requests
+    {
+    public:
+        AZ_RTTI(ROS2Requests, "{fa9316fc-3eff-46e7-83de-c07a29c94109}");
+        virtual ~ROS2Requests() = default;
+        // Put your public methods here
+    };
+    
+    class ROS2BusTraits
+        : public AZ::EBusTraits
+    {
+    public:
+        //////////////////////////////////////////////////////////////////////////
+        // EBusTraits overrides
+        static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
+        static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
+        //////////////////////////////////////////////////////////////////////////
+    };
+
+    using ROS2RequestBus = AZ::EBus<ROS2Requests, ROS2BusTraits>;
+    using ROS2Interface = AZ::Interface<ROS2Requests>;
+
+} // namespace ROS2

+ 4 - 0
Gems/ROS2/Code/Platform/Android/PAL_android.cmake

@@ -0,0 +1,4 @@
+
+set(PAL_TRAIT_ROS2_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_EDITOR_TEST_SUPPORTED TRUE)

+ 8 - 0
Gems/ROS2/Code/Platform/Android/ros2_android_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for Android
+# i.e. ../Source/Android/ROS2Android.cpp
+#      ../Source/Android/ROS2Android.h
+#      ../Include/Android/ROS2Android.h
+
+set(FILES
+)

+ 8 - 0
Gems/ROS2/Code/Platform/Android/ros2_shared_android_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for Android
+# i.e. ../Source/Android/ROS2Android.cpp
+#      ../Source/Android/ROS2Android.h
+#      ../Include/Android/ROS2Android.h
+
+set(FILES
+)

+ 4 - 0
Gems/ROS2/Code/Platform/Linux/PAL_linux.cmake

@@ -0,0 +1,4 @@
+
+set(PAL_TRAIT_ROS2_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_EDITOR_TEST_SUPPORTED TRUE)

+ 8 - 0
Gems/ROS2/Code/Platform/Linux/ros2_linux_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for Linux
+# i.e. ../Source/Linux/ROS2Linux.cpp
+#      ../Source/Linux/ROS2Linux.h
+#      ../Include/Linux/ROS2Linux.h
+
+set(FILES
+)

+ 8 - 0
Gems/ROS2/Code/Platform/Linux/ros2_shared_linux_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for Linux
+# i.e. ../Source/Linux/ROS2Linux.cpp
+#      ../Source/Linux/ROS2Linux.h
+#      ../Include/Linux/ROS2Linux.h
+
+set(FILES
+)

+ 4 - 0
Gems/ROS2/Code/Platform/Mac/PAL_mac.cmake

@@ -0,0 +1,4 @@
+
+set(PAL_TRAIT_ROS2_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_EDITOR_TEST_SUPPORTED TRUE)

+ 8 - 0
Gems/ROS2/Code/Platform/Mac/ros2_mac_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for Mac
+# i.e. ../Source/Mac/ROS2Mac.cpp
+#      ../Source/Mac/ROS2Mac.h
+#      ../Include/Mac/ROS2Mac.h
+
+set(FILES
+)

+ 8 - 0
Gems/ROS2/Code/Platform/Mac/ros2_shared_mac_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for Mac
+# i.e. ../Source/Mac/ROS2Mac.cpp
+#      ../Source/Mac/ROS2Mac.h
+#      ../Include/Mac/ROS2Mac.h
+
+set(FILES
+)

+ 4 - 0
Gems/ROS2/Code/Platform/Windows/PAL_windows.cmake

@@ -0,0 +1,4 @@
+
+set(PAL_TRAIT_ROS2_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_EDITOR_TEST_SUPPORTED TRUE)

+ 8 - 0
Gems/ROS2/Code/Platform/Windows/ros2_shared_windows_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for Windows
+# i.e. ../Source/Windows/ROS2Windows.cpp
+#      ../Source/Windows/ROS2Windows.h
+#      ../Include/Windows/ROS2Windows.h
+
+set(FILES
+)

+ 8 - 0
Gems/ROS2/Code/Platform/Windows/ros2_windows_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for Windows
+# i.e. ../Source/Windows/ROS2Windows.cpp
+#      ../Source/Windows/ROS2Windows.h
+#      ../Include/Windows/ROS2Windows.h
+
+set(FILES
+)

+ 4 - 0
Gems/ROS2/Code/Platform/iOS/PAL_ios.cmake

@@ -0,0 +1,4 @@
+
+set(PAL_TRAIT_ROS2_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_TEST_SUPPORTED TRUE)
+set(PAL_TRAIT_ROS2_EDITOR_TEST_SUPPORTED TRUE)

+ 8 - 0
Gems/ROS2/Code/Platform/iOS/ros2_ios_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for iOS
+# i.e. ../Source/iOS/ROS2iOS.cpp
+#      ../Source/iOS/ROS2iOS.h
+#      ../Include/iOS/ROS2iOS.h
+
+set(FILES
+)

+ 8 - 0
Gems/ROS2/Code/Platform/iOS/ros2_shared_ios_files.cmake

@@ -0,0 +1,8 @@
+
+# Platform specific files for iOS
+# i.e. ../Source/iOS/ROS2iOS.cpp
+#      ../Source/iOS/ROS2iOS.h
+#      ../Include/iOS/ROS2iOS.h
+
+set(FILES
+)

+ 38 - 0
Gems/ROS2/Code/Source/ROS2EditorModule.cpp

@@ -0,0 +1,38 @@
+
+#include <ROS2ModuleInterface.h>
+#include <ROS2EditorSystemComponent.h>
+
+namespace ROS2
+{
+    class ROS2EditorModule
+        : public ROS2ModuleInterface
+    {
+    public:
+        AZ_RTTI(ROS2EditorModule, "{e23a1379-787c-481e-ad83-c0e04a3d06fe}", ROS2ModuleInterface);
+        AZ_CLASS_ALLOCATOR(ROS2EditorModule, AZ::SystemAllocator, 0);
+
+        ROS2EditorModule()
+        {
+            // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
+            // Add ALL components descriptors associated with this gem to m_descriptors.
+            // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
+            // This happens through the [MyComponent]::Reflect() function.
+            m_descriptors.insert(m_descriptors.end(), {
+                ROS2EditorSystemComponent::CreateDescriptor(),
+            });
+        }
+
+        /**
+         * Add required SystemComponents to the SystemEntity.
+         * Non-SystemComponents should not be added here
+         */
+        AZ::ComponentTypeList GetRequiredSystemComponents() const override
+        {
+            return AZ::ComponentTypeList {
+                azrtti_typeid<ROS2EditorSystemComponent>(),
+            };
+        }
+    };
+}// namespace ROS2
+
+AZ_DECLARE_MODULE_CLASS(Gem_ROS2, ROS2::ROS2EditorModule)

+ 54 - 0
Gems/ROS2/Code/Source/ROS2EditorSystemComponent.cpp

@@ -0,0 +1,54 @@
+
+#include <AzCore/Serialization/SerializeContext.h>
+#include <ROS2EditorSystemComponent.h>
+
+namespace ROS2
+{
+    void ROS2EditorSystemComponent::Reflect(AZ::ReflectContext* context)
+    {
+        if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context))
+        {
+            serializeContext->Class<ROS2EditorSystemComponent, ROS2SystemComponent>()
+                ->Version(0);
+        }
+    }
+
+    ROS2EditorSystemComponent::ROS2EditorSystemComponent() = default;
+
+    ROS2EditorSystemComponent::~ROS2EditorSystemComponent() = default;
+
+    void ROS2EditorSystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
+    {
+        BaseSystemComponent::GetProvidedServices(provided);
+        provided.push_back(AZ_CRC_CE("ROS2EditorService"));
+    }
+
+    void ROS2EditorSystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
+    {
+        BaseSystemComponent::GetIncompatibleServices(incompatible);
+        incompatible.push_back(AZ_CRC_CE("ROS2EditorService"));
+    }
+
+    void ROS2EditorSystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
+    {
+        BaseSystemComponent::GetRequiredServices(required);
+    }
+
+    void ROS2EditorSystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
+    {
+        BaseSystemComponent::GetDependentServices(dependent);
+    }
+
+    void ROS2EditorSystemComponent::Activate()
+    {
+        ROS2SystemComponent::Activate();
+        AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
+    }
+
+    void ROS2EditorSystemComponent::Deactivate()
+    {
+        AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
+        ROS2SystemComponent::Deactivate();
+    }
+
+} // namespace ROS2

+ 33 - 0
Gems/ROS2/Code/Source/ROS2EditorSystemComponent.h

@@ -0,0 +1,33 @@
+
+#pragma once
+
+#include <ROS2SystemComponent.h>
+
+#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
+
+namespace ROS2
+{
+    /// System component for ROS2 editor
+    class ROS2EditorSystemComponent
+        : public ROS2SystemComponent
+        , private AzToolsFramework::EditorEvents::Bus::Handler
+    {
+        using BaseSystemComponent = ROS2SystemComponent;
+    public:
+        AZ_COMPONENT(ROS2EditorSystemComponent, "{34fa5d9a-956b-4655-a6bc-1d57dce8e7a2}", BaseSystemComponent);
+        static void Reflect(AZ::ReflectContext* context);
+
+        ROS2EditorSystemComponent();
+        ~ROS2EditorSystemComponent();
+
+    private:
+        static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
+        static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
+        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
+        static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
+
+        // AZ::Component
+        void Activate() override;
+        void Deactivate() override;
+    };
+} // namespace ROS2

+ 17 - 0
Gems/ROS2/Code/Source/ROS2Module.cpp

@@ -0,0 +1,17 @@
+
+
+#include <ROS2ModuleInterface.h>
+#include <ROS2SystemComponent.h>
+
+namespace ROS2
+{
+    class ROS2Module
+        : public ROS2ModuleInterface
+    {
+    public:
+        AZ_RTTI(ROS2Module, "{e23a1379-787c-481e-ad83-c0e04a3d06fe}", ROS2ModuleInterface);
+        AZ_CLASS_ALLOCATOR(ROS2Module, AZ::SystemAllocator, 0);
+    };
+}// namespace ROS2
+
+AZ_DECLARE_MODULE_CLASS(Gem_ROS2, ROS2::ROS2Module)

+ 36 - 0
Gems/ROS2/Code/Source/ROS2ModuleInterface.h

@@ -0,0 +1,36 @@
+
+#include <AzCore/Memory/SystemAllocator.h>
+#include <AzCore/Module/Module.h>
+#include <ROS2SystemComponent.h>
+
+namespace ROS2
+{
+    class ROS2ModuleInterface
+        : public AZ::Module
+    {
+    public:
+        AZ_RTTI(ROS2ModuleInterface, "{f99d36ce-3ec7-427b-8313-5c03bcce215b}", AZ::Module);
+        AZ_CLASS_ALLOCATOR(ROS2ModuleInterface, AZ::SystemAllocator, 0);
+
+        ROS2ModuleInterface()
+        {
+            // Push results of [MyComponent]::CreateDescriptor() into m_descriptors here.
+            // Add ALL components descriptors associated with this gem to m_descriptors.
+            // This will associate the AzTypeInfo information for the components with the the SerializeContext, BehaviorContext and EditContext.
+            // This happens through the [MyComponent]::Reflect() function.
+            m_descriptors.insert(m_descriptors.end(), {
+                ROS2SystemComponent::CreateDescriptor(),
+                });
+        }
+
+        /**
+         * Add required SystemComponents to the SystemEntity.
+         */
+        AZ::ComponentTypeList GetRequiredSystemComponents() const override
+        {
+            return AZ::ComponentTypeList{
+                azrtti_typeid<ROS2SystemComponent>(),
+            };
+        }
+    };
+}// namespace ROS2

+ 83 - 0
Gems/ROS2/Code/Source/ROS2SystemComponent.cpp

@@ -0,0 +1,83 @@
+
+#include <ROS2SystemComponent.h>
+
+#include <AzCore/Serialization/SerializeContext.h>
+#include <AzCore/Serialization/EditContext.h>
+#include <AzCore/Serialization/EditContextConstants.inl>
+
+namespace ROS2
+{
+    void ROS2SystemComponent::Reflect(AZ::ReflectContext* context)
+    {
+        if (AZ::SerializeContext* serialize = azrtti_cast<AZ::SerializeContext*>(context))
+        {
+            serialize->Class<ROS2SystemComponent, AZ::Component>()
+                ->Version(0)
+                ;
+
+            if (AZ::EditContext* ec = serialize->GetEditContext())
+            {
+                ec->Class<ROS2SystemComponent>("ROS2", "[Description of functionality provided by this System Component]")
+                    ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
+                        ->Attribute(AZ::Edit::Attributes::AppearsInAddComponentMenu, AZ_CRC("System"))
+                        ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
+                    ;
+            }
+        }
+    }
+
+    void ROS2SystemComponent::GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided)
+    {
+        provided.push_back(AZ_CRC_CE("ROS2Service"));
+    }
+
+    void ROS2SystemComponent::GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible)
+    {
+        incompatible.push_back(AZ_CRC_CE("ROS2Service"));
+    }
+
+    void ROS2SystemComponent::GetRequiredServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& required)
+    {
+    }
+
+    void ROS2SystemComponent::GetDependentServices([[maybe_unused]] AZ::ComponentDescriptor::DependencyArrayType& dependent)
+    {
+    }
+
+    ROS2SystemComponent::ROS2SystemComponent()
+    {
+        if (ROS2Interface::Get() == nullptr)
+        {
+            ROS2Interface::Register(this);
+        }
+    }
+
+    ROS2SystemComponent::~ROS2SystemComponent()
+    {
+        if (ROS2Interface::Get() == this)
+        {
+            ROS2Interface::Unregister(this);
+        }
+    }
+
+    void ROS2SystemComponent::Init()
+    {
+    }
+
+    void ROS2SystemComponent::Activate()
+    {
+        ROS2RequestBus::Handler::BusConnect();
+        AZ::TickBus::Handler::BusConnect();
+    }
+
+    void ROS2SystemComponent::Deactivate()
+    {
+        AZ::TickBus::Handler::BusDisconnect();
+        ROS2RequestBus::Handler::BusDisconnect();
+    }
+
+    void ROS2SystemComponent::OnTick([[maybe_unused]] float deltaTime, [[maybe_unused]] AZ::ScriptTimePoint time)
+    {
+    }
+
+} // namespace ROS2

+ 47 - 0
Gems/ROS2/Code/Source/ROS2SystemComponent.h

@@ -0,0 +1,47 @@
+
+#pragma once
+
+#include <AzCore/Component/Component.h>
+#include <AzCore/Component/TickBus.h>
+#include <ROS2/ROS2Bus.h>
+
+namespace ROS2
+{
+    class ROS2SystemComponent
+        : public AZ::Component
+        , protected ROS2RequestBus::Handler
+        , public AZ::TickBus::Handler
+    {
+    public:
+        AZ_COMPONENT(ROS2SystemComponent, "{c6d15812-3899-43f8-a808-e6870a4fc85a}");
+
+        static void Reflect(AZ::ReflectContext* context);
+
+        static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided);
+        static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
+        static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
+        static void GetDependentServices(AZ::ComponentDescriptor::DependencyArrayType& dependent);
+
+        ROS2SystemComponent();
+        ~ROS2SystemComponent();
+
+    protected:
+        ////////////////////////////////////////////////////////////////////////
+        // ROS2RequestBus interface implementation
+
+        ////////////////////////////////////////////////////////////////////////
+
+        ////////////////////////////////////////////////////////////////////////
+        // AZ::Component interface implementation
+        void Init() override;
+        void Activate() override;
+        void Deactivate() override;
+        ////////////////////////////////////////////////////////////////////////
+
+        ////////////////////////////////////////////////////////////////////////
+        // AZTickBus interface implementation
+        void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
+        ////////////////////////////////////////////////////////////////////////
+    };
+
+} // namespace ROS2

+ 4 - 0
Gems/ROS2/Code/Tests/ROS2EditorTest.cpp

@@ -0,0 +1,4 @@
+
+#include <AzTest/AzTest.h>
+
+AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);

+ 4 - 0
Gems/ROS2/Code/Tests/ROS2Test.cpp

@@ -0,0 +1,4 @@
+
+#include <AzTest/AzTest.h>
+
+AZ_UNIT_TEST_HOOK(DEFAULT_UNIT_TEST_ENV);

+ 5 - 0
Gems/ROS2/Code/ros2_editor_files.cmake

@@ -0,0 +1,5 @@
+
+set(FILES
+    Source/ROS2EditorSystemComponent.cpp
+    Source/ROS2EditorSystemComponent.h
+)

+ 4 - 0
Gems/ROS2/Code/ros2_editor_shared_files.cmake

@@ -0,0 +1,4 @@
+
+set(FILES
+    Source/ROS2EditorModule.cpp
+)

+ 4 - 0
Gems/ROS2/Code/ros2_editor_tests_files.cmake

@@ -0,0 +1,4 @@
+
+set(FILES
+    Tests/ROS2EditorTest.cpp
+)

+ 7 - 0
Gems/ROS2/Code/ros2_files.cmake

@@ -0,0 +1,7 @@
+
+set(FILES
+    Include/ROS2/ROS2Bus.h
+    Source/ROS2ModuleInterface.h
+    Source/ROS2SystemComponent.cpp
+    Source/ROS2SystemComponent.h
+)

+ 4 - 0
Gems/ROS2/Code/ros2_shared_files.cmake

@@ -0,0 +1,4 @@
+
+set(FILES
+    Source/ROS2Module.cpp
+)

+ 4 - 0
Gems/ROS2/Code/ros2_tests_files.cmake

@@ -0,0 +1,4 @@
+
+set(FILES
+    Tests/ROS2Test.cpp
+)

+ 1 - 0
Gems/ROS2/Platform/Android/android_gem.cmake

@@ -0,0 +1 @@
+

+ 3 - 0
Gems/ROS2/Platform/Android/android_gem.json

@@ -0,0 +1,3 @@
+{
+    "Tags": ["Android"],
+}

+ 1 - 0
Gems/ROS2/Platform/Linux/linux_gem.cmake

@@ -0,0 +1 @@
+

+ 3 - 0
Gems/ROS2/Platform/Linux/linux_gem.json

@@ -0,0 +1,3 @@
+{
+  "Tags": ["Linux"]
+}

+ 1 - 0
Gems/ROS2/Platform/Mac/mac_gem.cmake

@@ -0,0 +1 @@
+

+ 3 - 0
Gems/ROS2/Platform/Mac/mac_gem.json

@@ -0,0 +1,3 @@
+{
+  "Tags": ["Mac"]
+}

+ 1 - 0
Gems/ROS2/Platform/Windows/windows_gem.cmake

@@ -0,0 +1 @@
+

+ 3 - 0
Gems/ROS2/Platform/Windows/windows_gem.json

@@ -0,0 +1,3 @@
+{
+  "Tags": ["Windows"]
+}

+ 1 - 0
Gems/ROS2/Platform/iOS/ios_gem.cmake

@@ -0,0 +1 @@
+

+ 3 - 0
Gems/ROS2/Platform/iOS/ios_gem.json

@@ -0,0 +1,3 @@
+{
+    "Tags": ["iOS"]
+}

+ 18 - 0
Gems/ROS2/Registry/assetprocessor_settings.setreg

@@ -0,0 +1,18 @@
+{
+    "Amazon": {
+        "AssetProcessor": {
+            "Settings": {
+                "ScanFolder ROS2/Assets": {
+                    "watch": "@GEMROOT:ROS2@/Assets",
+                    "recursive": 1,
+                    "order": 101
+                },
+                "ScanFolder ROS2/Registry": {
+                    "watch": "@GEMROOT:ROS2@/Registry",
+                    "recursive": 1,
+                    "order": 102
+                }
+            }
+        }
+    }
+}

+ 21 - 0
Gems/ROS2/gem.json

@@ -0,0 +1,21 @@
+{
+    "gem_name": "ROS2",
+    "display_name": "ROS2",
+    "license": "What license ROS2 uses goes here: i.e. Apache-2.0 or MIT",
+    "license_url": "Link to the license web site goes here: i.e. https://opensource.org/licenses/Apache-2.0 Or https://opensource.org/licenses/MIT",
+    "origin": "The name of the originator goes here. i.e. XYZ Inc.",
+    "origin_url": "The primary repo for ROS2 goes here: i.e. http://www.mydomain.com",
+    "type": "Code",
+    "summary": "A short description of ROS2 goes here.",
+    "canonical_tags": [
+        "Gem"
+    ],
+    "user_tags": [
+        "ROS2"
+    ],
+    "icon_path": "preview.png",
+    "requirements": "Notice of any requirements ROS2 has goes here. i.e. This requires X other gem",
+    "documentation_url": "Link to any documentation of ROS2 goes here: i.e. https://o3de.org/docs/user-guide/gems/reference/design/white-box/",
+    "dependencies": [],
+    "restricted": "ROS2"
+}