##

BuoyancyPlugin.hh
Go to the documentation of this file.
/*
* Copyright (C) 2015 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GAZEBO_PLUGINS_BUOYANCYPLUGIN_HH_
#define GAZEBO_PLUGINS_BUOYANCYPLUGIN_HH_
#include <map>
#include <ignition/math/Vector3.hh>
#include "gazebo/common/Event.hh"
#include "gazebo/common/Plugin.hh"
#include "gazebo/physics/physics.hh"
namespace gazebo
{
class VolumeProperties
{
public: VolumeProperties() : volume(0) {}
public: ignition::math::Vector3d cov;
public: double volume;
};
class GAZEBO_VISIBLE BuoyancyPlugin : public ModelPlugin
{
public: BuoyancyPlugin();
public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
// Documentation inherited
public: virtual void Init();
protected: virtual void OnUpdate();
protected: event::ConnectionPtr updateConnection;
protected: physics::ModelPtr model;
protected: sdf::ElementPtr sdf;
protected: double fluidDensity;
protected: std::map<int, VolumeProperties> volPropsMap;
};
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::VolumeProperties::VolumeProperties
VolumeProperties()
Default constructor.
Definition: BuoyancyPlugin.hh:34
gazebo::VolumeProperties
A class for storing the volume properties of a link.
Definition: BuoyancyPlugin.hh:31
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
gazebo::VolumeProperties::cov
ignition::math::Vector3d cov
Center of volume in the link frame.
Definition: BuoyancyPlugin.hh:37
gazebo::VolumeProperties::volume
double volume
Volume of this link.
Definition: BuoyancyPlugin.hh:40
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::msgs::Init
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
gazebo::BuoyancyPlugin::volPropsMap
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
gazebo::BuoyancyPlugin::updateConnection
event::ConnectionPtr updateConnection
Connection to World Update events.
Definition: BuoyancyPlugin.hh:76
gazebo::BuoyancyPlugin::fluidDensity
double fluidDensity
The density of the fluid in which the object is submerged in kg/m^3.
Definition: BuoyancyPlugin.hh:86
gazebo::BuoyancyPlugin::sdf
sdf::ElementPtr sdf
Pointer to the plugin SDF.
Definition: BuoyancyPlugin.hh:82
gazebo::BuoyancyPlugin
A plugin that simulates buoyancy of an object immersed in fluid.
Definition: BuoyancyPlugin.hh:60
gazebo::BuoyancyPlugin::model
physics::ModelPtr model
Pointer to model containing the plugin.
Definition: BuoyancyPlugin.hh:79
Event.hh
gazebo::ModelPlugin
A plugin with access to physics::Model.
Definition: Plugin.hh:303
Plugin.hh
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59