Skip to content

Commit 3478183

Browse files
committed
Fix warning message to show precise jump back in time duration
1 parent 9e60fdc commit 3478183

File tree

26 files changed

+208
-156
lines changed

26 files changed

+208
-156
lines changed

src/systems/ackermann_steering/AckermannSteering.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -505,12 +505,14 @@ void AckermannSteering::PreUpdate(const UpdateInfo &_info,
505505
GZ_PROFILE("AckermannSteering::PreUpdate");
506506

507507
// \TODO(anyone) Support rewind
508-
if (_info.dt < std::chrono::steady_clock::duration::zero())
509-
{
510-
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;
513-
}
508+
509+
if (_info.dt < std::chrono::steady_clock::duration::zero())
510+
{
511+
gzwarn << "Detected jump back in time ["
512+
<< std::chrono::duration<double>(_info.dt).count()
513+
<< "s]. System may not work properly." << std::endl;
514+
}
515+
514516

515517
// If the joints haven't been identified yet, look for them
516518
static std::set<std::string> warnedModels;

src/systems/advanced_lift_drag/AdvancedLiftDrag.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -799,12 +799,14 @@ void AdvancedLiftDrag::PreUpdate(const UpdateInfo &_info,
799799
GZ_PROFILE("AdvancedLiftDrag::PreUpdate");
800800

801801
// \TODO(anyone) Support rewind
802-
if (_info.dt < std::chrono::steady_clock::duration::zero())
803-
{
804-
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;
807-
}
802+
803+
if (_info.dt < std::chrono::steady_clock::duration::zero())
804+
{
805+
gzwarn << "Detected jump back in time ["
806+
<< std::chrono::duration<double>(_info.dt).count()
807+
<< "s]. System may not work properly." << std::endl;
808+
}
809+
808810

809811
if (!this->dataPtr->initialized)
810812
{

src/systems/air_pressure/AirPressure.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ void AirPressure::PostUpdate(const UpdateInfo &_info,
129129
GZ_PROFILE("AirPressure::PostUpdate");
130130

131131
// \TODO(anyone) Support rewind
132-
if (_info.dt < std::chrono::steady_clock::duration::zero())
133-
{
134-
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;
137-
}
132+
133+
if (_info.dt < std::chrono::steady_clock::duration::zero())
134+
{
135+
gzwarn << "Detected jump back in time ["
136+
<< std::chrono::duration<double>(_info.dt).count()
137+
<< "s]. System may not work properly." << std::endl;
138+
}
139+
138140

139141
this->dataPtr->CreateSensors(_ecm);
140142

src/systems/air_speed/AirSpeed.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,14 @@ void AirSpeed::PostUpdate(const UpdateInfo &_info,
131131
GZ_PROFILE("AirSpeed::PostUpdate");
132132

133133
// \TODO(anyone) Support rewind
134-
if (_info.dt < std::chrono::steady_clock::duration::zero())
135-
{
136-
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;
139-
}
134+
135+
if (_info.dt < std::chrono::steady_clock::duration::zero())
136+
{
137+
gzwarn << "Detected jump back in time ["
138+
<< std::chrono::duration<double>(_info.dt).count()
139+
<< "s]. System may not work properly." << std::endl;
140+
}
141+
140142

141143
this->dataPtr->CreateSensors(_ecm);
142144

src/systems/altimeter/Altimeter.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,14 @@ void Altimeter::PostUpdate(const UpdateInfo &_info,
129129
GZ_PROFILE("Altimeter::PostUpdate");
130130

131131
// \TODO(anyone) Support rewind
132-
if (_info.dt < std::chrono::steady_clock::duration::zero())
133-
{
134-
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;
137-
}
132+
133+
if (_info.dt < std::chrono::steady_clock::duration::zero())
134+
{
135+
gzwarn << "Detected jump back in time ["
136+
<< std::chrono::duration<double>(_info.dt).count()
137+
<< "s]. System may not work properly." << std::endl;
138+
}
139+
138140

139141
this->dataPtr->CreateSensors(_ecm);
140142

src/systems/apply_joint_force/ApplyJointForce.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,14 @@ void ApplyJointForce::PreUpdate(const UpdateInfo &_info,
131131
GZ_PROFILE("ApplyJointForce::PreUpdate");
132132

133133
// \TODO(anyone) Support rewind
134-
if (_info.dt < std::chrono::steady_clock::duration::zero())
135-
{
136-
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;
139-
}
134+
135+
if (_info.dt < std::chrono::steady_clock::duration::zero())
136+
{
137+
gzwarn << "Detected jump back in time ["
138+
<< std::chrono::duration<double>(_info.dt).count()
139+
<< "s]. System may not work properly." << std::endl;
140+
}
141+
140142

141143
// If the joint hasn't been identified yet, look for it
142144
//! [findJoint]

src/systems/battery_plugin/LinearBatteryPlugin.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,14 @@ void LinearBatteryPlugin::Update(const UpdateInfo &_info,
547547
GZ_PROFILE("LinearBatteryPlugin::Update");
548548

549549
// \TODO(anyone) Support rewind
550-
if (_info.dt < std::chrono::steady_clock::duration::zero())
551-
{
552-
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;
555-
}
550+
551+
if (_info.dt < std::chrono::steady_clock::duration::zero())
552+
{
553+
gzwarn << "Detected jump back in time ["
554+
<< std::chrono::duration<double>(_info.dt).count()
555+
<< "s]. System may not work properly." << std::endl;
556+
}
557+
556558

557559
if (_info.paused)
558560
return;

src/systems/contact/Contact.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -273,12 +273,14 @@ void Contact::PostUpdate(const UpdateInfo &_info,
273273
GZ_PROFILE("Contact::PostUpdate");
274274

275275
// \TODO(anyone) Support rewind
276-
if (_info.dt < std::chrono::steady_clock::duration::zero())
277-
{
278-
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;
281-
}
276+
277+
if (_info.dt < std::chrono::steady_clock::duration::zero())
278+
{
279+
gzwarn << "Detected jump back in time ["
280+
<< std::chrono::duration<double>(_info.dt).count()
281+
<< "s]. System may not work properly." << std::endl;
282+
}
283+
282284

283285
if (!_info.paused)
284286
{

src/systems/diff_drive/DiffDrive.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -393,12 +393,14 @@ void DiffDrive::PreUpdate(const UpdateInfo &_info,
393393
GZ_PROFILE("DiffDrive::PreUpdate");
394394

395395
// \TODO(anyone) Support rewind
396-
if (_info.dt < std::chrono::steady_clock::duration::zero())
397-
{
398-
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;
401-
}
396+
397+
if (_info.dt < std::chrono::steady_clock::duration::zero())
398+
{
399+
gzwarn << "Detected jump back in time ["
400+
<< std::chrono::duration<double>(_info.dt).count()
401+
<< "s]. System may not work properly." << std::endl;
402+
}
403+
402404

403405
// If the joints haven't been identified yet, look for them
404406
static std::set<std::string> warnedModels;

src/systems/force_torque/ForceTorque.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,14 @@ void ForceTorque::PostUpdate(const UpdateInfo &_info,
163163
GZ_PROFILE("ForceTorque::PostUpdate");
164164

165165
// \TODO(anyone) Support rewind
166-
if (_info.dt < std::chrono::steady_clock::duration::zero())
167-
{
168-
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;
171-
}
166+
167+
if (_info.dt < std::chrono::steady_clock::duration::zero())
168+
{
169+
gzwarn << "Detected jump back in time ["
170+
<< std::chrono::duration<double>(_info.dt).count()
171+
<< "s]. System may not work properly." << std::endl;
172+
}
173+
172174

173175
this->dataPtr->CreateSensors(_ecm);
174176

src/systems/imu/Imu.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ void Imu::PostUpdate(const UpdateInfo &_info,
133133
GZ_PROFILE("Imu::PostUpdate");
134134

135135
// \TODO(anyone) Support rewind
136-
if (_info.dt < std::chrono::steady_clock::duration::zero())
137-
{
138-
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;
141-
}
136+
137+
if (_info.dt < std::chrono::steady_clock::duration::zero())
138+
{
139+
gzwarn << "Detected jump back in time ["
140+
<< std::chrono::duration<double>(_info.dt).count()
141+
<< "s]. System may not work properly." << std::endl;
142+
}
143+
142144

143145
this->dataPtr->CreateSensors(_ecm);
144146

src/systems/joint_controller/JointController.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -262,12 +262,14 @@ void JointController::PreUpdate(const UpdateInfo &_info,
262262
GZ_PROFILE("JointController::PreUpdate");
263263

264264
// \TODO(anyone) Support rewind
265-
if (_info.dt < std::chrono::steady_clock::duration::zero())
266-
{
267-
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;
270-
}
265+
266+
if (_info.dt < std::chrono::steady_clock::duration::zero())
267+
{
268+
gzwarn << "Detected jump back in time ["
269+
<< std::chrono::duration<double>(_info.dt).count()
270+
<< "s]. System may not work properly." << std::endl;
271+
}
272+
271273

272274
// If the joints haven't been identified yet, look for them
273275
if (this->dataPtr->jointEntities.empty())

src/systems/joint_position_controller/JointPositionController.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -336,12 +336,14 @@ void JointPositionController::PreUpdate(
336336
}
337337

338338
// \TODO(anyone) Support rewind
339-
if (_info.dt < std::chrono::steady_clock::duration::zero())
340-
{
341-
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;
344-
}
339+
340+
if (_info.dt < std::chrono::steady_clock::duration::zero())
341+
{
342+
gzwarn << "Detected jump back in time ["
343+
<< std::chrono::duration<double>(_info.dt).count()
344+
<< "s]. System may not work properly." << std::endl;
345+
}
346+
345347

346348
// If the joints haven't been identified yet, look for them
347349
if (this->dataPtr->jointEntities.empty())

src/systems/lift_drag/LiftDrag.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -547,12 +547,14 @@ void LiftDrag::PreUpdate(const UpdateInfo &_info, EntityComponentManager &_ecm)
547547
GZ_PROFILE("LiftDrag::PreUpdate");
548548

549549
// \TODO(anyone) Support rewind
550-
if (_info.dt < std::chrono::steady_clock::duration::zero())
551-
{
552-
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;
555-
}
550+
551+
if (_info.dt < std::chrono::steady_clock::duration::zero())
552+
{
553+
gzwarn << "Detected jump back in time ["
554+
<< std::chrono::duration<double>(_info.dt).count()
555+
<< "s]. System may not work properly." << std::endl;
556+
}
557+
556558

557559
if (!this->dataPtr->initialized)
558560
{

src/systems/log/LogRecord.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -666,12 +666,14 @@ void LogRecord::PostUpdate(const UpdateInfo &_info,
666666
return;
667667

668668
// \TODO(anyone) Support rewind
669-
if (_info.dt < std::chrono::steady_clock::duration::zero())
670-
{
671-
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;
674-
}
669+
670+
if (_info.dt < std::chrono::steady_clock::duration::zero())
671+
{
672+
gzwarn << "Detected jump back in time ["
673+
<< std::chrono::duration<double>(_info.dt).count()
674+
<< "s]. System may not work properly." << std::endl;
675+
}
676+
675677

676678
// Publish only once
677679
if (!this->dataPtr->sdfPublished)

src/systems/logical_camera/LogicalCamera.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,14 @@ void LogicalCamera::PostUpdate(const UpdateInfo &_info,
131131
GZ_PROFILE("LogicalCamera::PostUpdate");
132132

133133
// \TODO(anyone) Support rewind
134-
if (_info.dt < std::chrono::steady_clock::duration::zero())
135-
{
136-
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;
139-
}
134+
135+
if (_info.dt < std::chrono::steady_clock::duration::zero())
136+
{
137+
gzwarn << "Detected jump back in time ["
138+
<< std::chrono::duration<double>(_info.dt).count()
139+
<< "s]. System may not work properly." << std::endl;
140+
}
141+
140142

141143
this->dataPtr->CreateSensors(_ecm);
142144

src/systems/magnetometer/Magnetometer.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,14 @@ void Magnetometer::PostUpdate(const UpdateInfo &_info,
271271
GZ_PROFILE("Magnetometer::PostUpdate");
272272

273273
// \TODO(anyone) Support rewind
274-
if (_info.dt < std::chrono::steady_clock::duration::zero())
275-
{
276-
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;
279-
}
274+
275+
if (_info.dt < std::chrono::steady_clock::duration::zero())
276+
{
277+
gzwarn << "Detected jump back in time ["
278+
<< std::chrono::duration<double>(_info.dt).count()
279+
<< "s]. System may not work properly." << std::endl;
280+
}
281+
280282

281283
this->dataPtr->CreateSensors(_ecm);
282284

src/systems/mecanum_drive/MecanumDrive.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -330,12 +330,14 @@ void MecanumDrive::PreUpdate(const gz::sim::UpdateInfo &_info,
330330
GZ_PROFILE("MecanumDrive::PreUpdate");
331331

332332
// \TODO(anyone) Support rewind
333-
if (_info.dt < std::chrono::steady_clock::duration::zero())
334-
{
335-
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;
338-
}
333+
334+
if (_info.dt < std::chrono::steady_clock::duration::zero())
335+
{
336+
gzwarn << "Detected jump back in time ["
337+
<< std::chrono::duration<double>(_info.dt).count()
338+
<< "s]. System may not work properly." << std::endl;
339+
}
340+
339341

340342
// If the joints haven't been identified yet, look for them
341343
static std::set<std::string> warnedModels;

src/systems/multicopter_control/MulticopterVelocityControl.cc

+8-6
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,14 @@ void MulticopterVelocityControl::PreUpdate(
346346
}
347347

348348
// \TODO(anyone) Support rewind
349-
if (_info.dt < std::chrono::steady_clock::duration::zero())
350-
{
351-
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;
354-
}
349+
350+
if (_info.dt < std::chrono::steady_clock::duration::zero())
351+
{
352+
gzwarn << "Detected jump back in time ["
353+
<< std::chrono::duration<double>(_info.dt).count()
354+
<< "s]. System may not work properly." << std::endl;
355+
}
356+
355357

356358
// Nothing left to do if paused.
357359
if (_info.paused)

0 commit comments

Comments
 (0)