@@ -168,7 +168,7 @@ namespace SensorDebug
168
168
auto * physicsSystemConfigurationPtr = physicsSystem->GetConfiguration ();
169
169
auto * physicsSystemConfiguration = azdynamic_cast<const PhysX::PhysXSystemConfiguration*>(physicsSystemConfigurationPtr);
170
170
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 );
172
172
}
173
173
174
174
void SensorDebugSystemComponent::GetPhysXConfig ()
@@ -178,33 +178,45 @@ namespace SensorDebug
178
178
auto * physicsSystemConfigurationPtr = physicsSystem->GetConfiguration ();
179
179
auto * physicsSystemConfiguration = azdynamic_cast<const PhysX::PhysXSystemConfiguration*>(physicsSystemConfigurationPtr);
180
180
AZ_Assert (physicsSystemConfiguration, " Invalid physics system configuration pointer, a new Physics system in O3DE????" );
181
- ModifiedPhysXConfig = *physicsSystemConfiguration;
181
+ m_modifiedPhysXConfig = *physicsSystemConfiguration;
182
182
}
183
183
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
+ }
184
197
void SensorDebugSystemComponent::OnImGuiUpdate ()
185
198
{
186
199
ImGui::Begin (" ROS2 SensorDebugger" );
187
200
ImGui::Separator ();
188
201
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 ();
191
204
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 ;
196
208
197
209
auto timeSystem = AZ::Interface<AZ::ITime>::Get ();
198
210
const auto elapsedTime = timeSystem ? static_cast <double >(timeSystem->GetElapsedTimeUs ()) / 1e6 : 0.0 ;
199
211
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 () );
203
215
204
216
ImGui::Separator ();
205
217
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" );
208
220
if (ImGui::Button (" Update PhysX Config" ))
209
221
{
210
222
UpdatePhysXConfig ();
0 commit comments