Prechádzať zdrojové kódy

Added namespace to a global frame (#279)

Signed-off-by: Piotr Jaroszek <[email protected]>
Piotr Jaroszek 2 rokov pred
rodič
commit
c8f7d7e510

+ 2 - 2
Gems/ROS2/Code/Include/ROS2/Frame/ROS2FrameComponent.h

@@ -57,8 +57,8 @@ namespace ROS2
         const AZ::Transform& GetFrameTransform() const;
 
         //! Global frame name in ros2 ecosystem.
-        //! @return The name of the global frame. It is typically "odom", "map", "world".
-        static const char* GetGlobalFrameName(); // TODO - allow to configure global frame in a specialized component
+        //! @return The name of the global frame with namespace attached. It is typically "odom", "map", "world".
+        AZStd::string GetGlobalFrameName() const; // TODO - allow to configure global frame in a specialized component
 
     private:
         void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;

+ 2 - 2
Gems/ROS2/Code/Source/Frame/ROS2FrameComponent.cpp

@@ -107,10 +107,10 @@ namespace ROS2
         m_ros2Transform->Publish(GetFrameTransform());
     }
 
-    const char* ROS2FrameComponent::GetGlobalFrameName()
+    AZStd::string ROS2FrameComponent::GetGlobalFrameName() const
     {
         // TODO - parametrize this (typically: "odom", "world" and sometimes "map")
-        return "odom";
+        return ROS2Names::GetNamespacedName(GetNamespace(), AZStd::string("odom"));
     }
 
     bool ROS2FrameComponent::IsTopLevel() const