2
0
Эх сурвалжийг харах

Set up namespaces before setting up transform publishing (#149)

* Set up namespaces before setting up transform publishing

Fixes https://github.com/RobotecAI/o3de-ros2-gem/issues/148

* Update ROS2FrameComponent.cpp

Signed-off-by: Lars Gleim <[email protected]>
Lars Gleim 3 жил өмнө
parent
commit
5f3ba15a42

+ 10 - 1
Gems/ROS2/Code/Source/Frame/ROS2FrameComponent.cpp

@@ -18,8 +18,18 @@ namespace ROS2
 {
     void ROS2FrameComponent::Activate()
     {
+        m_namespaceConfiguration.PopulateNamespace(IsTopLevel(), GetEntity()->GetName());
+
         if (m_publishTransform)
         {
+            AZ_TracePrintf(
+                "ROS2FrameComponent",
+                "Setting up %s transfrom between parent %s and child %s to be published %s",
+                IsDynamic() ? "dynamic" : "static",
+                GetParentFrameID().data(),
+                GetFrameID().data(),
+                IsDynamic() ? "continuously to /tf" : "once to /tf_static");
+
             m_ros2Transform = AZStd::make_unique<ROS2Transform>(GetParentFrameID(), GetFrameID(), IsDynamic());
             if (IsDynamic())
             {
@@ -30,7 +40,6 @@ namespace ROS2
                 m_ros2Transform->Publish(GetFrameTransform());
             }
         }
-        m_namespaceConfiguration.PopulateNamespace(IsTopLevel(), GetEntity()->GetName());
     }
 
     void ROS2FrameComponent::Deactivate()