BuoyancyPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GAZEBO_PLUGINS_BUOYANCYPLUGIN_HH_
19 #define GAZEBO_PLUGINS_BUOYANCYPLUGIN_HH_
20 
21 #include <map>
22 #include <ignition/math/Vector3.hh>
23 
24 #include "gazebo/common/Event.hh"
25 #include "gazebo/common/Plugin.hh"
26 #include "gazebo/physics/physics.hh"
27 
28 namespace gazebo
29 {
32  {
34  public: VolumeProperties() : volume(0) {}
35 
37  public: ignition::math::Vector3d cov;
38 
40  public: double volume;
41  };
42 
61  {
63  public: BuoyancyPlugin();
64 
67  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
68 
69  // Documentation inherited
70  public: virtual void Init();
71 
73  protected: virtual void OnUpdate();
74 
77 
80 
82  protected: sdf::ElementPtr sdf;
83 
86  protected: double fluidDensity;
87 
90  protected: std::map<int, VolumeProperties> volPropsMap;
91  };
92 }
93 
94 #endif
A plugin that simulates buoyancy of an object immersed in fluid.
Definition: BuoyancyPlugin.hh:60
sdf::ElementPtr sdf
Pointer to the plugin SDF.
Definition: BuoyancyPlugin.hh:82
double fluidDensity
The density of the fluid in which the object is submerged in kg/m^3.
Definition: BuoyancyPlugin.hh:86
VolumeProperties()
Default constructor.
Definition: BuoyancyPlugin.hh:34
ignition::math::Vector3d cov
Center of volume in the link frame.
Definition: BuoyancyPlugin.hh:37
double volume
Volume of this link.
Definition: BuoyancyPlugin.hh:40
A class for storing the volume properties of a link.
Definition: BuoyancyPlugin.hh:31
event::ConnectionPtr updateConnection
Connection to World Update events.
Definition: BuoyancyPlugin.hh:76
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
std::map< int, VolumeProperties > volPropsMap
Map of <link ID, point> pairs mapping link IDs to the CoV (center of volume) and volume of the link...
Definition: BuoyancyPlugin.hh:90
physics::ModelPtr model
Pointer to model containing the plugin.
Definition: BuoyancyPlugin.hh:79
A plugin with access to physics::Model.
Definition: Plugin.hh:260
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59