##

WindPlugin.hh
Go to the documentation of this file.
/*
* Copyright (C) 2016 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_WINDPLUGIN_HH_
#define GAZEBO_PLUGINS_WINDPLUGIN_HH_
#include <ignition/math/Vector3.hh>
#include "gazebo/common/Event.hh"
#include "gazebo/common/Plugin.hh"
#include "gazebo/physics/physics.hh"
#include "gazebo/sensors/Noise.hh"
namespace gazebo
{
// The wind is described as a uniform worldwide model. So it is independant
// from model position for simple computations. Its components are computed
// separately:
// - Horizontal amplitude:
// Low pass filtering on user input (complementary gain)
// + small local fluctuations
// + noise on value (noise amplitude is a factor of wind magnitude)
//
// - Horizontal direction:
// Low pass filtering on user input (complementary gain)
// + small local fluctuations
// + noise on value
//
// - Vertical amplitude:
// Noise proportionnal to wind magnitude.
class GAZEBO_VISIBLE WindPlugin : public WorldPlugin
{
public: WindPlugin();
// Documentation inherited
public: virtual void Load(physics::WorldPtr _world, sdf::ElementPtr _sdf);
public: ignition::math::Vector3d LinearVel(
const physics::Wind *_wind,
const physics::Entity *_entity);
private: void OnUpdate();
private: physics::WorldPtr world;
private: event::ConnectionPtr updateConnection;
private: double characteristicTimeForWindRise = 1;
private: double magnitudeSinAmplitudePercent = 0;
private: double magnitudeSinPeriod = 1;
private: double characteristicTimeForWindOrientationChange = 1;
private: double orientationSinAmplitude = 0;
private: double orientationSinPeriod = 1;
private: double kMag = 0;
private: double kDir = 0;
private: double magnitudeMean = 0;
private: double directionMean = 0;
private: sensors::NoisePtr noiseMagnitude;
private: sensors::NoisePtr noiseDirection;
private: sensors::NoisePtr noiseVertical;
};
}
#endif
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
Noise.hh
gazebo::WorldPlugin
A plugin with access to physics::World. See reference.
Definition: Plugin.hh:278
gazebo::WindPlugin
A plugin that simulates a simple wind model.
Definition: WindPlugin.hh:45
gazebo::physics::Wind
Base class for wind.
Definition: Wind.hh:41
gazebo::event::ConnectionPtr
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
gazebo::physics::Entity
Base class for all physics objects in Gazebo.
Definition: Entity.hh:52
Event.hh
gazebo::physics::WorldPtr
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
Plugin.hh
gazebo::sensors::NoisePtr
std::shared_ptr< Noise > NoisePtr
Definition: SensorTypes.hh:124
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59