UmbilicalModel.hh
Go to the documentation of this file.
1 // Copyright (c) 2016 The UUV Simulator Authors.
2 // All rights reserved.
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 
18 
19 #ifndef __UUV_GAZEBO_PLUGINS_UMBILICAL_MODEL_HH__
20 #define __UUV_GAZEBO_PLUGINS_UMBILICAL_MODEL_HH__
21 
22 #include <string>
23 #include <map>
24 #include <gazebo/gazebo.hh>
25 #include <gazebo/common/UpdateInfo.hh>
26 #include <gazebo/physics/Link.hh>
27 #include <gazebo/physics/Model.hh>
28 #include <sdf/sdf.hh>
29 
30 namespace gazebo
31 {
33 {
35  protected: UmbilicalModel() {}
36 
38  public: virtual ~UmbilicalModel() {}
39 
41  public: virtual void Init();
42 
44  public: virtual void OnUpdate(const common::UpdateInfo &_info,
45  const ignition::math::Vector3d& _flow) = 0;
46 
48  protected: physics::ModelPtr model;
49 
51  protected: physics::LinkPtr connector;
52 };
53 
55 typedef UmbilicalModel* (*UmbilicalModelCreator)(sdf::ElementPtr,
56  physics::ModelPtr);
57 
60 {
62  public: UmbilicalModel* CreateUmbilicalModel(sdf::ElementPtr _sdf,
63  physics::ModelPtr _model);
64 
66  public: static UmbilicalModelFactory& GetInstance();
67 
69  public: bool RegisterCreator(const std::string& _identifier,
70  UmbilicalModelCreator _creator);
71 
73  private: UmbilicalModelFactory() {}
74 
76  private: std::map<std::string, UmbilicalModelCreator> creators_;
77 };
78 
80 #define REGISTER_UMBILICALMODEL(type) \
81  static const bool registeredWithFactory
82 
84 #define REGISTER_UMBILICALMODEL_CREATOR(type, creator) \
85  const bool type::registeredWithFactory = \
86  UmbilicalModelFactory::GetInstance().RegisterCreator( \
87  type::IDENTIFIER, creator);
88 
90 {
92  protected: UmbilicalModelBerg(sdf::ElementPtr _sdf,
93  physics::ModelPtr _model);
94 
96  public: static UmbilicalModel* create(sdf::ElementPtr _sdf,
97  physics::ModelPtr _model);
98 
100  public: virtual void OnUpdate(const common::UpdateInfo &_info,
101  const ignition::math::Vector3d& _flow);
102 
105 
107  private: static const std::string IDENTIFIER;
108 
110  private: double diameter;
111 
113  private: double rho;
114 };
115 }
116 
117 #endif // __UUV_GAZEBO_PLUGINS_UMBILICAL_MODEL_HH__
Factory singleton class that creates an UmbilicalModel from sdf.
std::map< std::string, UmbilicalModelCreator > creators_
Map of each registered identifiers to its corresponding creator.
static const std::string IDENTIFIER
The unique identifier of this UmbilicalModel.
double diameter
Umbilical diameter.
UmbilicalModelFactory()
Constructor is private since this is a singleton.
physics::LinkPtr connector
Moving connector link of this umbilical.
physics::ModelPtr model
Gazebo model to which this umbilical belongs.
virtual ~UmbilicalModel()
Destructor.
double rho
Water density.
virtual void OnUpdate(const common::UpdateInfo &_info, const ignition::math::Vector3d &_flow)=0
Update Umbilical (and apply forces)
virtual void Init()
Initialize model.
#define REGISTER_UMBILICALMODEL(type)
Use the following macro within a ThrusterDynamics declaration:
UmbilicalModel()
Protected constructor: Use the factory instead.
UmbilicalModel *(* UmbilicalModelCreator)(sdf::ElementPtr, physics::ModelPtr)
Function pointer to create a certain conversion function.


uuv_gazebo_plugins
Author(s): Musa Morena Marcusso Manhaes , Sebastian Scherer , Luiz Ricardo Douat
autogenerated on Mon Jul 1 2019 19:39:12