LinearBatteryPlugin.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 #ifndef GAZEBO_PLUGINS_LINEARBATTERYPLUGIN_HH_
18 #define GAZEBO_PLUGINS_LINEARBATTERYPLUGIN_HH_
19 
20 #include <string>
21 #include <map>
22 
23 #include "gazebo/common/Plugin.hh"
25 #include "gazebo/physics/physics.hh"
26 
27 namespace gazebo
28 {
30  class GZ_PLUGIN_VISIBLE LinearBatteryPlugin : public ModelPlugin
31  {
33  public: LinearBatteryPlugin();
34 
35  // Documentation Inherited.
36  public: virtual void Load(physics::ModelPtr _model, sdf::ElementPtr _sdf);
37 
38  // Documentation Inherited.
39  public: virtual void Init();
40 
41  // Documentation Inherited.
42  public: virtual void Reset();
43 
47  private: double OnUpdateVoltage(const common::BatteryPtr &_battery);
48 
51 
54 
57 
60 
62  protected: physics::LinkPtr link;
63 
66 
68  protected: sdf::ElementPtr sdf;
69 
72  protected: double e0;
73  protected: double e1;
74 
76  protected: double q0;
77 
79  protected: double c;
80 
82  protected: double r;
83 
85  protected: double tau;
86 
88  protected: double iraw;
89 
91  protected: double ismooth;
92 
94  protected: double q;
95  };
96 }
97 #endif
boost::shared_ptr< Link > LinkPtr
Definition: PhysicsTypes.hh:110
boost::shared_ptr< World > WorldPtr
Definition: PhysicsTypes.hh:90
double ismooth
Smoothed battery current in A.
Definition: LinearBatteryPlugin.hh:91
Forward declarations for the common classes.
Definition: Animation.hh:26
double e0
Open-circuit voltage.
Definition: LinearBatteryPlugin.hh:72
physics::ModelPtr model
Pointer to model containing plugin.
Definition: LinearBatteryPlugin.hh:59
double q
Instantaneous battery charge in Ah.
Definition: LinearBatteryPlugin.hh:94
double iraw
Raw battery current in A.
Definition: LinearBatteryPlugin.hh:88
sdf::ElementPtr sdf
SDF for this plugin;.
Definition: LinearBatteryPlugin.hh:68
double c
Battery capacity in Ah.
Definition: LinearBatteryPlugin.hh:79
double r
Battery inner resistance in Ohm.
Definition: LinearBatteryPlugin.hh:82
boost::shared_ptr< PhysicsEngine > PhysicsEnginePtr
Definition: PhysicsTypes.hh:126
common::BatteryPtr battery
Pointer to battery contained in link.
Definition: LinearBatteryPlugin.hh:65
double q0
Initial battery charge in Ah.
Definition: LinearBatteryPlugin.hh:76
physics::WorldPtr world
Pointer to world.
Definition: LinearBatteryPlugin.hh:53
std::shared_ptr< Battery > BatteryPtr
Definition: CommonTypes.hh:125
boost::shared_ptr< Connection > ConnectionPtr
Definition: CommonTypes.hh:134
event::ConnectionPtr updateConnection
Connection to World Update events.
Definition: LinearBatteryPlugin.hh:50
boost::shared_ptr< Model > ModelPtr
Definition: PhysicsTypes.hh:94
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
double tau
Current low-pass filter characteristic time in seconds.
Definition: LinearBatteryPlugin.hh:85
double e1
Definition: LinearBatteryPlugin.hh:73
physics::LinkPtr link
Pointer to link containing battery link.
Definition: LinearBatteryPlugin.hh:62
A plugin with access to physics::Model.
Definition: Plugin.hh:303
physics::PhysicsEnginePtr physics
Pointer to physics engine.
Definition: LinearBatteryPlugin.hh:56
A plugin that simulates a linear battery.
Definition: LinearBatteryPlugin.hh:30