DUNE: Uniform Navigational Environment  2016.05.0
DUNE::Plans::SpeedModel Class Reference

Detailed Description

Utility class to compute offline speed conversions.

Consider ONLY positive speed. Negative values means failure to convert

Public Member Functions

 SpeedModel (Parsers::Config *config)
 
 SpeedModel (const std::vector< float > &act, const std::vector< float > &rpm, const std::vector< float > &mps, float time_factor=5.0, float max_speed=2.0)
 
float toMPS (float value, uint8_t units) const
 
float toRPM (float value, uint8_t units) const
 
float toAct (float value, uint8_t units) const
 
void validate (void) const
 
float getTimeFactor (void) const
 

Constructor & Destructor Documentation

DUNE::Plans::SpeedModel::SpeedModel ( Parsers::Config config)

Constructor.

Parameters
[in]configpointer to config parser

References DUNE::Parsers::Config::get(), DUNE::IMC::SUNITS_METERS_PS, DUNE::IMC::SUNITS_PERCENTAGE, and DUNE::IMC::SUNITS_RPM.

DUNE::Plans::SpeedModel::SpeedModel ( const std::vector< float > &  act,
const std::vector< float > &  rpm,
const std::vector< float > &  mps,
float  time_factor = 5.0,
float  max_speed = 2.0 
)

Constructor.

Parameters
[in]actvalues for the actuation
[in]rpmvalues for the rpms
[in]mpsvalues for the meters per second
[in]time_factortime of arrival factor

References DUNE::IMC::SUNITS_METERS_PS, DUNE::IMC::SUNITS_PERCENTAGE, and DUNE::IMC::SUNITS_RPM.

Member Function Documentation

float DUNE::Plans::SpeedModel::getTimeFactor ( void  ) const
inline

Get time of arrival factor.

Returns
time of arrival in seconds
float DUNE::Plans::SpeedModel::toAct ( float  value,
uint8_t  units 
) const

Convert to Actuation.

Parameters
[in]valuespeed value from which to convert
[in]unitsspeed units of the given value
Returns
converted value to actuation, negative if failed

References DUNE::IMC::SUNITS_PERCENTAGE.

float DUNE::Plans::SpeedModel::toMPS ( float  value,
uint8_t  units 
) const

Convert to meters per second.

Parameters
[in]valuespeed value from which to convert
[in]unitsspeed units of the given value
Returns
converted value to meters per second, negative if failed

References DUNE::IMC::SUNITS_METERS_PS.

float DUNE::Plans::SpeedModel::toRPM ( float  value,
uint8_t  units 
) const

Convert to RPMs.

Parameters
[in]valuespeed value from which to convert
[in]unitsspeed units of the given value
Returns
converted value to RPMs, negative if failed

References DUNE::IMC::SUNITS_RPM.

void DUNE::Plans::SpeedModel::validate ( void  ) const
Collaboration diagram for DUNE::Plans::SpeedModel:
Collaboration graph