20 #include <gazebo/common/Assert.hh>    21 #include <gazebo/common/Events.hh>    22 #include <ignition/math/Pose3.hh>    33 WaveguagePlugin::WaveguagePlugin()
    41   GZ_ASSERT(_model != NULL, 
"Received NULL model pointer");
    42   GZ_ASSERT(_sdf != NULL, 
"Received NULL SDF pointer");
    47   if (_sdf->HasElement(
"wave_model"))
    51   if (_sdf->HasElement(
"fluid_level"))
    53     this->
fluidLevel = _sdf->Get<
double>(
"fluid_level");
    69   std::shared_ptr<const WaveParameters> waveParams \
    70     = WavefieldModelPlugin::GetWaveParams(
    74   if (waveParams == 
nullptr)
    78   #if GAZEBO_MAJOR_VERSION >= 8    79     ignition::math::Pose3d modelPose = this->
model->WorldPose();
    81     ignition::math::Pose3d modelPose = this->
model->GetWorldPose().Ign();
    85   #if GAZEBO_MAJOR_VERSION >= 8    86     double waveHeightS = WavefieldSampler::ComputeDepthSimply(
    87       *waveParams, modelPose.Pos(),
    88       this->
model->GetWorld()->SimTime().Double());
    90     double waveHeightS = WavefieldSampler::ComputeDepthSimply(
    91       *waveParams, modelPose.Pos(),
    92       this->
model->GetWorld()->GetSimTime().Double());
    99   modelPose.Pos().Z(waveHeightS);
   100   this->
model->SetWorldPose(modelPose);
 
A plugin that sets the model height (z) to be the same as the wave height calculated for the physics...
virtual void OnUpdate()
Callback for World Update events. 
physics::ModelPtr model
Pointer to the model. 
virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf)
event::ConnectionPtr updateConnection
Connection to World Update events. 
double fluidLevel
The height of the fluid/air interface [m]. Defaults to 0. 
This file defines a Gazebo ModelPlugin used to manage a wave field. 
std::string waveModelName
The name of the wave model. 
This file contains definitions for classes used to manage a wave field. This includes wave parameters...
This file contains the definition for a Gazebo physics object that allows a wave field to be added in...