Skip to content

Commit 0cc0464

Browse files
Fix warning message to show precise jump back in time duration (#2435)
--------- Signed-off-by: AddisonFarley <93640684+AddisonFarley@users.noreply.github.com>
1 parent 9e60fdc commit 0cc0464

File tree

26 files changed

+52
-52
lines changed

26 files changed

+52
-52
lines changed

src/systems/ackermann_steering/AckermannSteering.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,8 @@ void AckermannSteering::PreUpdate(const UpdateInfo &_info,
508508
if (_info.dt < std::chrono::steady_clock::duration::zero())
509509
{
510510
gzwarn << "Detected jump back in time ["
511-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
512-
<< "s]. System may not work properly." << std::endl;
511+
<< std::chrono::duration<double>(_info.dt).count()
512+
<< "s]. System may not work properly." << std::endl;
513513
}
514514

515515
// If the joints haven't been identified yet, look for them

src/systems/advanced_lift_drag/AdvancedLiftDrag.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -802,8 +802,8 @@ void AdvancedLiftDrag::PreUpdate(const UpdateInfo &_info,
802802
if (_info.dt < std::chrono::steady_clock::duration::zero())
803803
{
804804
gzwarn << "Detected jump back in time ["
805-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
806-
<< "s]. System may not work properly." << std::endl;
805+
<< std::chrono::duration<double>(_info.dt).count()
806+
<< "s]. System may not work properly." << std::endl;
807807
}
808808

809809
if (!this->dataPtr->initialized)

src/systems/air_pressure/AirPressure.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ void AirPressure::PostUpdate(const UpdateInfo &_info,
132132
if (_info.dt < std::chrono::steady_clock::duration::zero())
133133
{
134134
gzwarn << "Detected jump back in time ["
135-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
136-
<< "s]. System may not work properly." << std::endl;
135+
<< std::chrono::duration<double>(_info.dt).count()
136+
<< "s]. System may not work properly." << std::endl;
137137
}
138138

139139
this->dataPtr->CreateSensors(_ecm);

src/systems/air_speed/AirSpeed.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ void AirSpeed::PostUpdate(const UpdateInfo &_info,
134134
if (_info.dt < std::chrono::steady_clock::duration::zero())
135135
{
136136
gzwarn << "Detected jump back in time ["
137-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
138-
<< "s]. System may not work properly." << std::endl;
137+
<< std::chrono::duration<double>(_info.dt).count()
138+
<< "s]. System may not work properly." << std::endl;
139139
}
140140

141141
this->dataPtr->CreateSensors(_ecm);

src/systems/altimeter/Altimeter.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,8 @@ void Altimeter::PostUpdate(const UpdateInfo &_info,
132132
if (_info.dt < std::chrono::steady_clock::duration::zero())
133133
{
134134
gzwarn << "Detected jump back in time ["
135-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
136-
<< "s]. System may not work properly." << std::endl;
135+
<< std::chrono::duration<double>(_info.dt).count()
136+
<< "s]. System may not work properly." << std::endl;
137137
}
138138

139139
this->dataPtr->CreateSensors(_ecm);

src/systems/apply_joint_force/ApplyJointForce.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ void ApplyJointForce::PreUpdate(const UpdateInfo &_info,
134134
if (_info.dt < std::chrono::steady_clock::duration::zero())
135135
{
136136
gzwarn << "Detected jump back in time ["
137-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
138-
<< "s]. System may not work properly." << std::endl;
137+
<< std::chrono::duration<double>(_info.dt).count()
138+
<< "s]. System may not work properly." << std::endl;
139139
}
140140

141141
// If the joint hasn't been identified yet, look for it

src/systems/battery_plugin/LinearBatteryPlugin.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ void LinearBatteryPlugin::Update(const UpdateInfo &_info,
550550
if (_info.dt < std::chrono::steady_clock::duration::zero())
551551
{
552552
gzwarn << "Detected jump back in time ["
553-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
554-
<< "s]. System may not work properly." << std::endl;
553+
<< std::chrono::duration<double>(_info.dt).count()
554+
<< "s]. System may not work properly." << std::endl;
555555
}
556556

557557
if (_info.paused)

src/systems/contact/Contact.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ void Contact::PostUpdate(const UpdateInfo &_info,
276276
if (_info.dt < std::chrono::steady_clock::duration::zero())
277277
{
278278
gzwarn << "Detected jump back in time ["
279-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
280-
<< "s]. System may not work properly." << std::endl;
279+
<< std::chrono::duration<double>(_info.dt).count()
280+
<< "s]. System may not work properly." << std::endl;
281281
}
282282

283283
if (!_info.paused)

src/systems/diff_drive/DiffDrive.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ void DiffDrive::PreUpdate(const UpdateInfo &_info,
396396
if (_info.dt < std::chrono::steady_clock::duration::zero())
397397
{
398398
gzwarn << "Detected jump back in time ["
399-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
400-
<< "s]. System may not work properly." << std::endl;
399+
<< std::chrono::duration<double>(_info.dt).count()
400+
<< "s]. System may not work properly." << std::endl;
401401
}
402402

403403
// If the joints haven't been identified yet, look for them

src/systems/force_torque/ForceTorque.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ void ForceTorque::PostUpdate(const UpdateInfo &_info,
166166
if (_info.dt < std::chrono::steady_clock::duration::zero())
167167
{
168168
gzwarn << "Detected jump back in time ["
169-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
170-
<< "s]. System may not work properly." << std::endl;
169+
<< std::chrono::duration<double>(_info.dt).count()
170+
<< "s]. System may not work properly." << std::endl;
171171
}
172172

173173
this->dataPtr->CreateSensors(_ecm);

src/systems/imu/Imu.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ void Imu::PostUpdate(const UpdateInfo &_info,
136136
if (_info.dt < std::chrono::steady_clock::duration::zero())
137137
{
138138
gzwarn << "Detected jump back in time ["
139-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
140-
<< "s]. System may not work properly." << std::endl;
139+
<< std::chrono::duration<double>(_info.dt).count()
140+
<< "s]. System may not work properly." << std::endl;
141141
}
142142

143143
this->dataPtr->CreateSensors(_ecm);

src/systems/joint_controller/JointController.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,8 @@ void JointController::PreUpdate(const UpdateInfo &_info,
265265
if (_info.dt < std::chrono::steady_clock::duration::zero())
266266
{
267267
gzwarn << "Detected jump back in time ["
268-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
269-
<< "s]. System may not work properly." << std::endl;
268+
<< std::chrono::duration<double>(_info.dt).count()
269+
<< "s]. System may not work properly." << std::endl;
270270
}
271271

272272
// If the joints haven't been identified yet, look for them

src/systems/joint_position_controller/JointPositionController.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,8 @@ void JointPositionController::PreUpdate(
339339
if (_info.dt < std::chrono::steady_clock::duration::zero())
340340
{
341341
gzwarn << "Detected jump back in time ["
342-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
343-
<< "s]. System may not work properly." << std::endl;
342+
<< std::chrono::duration<double>(_info.dt).count()
343+
<< "s]. System may not work properly." << std::endl;
344344
}
345345

346346
// If the joints haven't been identified yet, look for them

src/systems/lift_drag/LiftDrag.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ void LiftDrag::PreUpdate(const UpdateInfo &_info, EntityComponentManager &_ecm)
550550
if (_info.dt < std::chrono::steady_clock::duration::zero())
551551
{
552552
gzwarn << "Detected jump back in time ["
553-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
554-
<< "s]. System may not work properly." << std::endl;
553+
<< std::chrono::duration<double>(_info.dt).count()
554+
<< "s]. System may not work properly." << std::endl;
555555
}
556556

557557
if (!this->dataPtr->initialized)

src/systems/log/LogRecord.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,8 @@ void LogRecord::PostUpdate(const UpdateInfo &_info,
669669
if (_info.dt < std::chrono::steady_clock::duration::zero())
670670
{
671671
gzwarn << "Detected jump back in time ["
672-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
673-
<< "s]. System may not work properly." << std::endl;
672+
<< std::chrono::duration<double>(_info.dt).count()
673+
<< "s]. System may not work properly." << std::endl;
674674
}
675675

676676
// Publish only once

src/systems/logical_camera/LogicalCamera.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ void LogicalCamera::PostUpdate(const UpdateInfo &_info,
134134
if (_info.dt < std::chrono::steady_clock::duration::zero())
135135
{
136136
gzwarn << "Detected jump back in time ["
137-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
138-
<< "s]. System may not work properly." << std::endl;
137+
<< std::chrono::duration<double>(_info.dt).count()
138+
<< "s]. System may not work properly." << std::endl;
139139
}
140140

141141
this->dataPtr->CreateSensors(_ecm);

src/systems/magnetometer/Magnetometer.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ void Magnetometer::PostUpdate(const UpdateInfo &_info,
274274
if (_info.dt < std::chrono::steady_clock::duration::zero())
275275
{
276276
gzwarn << "Detected jump back in time ["
277-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
278-
<< "s]. System may not work properly." << std::endl;
277+
<< std::chrono::duration<double>(_info.dt).count()
278+
<< "s]. System may not work properly." << std::endl;
279279
}
280280

281281
this->dataPtr->CreateSensors(_ecm);

src/systems/mecanum_drive/MecanumDrive.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@ void MecanumDrive::PreUpdate(const gz::sim::UpdateInfo &_info,
333333
if (_info.dt < std::chrono::steady_clock::duration::zero())
334334
{
335335
gzwarn << "Detected jump back in time ["
336-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
337-
<< "s]. System may not work properly." << std::endl;
336+
<< std::chrono::duration<double>(_info.dt).count()
337+
<< "s]. System may not work properly." << std::endl;
338338
}
339339

340340
// If the joints haven't been identified yet, look for them

src/systems/multicopter_control/MulticopterVelocityControl.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,8 @@ void MulticopterVelocityControl::PreUpdate(
349349
if (_info.dt < std::chrono::steady_clock::duration::zero())
350350
{
351351
gzwarn << "Detected jump back in time ["
352-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
353-
<< "s]. System may not work properly." << std::endl;
352+
<< std::chrono::duration<double>(_info.dt).count()
353+
<< "s]. System may not work properly." << std::endl;
354354
}
355355

356356
// Nothing left to do if paused.

src/systems/multicopter_motor_model/MulticopterMotorModel.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ void MulticopterMotorModel::PreUpdate(const UpdateInfo &_info,
399399
if (_info.dt < std::chrono::steady_clock::duration::zero())
400400
{
401401
gzwarn << "Detected jump back in time ["
402-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
403-
<< "s]. System may not work properly." << std::endl;
402+
<< std::chrono::duration<double>(_info.dt).count()
403+
<< "s]. System may not work properly." << std::endl;
404404
}
405405

406406
// If the joint or links haven't been identified yet, look for them

src/systems/navsat/NavSat.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ void NavSat::PostUpdate(const UpdateInfo &_info,
128128
if (_info.dt < std::chrono::steady_clock::duration::zero())
129129
{
130130
gzwarn << "Detected jump back in time ["
131-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
132-
<< "s]. System may not work properly." << std::endl;
131+
<< std::chrono::duration<double>(_info.dt).count()
132+
<< "s]. System may not work properly." << std::endl;
133133
}
134134

135135
this->dataPtr->CreateSensors(_ecm);

src/systems/odometry_publisher/OdometryPublisher.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ void OdometryPublisher::PreUpdate(const gz::sim::UpdateInfo &_info,
297297
if (_info.dt < std::chrono::steady_clock::duration::zero())
298298
{
299299
gzwarn << "Detected jump back in time ["
300-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
301-
<< "s]. System may not work properly." << std::endl;
300+
<< std::chrono::duration<double>(_info.dt).count()
301+
<< "s]. System may not work properly." << std::endl;
302302
}
303303

304304
// Create the pose component if it does not exist.

src/systems/pose_publisher/PosePublisher.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ void PosePublisher::PostUpdate(const UpdateInfo &_info,
297297
if (_info.dt < std::chrono::steady_clock::duration::zero())
298298
{
299299
gzwarn << "Detected jump back in time ["
300-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
301-
<< "s]. System may not work properly." << std::endl;
300+
<< std::chrono::duration<double>(_info.dt).count()
301+
<< "s]. System may not work properly." << std::endl;
302302
}
303303

304304
// Nothing left to do if paused.

src/systems/touch_plugin/TouchPlugin.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@ void TouchPluginPrivate::Update(const UpdateInfo &_info,
251251
if (_info.dt < std::chrono::steady_clock::duration::zero())
252252
{
253253
gzwarn << "Detected jump back in time ["
254-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
255-
<< "s]. System may not work properly." << std::endl;
254+
<< std::chrono::duration<double>(_info.dt).count()
255+
<< "s]. System may not work properly." << std::endl;
256256
}
257257

258258
{

src/systems/velocity_control/VelocityControl.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ void VelocityControl::PreUpdate(const UpdateInfo &_info,
188188
if (_info.dt < std::chrono::steady_clock::duration::zero())
189189
{
190190
gzwarn << "Detected jump back in time ["
191-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
192-
<< "s]. System may not work properly." << std::endl;
191+
<< std::chrono::duration<double>(_info.dt).count()
192+
<< "s]. System may not work properly." << std::endl;
193193
}
194194

195195
// Nothing left to do if paused.

src/systems/wind_effects/WindEffects.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,8 @@ void WindEffects::PreUpdate(const UpdateInfo &_info,
716716
if (_info.dt < std::chrono::steady_clock::duration::zero())
717717
{
718718
gzwarn << "Detected jump back in time ["
719-
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
720-
<< "s]. System may not work properly." << std::endl;
719+
<< std::chrono::duration<double>(_info.dt).count()
720+
<< "s]. System may not work properly." << std::endl;
721721
}
722722

723723
// Process commands

0 commit comments

Comments
 (0)