LocalGuidance
A library that generates velocity references to follow a path.
local_guidance_control_interface::LocalGuidanceControlInterface Class Referenceabstract

#include <LocalGuidanceControlInterface.hpp>

Inheritance diagram for local_guidance_control_interface::LocalGuidanceControlInterface:
Inheritance graph

Public Member Functions

 LocalGuidanceControlInterface ()=delete
 
 LocalGuidanceControlInterface (const std::string &localGuidanceControllerName)
 
virtual ~LocalGuidanceControlInterface ()=default
 
std::string getLocalGuidanceControllerName () const
 
virtual bool loadParametersFromFile (const std::string &pathYamlFileDefaultParams, const std::string &pathYamlFileOverlyingParams)=0
 
virtual bool setDesiredPath (const PathConstPtr &pDesiredPath)=0
 
virtual bool updateCurrentPath (const PathConstPtr &pDesiredPath)=0
 
virtual bool setRobotPose (const PoseStampedConstPtr &pRobotPose)=0
 
virtual void computeControlAction (Twist *pTwist)=0
 
virtual void reset ()=0
 
virtual bool getControllerReference (PoseStamped *pCurrentReference) const
 
virtual void getFollowingFeedback (uint16_t *remainingNumberOfSegments, uint16_t *initialNumberOfSegments, double *remainingDistance, double *initialDistance) const =0
 

Protected Member Functions

bool loadParametersSectionFromFile (const std::string &pathYamlFileDefaultParams="", const std::string &pathYamlFileOverlyingParams="", const std::string &sectionName="")
 
virtual void printLoadedParameters () const
 
template<typename T >
bool getParameter (const std::string &key, T *pParameter, bool verbose=true) const
 
template<typename T >
parameter (const std::string &key) const
 

Private Member Functions

template<typename T >
bool getParameter (const std::string &key, const yaml_tools::YamlNode &yamlNodeDefaultParams, const yaml_tools::YamlNode &yamlNodeOverlyingParams, T *pParameter, bool verbose=true) const
 
bool keyHasSlashSeparator (const std::string &key, std::string *section, std::string *remainingKey) const
 
bool getYamlNodeFromFile (const std::string &pathYamlFile, const std::string &section, yaml_tools::YamlNode *yamlNode) const
 

Private Attributes

yaml_tools::YamlNode yamlNodeDefaultParams_
 YAML node containing default parameters. More...
 
bool loadedYamlDefaultParams_ {false}
 
yaml_tools::YamlNode yamlNodeOverlyingParams_
 YAML node containing overlying parameters. More...
 
bool loadedYamlOverlyingParams_ {false}
 
const std::string localGuidanceControllerName_
 Holds the name of the local guidance controller. More...
 

Constructor & Destructor Documentation

local_guidance_control_interface::LocalGuidanceControlInterface::LocalGuidanceControlInterface ( )
delete
local_guidance_control_interface::LocalGuidanceControlInterface::LocalGuidanceControlInterface ( const std::string &  localGuidanceControllerName)
explicit

Constructor.

Parameters
[in]localGuidanceControllerNamename of the local guidance controller.
virtual local_guidance_control_interface::LocalGuidanceControlInterface::~LocalGuidanceControlInterface ( )
virtualdefault

Destructor.

Member Function Documentation

virtual void local_guidance_control_interface::LocalGuidanceControlInterface::computeControlAction ( Twist pTwist)
pure virtual

Computes control action.

Parameters
[out]pTwistpointers to resulting control action (expressed as a twist).

Implemented in local_guidance_pure_pursuit::LocalGuidancePurePursuit, and local_guidance_nop::LocalGuidanceNop.

virtual bool local_guidance_control_interface::LocalGuidanceControlInterface::getControllerReference ( PoseStamped pCurrentReference) const
virtual

Gets the current 3D reference used by the controller, useful for visualization purposes.

Parameters
[out]pCurrentReference.
Returns
true if p_current_reference can be used.

Reimplemented in local_guidance_pure_pursuit::LocalGuidancePurePursuit, and local_guidance_nop::LocalGuidanceNop.

virtual void local_guidance_control_interface::LocalGuidanceControlInterface::getFollowingFeedback ( uint16_t *  remainingNumberOfSegments,
uint16_t *  initialNumberOfSegments,
double *  remainingDistance,
double *  initialDistance 
) const
pure virtual

Returns a feedback about the status of the following action.

Parameters
[out]remainingNumberOfSegments

Implemented in local_guidance_pure_pursuit::LocalGuidancePurePursuit, and local_guidance_nop::LocalGuidanceNop.

std::string local_guidance_control_interface::LocalGuidanceControlInterface::getLocalGuidanceControllerName ( ) const

Returns local name of local guidance controller name.

Returns
name of local guidance controller.
template<typename T >
bool local_guidance_control_interface::LocalGuidanceControlInterface::getParameter ( const std::string &  key,
T *  pParameter,
bool  verbose = true 
) const
inlineprotected

Gets a parameter from file. First checks in 'overlying' set and if not found looks for it in 'default' params set.

Template Parameters
template<typename T >
bool local_guidance_control_interface::LocalGuidanceControlInterface::getParameter ( const std::string &  key,
const yaml_tools::YamlNode yamlNodeDefaultParams,
const yaml_tools::YamlNode yamlNodeOverlyingParams,
T *  pParameter,
bool  verbose = true 
) const
inlineprivate

