Skip to content

Commit

Permalink
remove addition of zero Z valued grid point
Browse files Browse the repository at this point in the history
X.Z() never gets populated with a nonzero value besides it's initial construction value of 0.
Thus this addition is extraneous.
With the removal of this addition, dz is the same as depth and the dz variable is also eliminated.
An older comment is moved closer to where it should be based on the
newer code code after the waveParams null check.

Co-authored-by: Jonathan <[email protected]>
  • Loading branch information
acxz and jeastnswc committed Aug 3, 2022
1 parent 5592bcb commit a9a8e06
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions usv_gazebo_plugins/src/usv_gazebo_dynamics_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,16 @@ void UsvDynamicsPlugin::Update()

// Compute the depth at the grid point.
double simTime = kTimeNow.Double();
// double depth = WavefieldSampler::ComputeDepthDirectly(
// *waveParams, X, simTime);
double depth = 0.0;
if (waveParams)
{
// depth = WavefieldSampler::ComputeDepthDirectly(
// *waveParams, X, simTime);
depth = WavefieldSampler::ComputeDepthSimply(*waveParams, X, simTime);
}

// Vertical wave displacement.
double dz = depth + X.Z();

// Total z location of boat grid point relative to water surface
double deltaZ = (this->waterLevel + dz) - kDdz;
double deltaZ = (this->waterLevel + depth) - kDdz;
deltaZ = std::max(deltaZ, 0.0); // enforce only upward buoy force
deltaZ = std::min(deltaZ, this->paramHullRadius);
// Buoyancy force at grid point
Expand Down

0 comments on commit a9a8e06

Please sign in to comment.