GT RoboCup SSL
Soccer software, robot firmware
Planning::Path Class Referenceabstract

Abstract class representing a motion path. More...

Public Member Functions

 Path (RJ::Time startTime=RJ::now())
 
std::optional< RobotInstantevaluate (RJ::Seconds t) const
 This method evaluates the path at a given time and returns the target angle, position, and velocity of the robot. More...
 
virtual bool hit (const Geometry2d::ShapeSet &obstacles, RJ::Seconds startTimeIntoPath, RJ::Seconds *hitTime=nullptr) const =0
 Returns true if the path hits an obstacle. More...
 
virtual void draw (DebugDrawer *const debug_drawer, const QColor &color=Qt::black, const QString &layer="Motion") const
 Draws the path. More...
 
virtual RJ::Seconds getDuration () const =0
 Returns how long it would take for the entire path to be traversed. More...
 
RJ::Seconds getSlowedDuration () const
 
virtual std::unique_ptr< PathsubPath (RJ::Seconds startTime=0ms, RJ::Seconds endTime=RJ::Seconds::max()) const =0
 Returns a subPath. More...
 
virtual RobotInstant start () const =0
 Start instant of the path.
 
virtual RobotInstant end () const =0
 Destination instant of the path.
 
virtual std::unique_ptr< Pathclone () const =0
 Returns a deep copy of the Path.
 
virtual void setDebugText (QString string)
 
virtual void drawDebugText (DebugDrawer *debug_drawer, const QColor &color=Qt::darkCyan, const QString &layer="PathDebugText") const
 
virtual RJ::Time startTime () const
 The time the path starts at.
 
virtual void setStartTime (RJ::Time t)
 
virtual bool pathsIntersect (const std::vector< DynamicObstacle > &paths, RJ::Time startTime, Geometry2d::Point *hitLocation, RJ::Seconds *hitTime) const
 
virtual std::unique_ptr< ConstPathIteratoriterator (RJ::Time startTime, RJ::Seconds deltaT) const
 
void slow (float multiplier, RJ::Seconds timeInto=RJ::Seconds::zero())
 

Protected Member Functions

virtual std::optional< RobotInstanteval (RJ::Seconds t) const =0
 

Protected Attributes

double evalRate = 1.0
 
RJ::Time _startTime
 
std::optional< QString > _debugText
 

Detailed Description

Abstract class representing a motion path.

+ Inheritance diagram for Planning::Path:

Member Function Documentation

◆ draw()

void Planning::Path::draw ( DebugDrawer *const  debug_drawer,
const QColor &  color = Qt::black,
const QString &  layer = "Motion" 
) const
virtual

Draws the path.

The default implementation adds a DebugRobotPath to the SystemState that interpolates points along the path.

Parameters
debug_drawerThe SystemState to draw the path on
colorThe color the path should be drawn
layerThe layer to draw the path on

Reimplemented in Planning::AngleFunctionPath, Planning::InterpolatedPath, and Planning::CompositePath.

◆ evaluate()

std::optional<RobotInstant> Planning::Path::evaluate ( RJ::Seconds  t) const
inline

This method evaluates the path at a given time and returns the target angle, position, and velocity of the robot.

Parameters
tTime (in seconds) since the robot started the path. Throws an exception if t<0
Returns
A RobotInstant containing the angle, position, and velocity at the given time if is within the range of the path. If is not within the time range of this path, this method returns std::nullopt

◆ getDuration()

virtual RJ::Seconds Planning::Path::getDuration ( ) const
pure virtual

Returns how long it would take for the entire path to be traversed.

Returns
The time from start to path completion or infinity if it never stops

Implemented in Planning::AngleFunctionPath, Planning::InterpolatedPath, Planning::CompositePath, and Planning::TrapezoidalPath.

◆ hit()

virtual bool Planning::Path::hit ( const Geometry2d::ShapeSet obstacles,
RJ::Seconds  startTimeIntoPath,
RJ::Seconds *  hitTime = nullptr 
) const
pure virtual

Returns true if the path hits an obstacle.

Parameters
[in]shapeThe obstacles on the field
[out]hitTimethe approximate time when the path hits an obstacle. If no obstacles are hit, behavior is undefined for the final value.
[in]startTimeIntoPathThe time on the path to start checking from
Returns
true if it hits an obstacle, otherwise false

Implemented in Planning::AngleFunctionPath, Planning::InterpolatedPath, Planning::CompositePath, and Planning::TrapezoidalPath.

◆ subPath()

virtual std::unique_ptr<Path> Planning::Path::subPath ( RJ::Seconds  startTime = 0ms,
RJ::Seconds  endTime = RJ::Seconds::max() 
) const
pure virtual

Returns a subPath.

Parameters
startTimeThe startTime for from which the subPath should be taken.
endTimeThe endTime from which the subPath should be taken. If it is greater than the duration fo the path, it should go to the end of the path.
Returns
A unique_ptr to the new subPath

Implemented in Planning::AngleFunctionPath, Planning::InterpolatedPath, Planning::CompositePath, and Planning::TrapezoidalPath.


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