@@ -168,7 +168,7 @@ namespace SensorDebug
168168 auto * physicsSystemConfigurationPtr = physicsSystem->GetConfiguration ();
169169 auto * physicsSystemConfiguration = azdynamic_cast<const PhysX::PhysXSystemConfiguration*>(physicsSystemConfigurationPtr);
170170 AZ_Assert (physicsSystemConfiguration, " Invalid physics system configuration pointer, a new Physics system in O3DE????" );
171- physicsSystem->UpdateConfiguration (&ModifiedPhysXConfig , true );
171+ physicsSystem->UpdateConfiguration (&m_modifiedPhysXConfig , true );
172172 }
173173
174174 void SensorDebugSystemComponent::GetPhysXConfig ()
@@ -178,33 +178,45 @@ namespace SensorDebug
178178 auto * physicsSystemConfigurationPtr = physicsSystem->GetConfiguration ();
179179 auto * physicsSystemConfiguration = azdynamic_cast<const PhysX::PhysXSystemConfiguration*>(physicsSystemConfigurationPtr);
180180 AZ_Assert (physicsSystemConfiguration, " Invalid physics system configuration pointer, a new Physics system in O3DE????" );
181- ModifiedPhysXConfig = *physicsSystemConfiguration;
181+ m_modifiedPhysXConfig = *physicsSystemConfiguration;
182182 }
183183
184+ AZStd::string GetSecondAnimation (double value)
185+ {
186+ double part = value - AZStd::floor (value);
187+ size_t numStars = static_cast <size_t >(part * 60 );
188+
189+ AZStd::string anim (61 , ' ' );
190+ numStars = AZStd::min (numStars, anim.length ());
191+ for (size_t i = 0 ; i <numStars; i++)
192+ {
193+ anim[i] = ' *' ;
194+ }
195+ return anim;
196+ }
184197 void SensorDebugSystemComponent::OnImGuiUpdate ()
185198 {
186199 ImGui::Begin (" ROS2 SensorDebugger" );
187200 ImGui::Separator ();
188201 ImGui::Text (" TimeyWimey Stuff" );
189-
190- auto ros2ts = ROS2::ROS2Interface::Get ()->GetROSTimestamp ();
202+ const auto ros2Intreface = ROS2::ROS2Interface::Get ();
203+ auto ros2ts = ros2Intreface ? ROS2::ROS2Interface::Get ()->GetROSTimestamp () : builtin_interfaces::msg::Time ();
191204 const float ros2tsSec = ros2ts.sec + ros2ts.nanosec / 1e9 ;
192- auto ros2Node = ROS2::ROS2Interface::Get ()->GetNode ();
193-
194- auto nodeTime = ros2Node->now ();
195- const float ros2nodetsSec = nodeTime.seconds () + nodeTime.nanoseconds () / 1e9 ;
205+ auto ros2Node = ros2Intreface ? ROS2::ROS2Interface::Get ()->GetNode () : nullptr ;
206+ auto nodeTime = ros2Node ? ros2Node->now () : rclcpp::Time (0 , 0 );
207+ const double ros2nodetsSec = nodeTime.seconds () + nodeTime.nanoseconds () / 1e9 ;
196208
197209 auto timeSystem = AZ::Interface<AZ::ITime>::Get ();
198210 const auto elapsedTime = timeSystem ? static_cast <double >(timeSystem->GetElapsedTimeUs ()) / 1e6 : 0.0 ;
199211
200- ImGui::Text (" Current ROS 2 time (Gem) : %f" , ros2tsSec);
201- ImGui::Text (" Current ROS 2 time (Node) : %f" , ros2nodetsSec);
202- ImGui::Text (" Current O3DE time : %f" , elapsedTime);
212+ ImGui::Text (" Current ROS 2 time (Gem) : %f %s " , ros2tsSec, GetSecondAnimation (ros2tsSec). c_str () );
213+ ImGui::Text (" Current ROS 2 time (Node) : %f %s " , ros2nodetsSec, GetSecondAnimation (ros2nodetsSec). c_str () );
214+ ImGui::Text (" Current O3DE time : %f %s " , elapsedTime, GetSecondAnimation (elapsedTime). c_str () );
203215
204216 ImGui::Separator ();
205217 ImGui::Text (" PhysX" );
206- ImGui::InputFloat (" Fixed timestamp" , &ModifiedPhysXConfig .m_fixedTimestep , 0 .0f , 0 .0f , " %.6f" );
207- ImGui::InputFloat (" Max timestamp" , &ModifiedPhysXConfig .m_maxTimestep , 0 .0f , 0 .0f , " %.6f" git a );
218+ ImGui::InputFloat (" Fixed timestamp" , &m_modifiedPhysXConfig .m_fixedTimestep , 0 .0f , 0 .0f , " %.6f" );
219+ ImGui::InputFloat (" Max timestamp" , &m_modifiedPhysXConfig .m_maxTimestep , 0 .0f , 0 .0f , " %.6f" );
208220 if (ImGui::Button (" Update PhysX Config" ))
209221 {
210222 UpdatePhysXConfig ();
0 commit comments