Skip to content

Commit

Permalink
Fix warning message to show precise jump back in time duration
Browse files Browse the repository at this point in the history
  • Loading branch information
AddisonFarley committed Jun 6, 2024
1 parent 9e60fdc commit 3478183
Show file tree
Hide file tree
Showing 26 changed files with 208 additions and 156 deletions.
14 changes: 8 additions & 6 deletions src/systems/ackermann_steering/AckermannSteering.cc
Original file line number Diff line number Diff line change
Expand Up @@ -505,12 +505,14 @@ void AckermannSteering::PreUpdate(const UpdateInfo &_info,
GZ_PROFILE("AckermannSteering::PreUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


// If the joints haven't been identified yet, look for them
static std::set<std::string> warnedModels;
Expand Down
14 changes: 8 additions & 6 deletions src/systems/advanced_lift_drag/AdvancedLiftDrag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -799,12 +799,14 @@ void AdvancedLiftDrag::PreUpdate(const UpdateInfo &_info,
GZ_PROFILE("AdvancedLiftDrag::PreUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


if (!this->dataPtr->initialized)
{
Expand Down
14 changes: 8 additions & 6 deletions src/systems/air_pressure/AirPressure.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ void AirPressure::PostUpdate(const UpdateInfo &_info,
GZ_PROFILE("AirPressure::PostUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


this->dataPtr->CreateSensors(_ecm);

Expand Down
14 changes: 8 additions & 6 deletions src/systems/air_speed/AirSpeed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ void AirSpeed::PostUpdate(const UpdateInfo &_info,
GZ_PROFILE("AirSpeed::PostUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


this->dataPtr->CreateSensors(_ecm);

Expand Down
14 changes: 8 additions & 6 deletions src/systems/altimeter/Altimeter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,14 @@ void Altimeter::PostUpdate(const UpdateInfo &_info,
GZ_PROFILE("Altimeter::PostUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


this->dataPtr->CreateSensors(_ecm);

Expand Down
14 changes: 8 additions & 6 deletions src/systems/apply_joint_force/ApplyJointForce.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ void ApplyJointForce::PreUpdate(const UpdateInfo &_info,
GZ_PROFILE("ApplyJointForce::PreUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


// If the joint hasn't been identified yet, look for it
//! [findJoint]
Expand Down
14 changes: 8 additions & 6 deletions src/systems/battery_plugin/LinearBatteryPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,14 @@ void LinearBatteryPlugin::Update(const UpdateInfo &_info,
GZ_PROFILE("LinearBatteryPlugin::Update");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


if (_info.paused)
return;
Expand Down
14 changes: 8 additions & 6 deletions src/systems/contact/Contact.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,12 +273,14 @@ void Contact::PostUpdate(const UpdateInfo &_info,
GZ_PROFILE("Contact::PostUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


if (!_info.paused)
{
Expand Down
14 changes: 8 additions & 6 deletions src/systems/diff_drive/DiffDrive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,14 @@ void DiffDrive::PreUpdate(const UpdateInfo &_info,
GZ_PROFILE("DiffDrive::PreUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


// If the joints haven't been identified yet, look for them
static std::set<std::string> warnedModels;
Expand Down
14 changes: 8 additions & 6 deletions src/systems/force_torque/ForceTorque.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,14 @@ void ForceTorque::PostUpdate(const UpdateInfo &_info,
GZ_PROFILE("ForceTorque::PostUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


this->dataPtr->CreateSensors(_ecm);

Expand Down
14 changes: 8 additions & 6 deletions src/systems/imu/Imu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,14 @@ void Imu::PostUpdate(const UpdateInfo &_info,
GZ_PROFILE("Imu::PostUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


this->dataPtr->CreateSensors(_ecm);

Expand Down
14 changes: 8 additions & 6 deletions src/systems/joint_controller/JointController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,14 @@ void JointController::PreUpdate(const UpdateInfo &_info,
GZ_PROFILE("JointController::PreUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


// If the joints haven't been identified yet, look for them
if (this->dataPtr->jointEntities.empty())
Expand Down
14 changes: 8 additions & 6 deletions src/systems/joint_position_controller/JointPositionController.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,14 @@ void JointPositionController::PreUpdate(
}

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


// If the joints haven't been identified yet, look for them
if (this->dataPtr->jointEntities.empty())
Expand Down
14 changes: 8 additions & 6 deletions src/systems/lift_drag/LiftDrag.cc
Original file line number Diff line number Diff line change
Expand Up @@ -547,12 +547,14 @@ void LiftDrag::PreUpdate(const UpdateInfo &_info, EntityComponentManager &_ecm)
GZ_PROFILE("LiftDrag::PreUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


if (!this->dataPtr->initialized)
{
Expand Down
14 changes: 8 additions & 6 deletions src/systems/log/LogRecord.cc
Original file line number Diff line number Diff line change
Expand Up @@ -666,12 +666,14 @@ void LogRecord::PostUpdate(const UpdateInfo &_info,
return;

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


// Publish only once
if (!this->dataPtr->sdfPublished)
Expand Down
14 changes: 8 additions & 6 deletions src/systems/logical_camera/LogicalCamera.cc
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,14 @@ void LogicalCamera::PostUpdate(const UpdateInfo &_info,
GZ_PROFILE("LogicalCamera::PostUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


this->dataPtr->CreateSensors(_ecm);

Expand Down
14 changes: 8 additions & 6 deletions src/systems/magnetometer/Magnetometer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,12 +271,14 @@ void Magnetometer::PostUpdate(const UpdateInfo &_info,
GZ_PROFILE("Magnetometer::PostUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


this->dataPtr->CreateSensors(_ecm);

Expand Down
14 changes: 8 additions & 6 deletions src/systems/mecanum_drive/MecanumDrive.cc
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,14 @@ void MecanumDrive::PreUpdate(const gz::sim::UpdateInfo &_info,
GZ_PROFILE("MecanumDrive::PreUpdate");

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


// If the joints haven't been identified yet, look for them
static std::set<std::string> warnedModels;
Expand Down
14 changes: 8 additions & 6 deletions src/systems/multicopter_control/MulticopterVelocityControl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,14 @@ void MulticopterVelocityControl::PreUpdate(
}

// \TODO(anyone) Support rewind
if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration_cast<std::chrono::seconds>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}

if (_info.dt < std::chrono::steady_clock::duration::zero())
{
gzwarn << "Detected jump back in time ["
<< std::chrono::duration<double>(_info.dt).count()
<< "s]. System may not work properly." << std::endl;
}


// Nothing left to do if paused.
if (_info.paused)
Expand Down
Loading

0 comments on commit 3478183

Please sign in to comment.