Gets a parameter from file. First checks in 'overlying' set and if not found looks for it in 'default' params set. It accepts key composed by section1/section2/etc ... /param_name.

Template Parameters
bool local_guidance_control_interface::LocalGuidanceControlInterface::getYamlNodeFromFile ( const std::string &  pathYamlFile,
const std::string &  section,
yaml_tools::YamlNode yamlNode 
) const
private

Returns a YAML node created from a yaml file by looking at the specified section. If section is of type "first_section/second_section/desired_section" then the YAML node will contain parameters in "desired_section" since the function goes through each section.

Parameters
pathYamlFilepath of the file containing parameters.
sectionfull section.
yamlNodecreated YAML node containing parameters in section.
Returns
bool local_guidance_control_interface::LocalGuidanceControlInterface::keyHasSlashSeparator ( const std::string &  key,
std::string *  section,
std::string *  remainingKey 
) const
private

Checks if a key string has a '/' character. if os it splits the key in section and remaining key. Example: 'section/subsection/parameter' is splitted in section = 'section', remaining key = 'subsection/parameter'.

Parameters
[in]keystring containing the full key to analyze
[out]sectionfirst part of the key, until fir occurrency of separator '/'
[out]remainingKeyremaining part of the key, after first '/' (not included) to end of the key.
Returns
true if key contained one separator '/'.
virtual bool local_guidance_control_interface::LocalGuidanceControlInterface::loadParametersFromFile ( const std::string &  pathYamlFileDefaultParams,
const std::string &  pathYamlFileOverlyingParams 
)
pure virtual

Loads parameters with a default + overlying mechanism. See https://github.com/ethz-asl/ros_best_practices/wiki#parameter-organisation

Parameters
[in]pathYamlFileDefaultParamspath of the file containing default parameters.
[in]pathYamlFileOverlyingParamspath of the file containing parameters to overly on top default ones.

Implemented in local_guidance_pure_pursuit::LocalGuidancePurePursuit, and local_guidance_nop::LocalGuidanceNop.

bool local_guidance_control_interface::LocalGuidanceControlInterface::loadParametersSectionFromFile ( const std::string &  pathYamlFileDefaultParams = "",
const std::string &  pathYamlFileOverlyingParams = "",
const std::string &  sectionName = "" 
)
protected

Loads a parameter section with a default + overlying mechanism. See https://github.com/ethz-asl/ros_best_practices/wiki#parameter-organisation

Parameters
[in]pathYamlFileDefaultParamspath of the file containing default parameters.
[in]pathYamlFileOverlyingParamspath of the file containing parameters to overly on top default ones.
sectionNamename of the section between the file to extract and load only its parameters.
template<typename T >
T local_guidance_control_interface::LocalGuidanceControlInterface::parameter ( const std::string &  key) const
inlineprotected

Gets a parameter from file. First checks in 'overlying' set and if not found looks for it in 'default' params set.

Template Parameters
virtual void local_guidance_control_interface::LocalGuidanceControlInterface::printLoadedParameters ( ) const
protectedvirtual

Print loaded parameters, if they were loaded with loadParametersFrom* functions.

virtual void local_guidance_control_interface::LocalGuidanceControlInterface::reset ( )
pure virtual
virtual bool local_guidance_control_interface::LocalGuidanceControlInterface::setDesiredPath ( const PathConstPtr pDesiredPath)
pure virtual

Sets the desired path that should be followed.

Parameters
[in]pDesiredPathdesired path.
Returns
true on success.

Implemented in local_guidance_pure_pursuit::LocalGuidancePurePursuit, and local_guidance_nop::LocalGuidanceNop.

virtual bool local_guidance_control_interface::LocalGuidanceControlInterface::setRobotPose ( const PoseStampedConstPtr pRobotPose)
pure virtual

Sets current pose of the robot.

Parameters
[in]pRobotPosecurrent pose of the robot.
Returns
true on success.

Implemented in local_guidance_pure_pursuit::LocalGuidancePurePursuit, and local_guidance_nop::LocalGuidanceNop.

virtual bool local_guidance_control_interface::LocalGuidanceControlInterface::updateCurrentPath ( const PathConstPtr pDesiredPath)
pure virtual

Updates the current path that is being followed. Clients should call this function instead of setDesiredPath() when a path is already being followed and it should be just updated.

Parameters
pDesiredPathnew path
Returns
true on success.

Implemented in local_guidance_pure_pursuit::LocalGuidancePurePursuit, and local_guidance_nop::LocalGuidanceNop.

Member Data Documentation

bool local_guidance_control_interface::LocalGuidanceControlInterface::loadedYamlDefaultParams_ {false}
private
bool local_guidance_control_interface::LocalGuidanceControlInterface::loadedYamlOverlyingParams_ {false}
private
const std::string local_guidance_control_interface::LocalGuidanceControlInterface::localGuidanceControllerName_
private

Holds the name of the local guidance controller.

yaml_tools::YamlNode local_guidance_control_interface::LocalGuidanceControlInterface::yamlNodeDefaultParams_
private

YAML node containing default parameters.

yaml_tools::YamlNode local_guidance_control_interface::LocalGuidanceControlInterface::yamlNodeOverlyingParams_
private

YAML node containing overlying parameters.


The documentation for this class was generated from the following file: