BuoyancyPlugin.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015-2016 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_BUOYANCY_PLUGIN_HH_
19 #define _GAZEBO_BUOYANCY_PLUGIN_HH_
20 
21 #include <map>
22 #include "gazebo/common/Event.hh"
23 #include "gazebo/common/Plugin.hh"
24 #include "gazebo/math/Vector3.hh"
25 #include "gazebo/physics/physics.hh"
26 
27 namespace gazebo
28 {
31  {
33  public: VolumeProperties() : volume(0) {}
34 
36  public: math::Vector3 cov;
37 
39  public: double volume;
40  };
41 
60  {
62  public: BuoyancyPlugin();
63 
66  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
67 
68  // Documentation inherited
69  public: virtual void Init();
70 
72  protected: virtual void OnUpdate();
73 
76 
79 
82 
84  protected: sdf::ElementPtr sdf;
85 
88  protected: double fluidDensity;
89 
92  protected: std::map<int, VolumeProperties> volPropsMap;
93  };
94 }
95 
96 #endif
A plugin that simulates buoyancy of an object immersed in fluid.
Definition: BuoyancyPlugin.hh:59
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:39
sdf::ElementPtr sdf
Pointer to the plugin SDF.
Definition: BuoyancyPlugin.hh:84
double fluidDensity
The density of the fluid in which the object is submerged in kg/m^3.
Definition: BuoyancyPlugin.hh:88
VolumeProperties()
Default constructor.
Definition: BuoyancyPlugin.hh:33
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
double volume
Volume of this link.
Definition: BuoyancyPlugin.hh:39
A class for storing the volume properties of a link.
Definition: BuoyancyPlugin.hh:30
event::ConnectionPtr updateConnection
Connection to World Update events.
Definition: BuoyancyPlugin.hh:75
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:153
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
math::Vector3 cov
Center of volume in the link frame.
Definition: BuoyancyPlugin.hh:36
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:92
physics::ModelPtr model
Pointer to model containing the plugin.
Definition: BuoyancyPlugin.hh:78
A plugin with access to physics::Model.
Definition: Plugin.hh:245
physics::PhysicsEnginePtr physicsEngine
Pointer to the physics engine (for accessing gravity).
Definition: BuoyancyPlugin.hh:81
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59