LocalGuidance
A library that generates velocity references to follow a path.
local_guidance_path_follower::FollowPathData Class Reference

#include <FollowPathData.hpp>

Public Types

using FollowPathDataPtr = std::unique_ptr< FollowPathData >
 

Public Member Functions

void getDistanceFromLastWaypoint (double *translationDistance, double *rotationDistance)
 
local_guidance_control_interface::PathPtr getDeepCopyPath () const
 
std::string getLocalGuidanceMode () const
 
void getInfo (uint16_t *initialNumberOfSegments, double *initialDistanceToGoal) const
 
local_guidance_control_interface::PoseStampedConstPtr getRobotCurrentPose ()
 
std::string getSegmentsFrameId () const
 
void getTranslationDistanceFromLastWaypoint (double *translationDistance)
 
bool setPath (const local_guidance_control_interface::Path &path)
 
bool setToleranceToConsiderPathCompleted (double goalToleranceTranslation, double goalToleranceRotation)
 
bool isLastWaypointReached ()
 
void printPath () const
 

Static Public Member Functions

static FollowPathDataPtr create (const local_guidance_control_interface::Path &path, const std::string &robotFrameId, double goalToleranceTranslation=kGoalToleranceTranslation, double goalToleranceRotation=kGoalToleranceRotation)
 

Private Member Functions

 FollowPathData ()=default
 
double getXYDistance (const local_guidance_control_interface::PoseStamped &pose1, const local_guidance_control_interface::PoseStamped &pose2) const
 
double getYawDistance (const local_guidance_control_interface::PoseStamped &pose1, const local_guidance_control_interface::PoseStamped &pose2) const
 
bool readRobotCurrentPose ()
 

Private Attributes

local_guidance_control_interface::PathPtr path_
 Holds the path to be follow. More...
 
std::string robotFrameId_
 frame_id of the robot that is following the path. More...
 
local_guidance_control_interface::PoseStampedPtr pRobotCurrentPoseInWaypointFrameId_
 last updated pose of the robot. More...
 
uint16_t initialNumberOfSegments_ {0}
 Initial number of segments of the path upon creation. More...
 
double initialDistanceToGoal_ {0}
 Initial distance of the robot form last goal of the path, upon creation. More...
 
local_guidance_control_interface::Tolerance toleranceToConsiderPathCompleted_ {kGoalToleranceTranslation, kGoalToleranceRotation}
 Tolerance to check if last waypoint of the path has been reached. More...
 
tf::TransformListener tfListener_
 TF listener. More...
 

Member Typedef Documentation

Constructor & Destructor Documentation

local_guidance_path_follower::FollowPathData::FollowPathData ( )
privatedefault

Member Function Documentation

static FollowPathDataPtr local_guidance_path_follower::FollowPathData::create ( const local_guidance_control_interface::Path path,
const std::string &  robotFrameId,
double  goalToleranceTranslation = kGoalToleranceTranslation,
double  goalToleranceRotation = kGoalToleranceRotation 
)
static

Factory function to be used to create and initialize an object of type FollowPathData.

Parameters
[in]pathpath to be followed
[in]robotFrameIdframe_id of the robot following the path.
[in]goalToleranceTranslationtolerance on translation error of last goal to consider path completed.
[in]goalToleranceRotationtolerance on rotation error of last goal to consider path completed.
Returns
local_guidance_control_interface::PathPtr local_guidance_path_follower::FollowPathData::getDeepCopyPath ( ) const

Returns a deep copy of the path that needs to be followed.

Returns
deep copy of the path to be followed.
void local_guidance_path_follower::FollowPathData::getDistanceFromLastWaypoint ( double *  translationDistance,
double *  rotationDistance 
)

Returns translation and rotation distance of the latest pose of the robot form last waypoint in the path. Attention: calling this function implicitly triggers readRobotCurrentPose().

Parameters
[out]translationDistancetranslation distance of the robot from last waypoint.
[out]rotationDistancerotation distance of the robot from last waypoint.
void local_guidance_path_follower::FollowPathData::getInfo ( uint16_t *  initialNumberOfSegments,
double *  initialDistanceToGoal 
) const

Returns info about the path.

