19 #ifndef __UUV_GAZEBO_PLUGINS_CONVERSION_FUNCTION_HH__ 20 #define __UUV_GAZEBO_PLUGINS_CONVERSION_FUNCTION_HH__ 40 public:
virtual std::string
GetType() = 0;
43 public:
virtual bool GetParam(std::string _tag,
47 public:
virtual std::map<double, double>
GetTable()
48 {
return std::map<double, double>(); };
51 public:
virtual double convert(
double _cmd) = 0;
67 public:
bool RegisterCreator(
const std::string& _identifier,
74 private: std::map<std::string, ConversionFunctionCreator>
creators_;
78 #define REGISTER_CONVERSIONFUNCTION(type) \ 79 static const bool registeredWithFactory 82 #define REGISTER_CONVERSIONFUNCTION_CREATOR(type, creator) \ 83 const bool type::registeredWithFactory = \ 84 ConversionFunctionFactory::GetInstance().RegisterCreator( \ 85 type::IDENTIFIER, creator); 98 public:
virtual std::string
GetType() {
return IDENTIFIER; }
101 public:
virtual bool GetParam(std::string _tag,
double& _output);
104 public:
virtual double convert(
double _cmd);
127 public:
virtual std::string
GetType() {
return IDENTIFIER; }
130 public:
virtual bool GetParam(std::string _tag,
double& _output);
133 public:
virtual double convert(
double _cmd);
143 double _rotorConstantR,
144 double _deltaL,
double _deltaR);
166 public:
virtual std::string
GetType() {
return IDENTIFIER; }
169 public:
virtual bool GetParam(std::string _tag,
double& _output);
172 public:
virtual std::map<double, double>
GetTable();
175 public:
virtual double convert(
double _cmd);
185 const std::vector<double> &_output);
#define REGISTER_CONVERSIONFUNCTION(type)
Use the following macro within a ThrusterDynamics declaration:
std::map< double, double > lookupTable
Lookup table maps input values -> output values.
std::map< std::string, ConversionFunctionCreator > creators_
Map of each registered identifiers to its corresponding creator.
virtual double convert(double _cmd)=0
Convert thruster state (e.g. angular velocity) to thrust force.
ConversionFunction *(* ConversionFunctionCreator)(sdf::ElementPtr)
Function pointer to create a certain conversion function.
static const std::string IDENTIFIER
The unique identifier of this conversion function.
virtual ~ConversionFunction()
Destructor.
virtual bool GetParam(std::string _tag, double &_output)=0
Return paramater in vector form for the given tag.
virtual std::string GetType()
Return (derived) type of conversion function.
virtual std::map< double, double > GetTable()
Return input and output vectors of the lookup table.
Asymmetric conversion function with dead-zone nonlinearity. This corresponds to what is called Model ...
Factory singleton class that creates a ConversionFunction from sdf.
static const std::string IDENTIFIER
The unique identifier of this conversion function.
Abstact base class for a thruster conversion function.
ConversionFunction()
Protected constructor: Use the factory instead.
virtual std::string GetType()
Return (derived) type of conversion function.
The most basic conversion function: Thrust = const.*w*abs(w) This corresponds to what is attrributed ...
double deltaR
Dead-zone for omega > 0.
double rotorConstantR
Rotor constant for omega > 0.
virtual std::string GetType()=0
Return (derived) type of conversion function.
double rotorConstantL
Rotor constant for omega < 0.
ConversionFunctionFactory()
Constructor is private since this is a singleton.
virtual std::string GetType()
Return (derived) type of conversion function.
static const std::string IDENTIFIER
The unique identifier of this conversion function.
double deltaL
Dead-zone for omega < 0.
Conversion using linear interpolation between given data points.