Skip to content

Commit

Permalink
Updated wave_body_intereaction tests to use mbari_snl wamit files.
Browse files Browse the repository at this point in the history
  • Loading branch information
hamilton8415 committed Dec 5, 2023
1 parent b1f9996 commit 0b65b6c
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
28 changes: 14 additions & 14 deletions buoy_tests/tests/wave_body_interactions_heaveonly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,37 +184,37 @@ TEST(WaveBodyInteractionTests, HeaveMotions)
std::shared_ptr<LinearIncidentWave> Inc = std::make_shared<LinearIncidentWave>();

double buoy_mass = 1400.0; // kg
FS_HydroDynamics BuoyA5;
BuoyA5.SetGravity(gravity); // Use gravity that matches what was used by gz-sim
FS_HydroDynamics Buoy;
Buoy.SetGravity(gravity); // Use gravity that matches what was used by gz-sim

// Set area and 2nd moments of area for waterplane
BuoyA5.SetWaterplane(5.47, 1.37, 1.37);
Buoy.SetWaterplane(5.47, 1.37, 1.37);
// Set COB relative to waterplane coordinate system.
BuoyA5.SetCOB(0, 0, -.18);
Buoy.SetCOB(0, 0, -.18);
// Set COG relative to waterplane coordinate system.
BuoyA5.SetCOG(0, 0, 2.03);
BuoyA5.SetVolume(1.3658536);
BuoyA5.SetMass(buoy_mass);
Buoy.SetCOG(0, 0, 2.03);
Buoy.SetVolume(1.3658536);
Buoy.SetMass(buoy_mass);

std::string HydrodynamicsBaseFilename =
ament_index_cpp::get_package_share_directory("buoy_description") +
std::string("/models/mbari_wec_base/hydrodynamic_coeffs/BuoyA5");
std::string("/models/mbari_wec_base/hydrodynamic_coeffs/mbari_snl");

BuoyA5.ReadWAMITData_FD(HydrodynamicsBaseFilename);
BuoyA5.ReadWAMITData_TD(HydrodynamicsBaseFilename);
BuoyA5.SetTimestepSize(dt);
Buoy.ReadWAMITData_FD(HydrodynamicsBaseFilename);
Buoy.ReadWAMITData_TD(HydrodynamicsBaseFilename);
Buoy.SetTimestepSize(dt);

Eigen::Matrix<double, 3, 3> I;
I << 7000.0, 0, 0, 0, 7040.0, 0, 0, 0, 670.0;
BuoyA5.SetI(I);
Buoy.SetI(I);
Eigen::VectorXd b(6);
b(0) = 300.0;
b(1) = 300.0;
b(2) = 900.0;
b(3) = 400.0;
b(4) = 400.0;
b(5) = 100.0;
BuoyA5.SetDampingCoeffs(b);
Buoy.SetDampingCoeffs(b);

std::vector<double> x(2);
x[0] = -2.0 + 2.4; // initial position
Expand All @@ -224,7 +224,7 @@ TEST(WaveBodyInteractionTests, HeaveMotions)
std::vector<std::vector<double>> x_vec;
std::vector<double> times;
boost::numeric::odeint::euler<std::vector<double>> stepper;
SingleModeMotionRHS RHS(&BuoyA5);
SingleModeMotionRHS RHS(&Buoy);
RHS.mode = 2;
RHS.inf_freq_added_mass = 3080;

Expand Down
28 changes: 14 additions & 14 deletions buoy_tests/tests/wave_body_interactions_pitchonly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,41 +180,41 @@ TEST(WaveBodyInteractionTests, PitchMotions)
std::shared_ptr<LinearIncidentWave> Inc = std::make_shared<LinearIncidentWave>();

double buoy_mass = 2449.75; // kg
FS_HydroDynamics BuoyA5;
BuoyA5.SetGravity(gravity); // Use gravity that matches what was used by gz-sim
FS_HydroDynamics Buoy;
Buoy.SetGravity(gravity); // Use gravity that matches what was used by gz-sim

BuoyA5.SetWaterplane(
Buoy.SetWaterplane(
5.47, 1.37,
1.37); // Set area and 2nd moments of area for waterplane
BuoyA5.SetCOB(
Buoy.SetCOB(
0, 0,
-.22); // Set COB relative to waterplane coordinate system.
BuoyA5.SetCOG(
Buoy.SetCOG(
0, 0,
0.0); // Set COG at waterplane for this test.
BuoyA5.SetVolume(2.39);
BuoyA5.SetMass(buoy_mass);
Buoy.SetVolume(2.39);
Buoy.SetMass(buoy_mass);

std::string HydrodynamicsBaseFilename =
ament_index_cpp::get_package_share_directory("buoy_description") +
std::string("/models/mbari_wec_base/hydrodynamic_coeffs/BuoyA5");
std::string("/models/mbari_wec_base/hydrodynamic_coeffs/mbari_snl");


BuoyA5.ReadWAMITData_FD(HydrodynamicsBaseFilename);
BuoyA5.ReadWAMITData_TD(HydrodynamicsBaseFilename);
BuoyA5.SetTimestepSize(dt);
Buoy.ReadWAMITData_FD(HydrodynamicsBaseFilename);
Buoy.ReadWAMITData_TD(HydrodynamicsBaseFilename);
Buoy.SetTimestepSize(dt);

Eigen::Matrix<double, 3, 3> I;
I << 1430.0, 0, 0, 0, 1430.0, 0, 0, 0, 670.0;
BuoyA5.SetI(I);
Buoy.SetI(I);
Eigen::VectorXd b(6);
b(0) = 300.0;
b(1) = 300.0;
b(2) = 900.0;
b(3) = 400.0;
b(4) = 400.0;
b(5) = 100.0;
BuoyA5.SetDampingCoeffs(b);
Buoy.SetDampingCoeffs(b);

std::vector<double> x(2);
x[0] = initial_position; // initial position
Expand All @@ -224,7 +224,7 @@ TEST(WaveBodyInteractionTests, PitchMotions)
std::vector<std::vector<double>> x_vec;
std::vector<double> times;
boost::numeric::odeint::euler<std::vector<double>> stepper;
SingleModeMotionRHS RHS(&BuoyA5);
SingleModeMotionRHS RHS(&Buoy);
RHS.mode = 4;
RHS.inf_freq_added_mass = 367.85;

Expand Down
2 changes: 1 addition & 1 deletion buoy_tests/worlds/singlefloatingbody_heave.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
<S>5.47</S>
<S11>1.37</S11>
<S22>1.37</S22>
<hydro_coeffs_uri>package://buoy_description/models/mbari_wec_base/hydrodynamic_coeffs/BuoyA5</hydro_coeffs_uri>
<hydro_coeffs_uri>package://buoy_description/models/mbari_wec_base/hydrodynamic_coeffs/mbari_snl</hydro_coeffs_uri>

</plugin>

Expand Down
2 changes: 1 addition & 1 deletion buoy_tests/worlds/singlefloatingbody_pitch.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
<S>5.47</S>
<S11>1.37</S11>
<S22>1.37</S22>
<hydro_coeffs_uri>package://buoy_description/models/mbari_wec_base/hydrodynamic_coeffs/BuoyA5</hydro_coeffs_uri>
<hydro_coeffs_uri>package://buoy_description/models/mbari_wec_base/hydrodynamic_coeffs/mbari_snl</hydro_coeffs_uri>

</plugin>

Expand Down

0 comments on commit 0b65b6c

Please sign in to comment.