Parameters
[in]initialNumberOfSegmentsinitial number of segments on the path.
[in]initialDistanceToGoalinitial distance to goal.
std::string local_guidance_path_follower::FollowPathData::getLocalGuidanceMode ( ) const

Returns local guidance mode of the path.

Returns
local guidance mode of the whole path.
local_guidance_control_interface::PoseStampedConstPtr local_guidance_path_follower::FollowPathData::getRobotCurrentPose ( )

Returns current robot pose. The pose of the robot is expressed in same frame as waypoints. Attention: calling this function implicitly triggers readRobotCurrentPose().

Returns
current robot pose
std::string local_guidance_path_follower::FollowPathData::getSegmentsFrameId ( ) const

Returns the frame_id of the segments composing the path.

Returns
frame_id of the segments (it must be the same for all of them).
void local_guidance_path_follower::FollowPathData::getTranslationDistanceFromLastWaypoint ( double *  translationDistance)

Returns translation rotation distance of the latest pose of the robot form last waypoint in the path. Attention: calling this function implicitly triggers readRobotCurrentPose().

Parameters
[out]translationDistancetranslation distance of the robot from last waypoint.
double local_guidance_path_follower::FollowPathData::getXYDistance ( const local_guidance_control_interface::PoseStamped pose1,
const local_guidance_control_interface::PoseStamped pose2 
) const
private

Get the 2D (X and Y) distance between two poses.

Parameters
[in]pose1pose 1.
[in]pose2pose 2.
Returns
2D (X and Y) distance between the two poses.
double local_guidance_path_follower::FollowPathData::getYawDistance ( const local_guidance_control_interface::PoseStamped pose1,
const local_guidance_control_interface::PoseStamped pose2 
) const
private

Get rotation (yaw) distance between two poses.

Parameters
[in]pose1pose 1.
[in]pose2pose 2.
Returns
angular distance (yaw) between the two poses.
bool local_guidance_path_follower::FollowPathData::isLastWaypointReached ( )

Checks if last waypoint is reached using tolerance for translation and rotation. Attention: calling this function implicitly triggers readRobotCurrentPose().

Returns
true if last waypoint is reached, based on tolerance set either in create() or setToleranceToConsiderPathCompleted().
void local_guidance_path_follower::FollowPathData::printPath ( ) const

Prints on terminal the path.

bool local_guidance_path_follower::FollowPathData::readRobotCurrentPose ( )
private

Reads current robot pose from TF. Pose of the robot is requested in same frame as waypoints.

Returns
true on success.
bool local_guidance_path_follower::FollowPathData::setPath ( const local_guidance_control_interface::Path path)

Sets a path that should be followed. Executes safety checks on path data.

Parameters
[in]pathpath to be set.
Returns
true on success.
bool local_guidance_path_follower::FollowPathData::setToleranceToConsiderPathCompleted ( double  goalToleranceTranslation,
double  goalToleranceRotation 
)

Sets the translation and rotational tolerance to consider path completed.

Parameters
[in]goalToleranceTranslation
[in]goalToleranceRotation
Returns
true on success.

Member Data Documentation

double local_guidance_path_follower::FollowPathData::initialDistanceToGoal_ {0}
private

Initial distance of the robot form last goal of the path, upon creation.

uint16_t local_guidance_path_follower::FollowPathData::initialNumberOfSegments_ {0}
private

Initial number of segments of the path upon creation.

local_guidance_control_interface::PathPtr local_guidance_path_follower::FollowPathData::path_
private

Holds the path to be follow.

local_guidance_control_interface::PoseStampedPtr local_guidance_path_follower::FollowPathData::pRobotCurrentPoseInWaypointFrameId_
private

last updated pose of the robot.

std::string local_guidance_path_follower::FollowPathData::robotFrameId_
private

frame_id of the robot that is following the path.

tf::TransformListener local_guidance_path_follower::FollowPathData::tfListener_
private

TF listener.

local_guidance_control_interface::Tolerance local_guidance_path_follower::FollowPathData::toleranceToConsiderPathCompleted_ {kGoalToleranceTranslation, kGoalToleranceRotation}
private

Tolerance to check if last waypoint of the path has been reached.


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