##

LinearBatteryPlugin.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_LINEARBATTERYPLUGIN_HH_
#define GAZEBO_PLUGINS_LINEARBATTERYPLUGIN_HH_
#include <string>
#include <map>
#include "gazebo/common/Plugin.hh"
#include "gazebo/common/CommonTypes.hh"
#include "gazebo/physics/physics.hh"
namespace gazebo
{
class GAZEBO_VISIBLE LinearBatteryPlugin : public ModelPlugin
{
public: LinearBatteryPlugin();
// Documentation Inherited.
public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
// Documentation Inherited.
public: virtual void Init();
// Documentation Inherited.
public: virtual void Reset();
private: double OnUpdateVoltage(const common::BatteryPtr &_battery);
protected: event::ConnectionPtr updateConnection;
protected: physics::WorldPtr world;
protected: physics::PhysicsEnginePtr physics;
protected: physics::ModelPtr model;
protected: physics::LinkPtr link;
protected: common::BatteryPtr battery;
protected: sdf::ElementPtr sdf;
protected: double e0;
protected: double e1;
protected: double q0;
protected: double c;
protected: double r;
protected: double tau;
protected: double iraw;
protected: double ismooth;
protected: double q;
};
}
#endif
gazebo::LinearBatteryPlugin::e0
double e0
Open-circuit voltage.
Definition: LinearBatteryPlugin.hh:72
gazebo::LinearBatteryPlugin::ismooth
double ismooth
Smoothed battery current in A.
Definition: LinearBatteryPlugin.hh:91
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::LinearBatteryPlugin::sdf
sdf::ElementPtr sdf
SDF for this plugin;.
Definition: LinearBatteryPlugin.hh:68
gazebo::physics::ModelPtr
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:93
gazebo::LinearBatteryPlugin::iraw
double iraw
Raw battery current in A.
Definition: LinearBatteryPlugin.hh:88
gazebo::LinearBatteryPlugin::q
double q
Instantaneous battery charge in Ah.
Definition: LinearBatteryPlugin.hh:94
CommonTypes.hh
gazebo::LinearBatteryPlugin::model
physics::ModelPtr model
Pointer to model containing plugin.
Definition: LinearBatteryPlugin.hh:59
gazebo::LinearBatteryPlugin::c
double c
Battery capacity in Ah.
Definition: LinearBatteryPlugin.hh:79
gazebo::LinearBatteryPlugin::battery
common::BatteryPtr battery
Pointer to battery contained in link.
Definition: LinearBatteryPlugin.hh:65
gazebo::LinearBatteryPlugin::updateConnection
event::ConnectionPtr updateConnection
Connection to World Update events.
Definition: LinearBatteryPlugin.hh:50
gazebo::LinearBatteryPlugin::r
double r
Battery inner resistance in Ohm.
Definition: LinearBatteryPlugin.hh:82
gazebo::LinearBatteryPlugin::q0
double q0
Initial battery charge in Ah.
Definition: LinearBatteryPlugin.hh:76
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::physics::LinkPtr
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:109
gazebo::LinearBatteryPlugin
A plugin that simulates a linear battery.
Definition: LinearBatteryPlugin.hh:30
gazebo::LinearBatteryPlugin::world
physics::WorldPtr world
Pointer to world.
Definition: LinearBatteryPlugin.hh:53
gazebo::LinearBatteryPlugin::link
physics::LinkPtr link
Pointer to link containing battery link.
Definition: LinearBatteryPlugin.hh:62
gazebo::physics::PhysicsEnginePtr
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:125
gazebo::common::BatteryPtr
std::shared_ptr< Battery > BatteryPtr
Definition: CommonTypes.hh:125
gazebo::LinearBatteryPlugin::physics
physics::PhysicsEnginePtr physics
Pointer to physics engine.
Definition: LinearBatteryPlugin.hh:56
gazebo::LinearBatteryPlugin::tau
double tau
Current low-pass filter characteristic time in seconds.
Definition: LinearBatteryPlugin.hh:85
gazebo::physics::WorldPtr
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:89
gazebo::ModelPlugin
A plugin with access to physics::Model.
Definition: Plugin.hh:303
Plugin.hh
GAZEBO_VISIBLE
#define GAZEBO_VISIBLE
Definition: system.hh:59
gazebo::LinearBatteryPlugin::e1
double e1
Definition: LinearBatteryPlugin.hh:73