Abstract class for a segment of the trajectory. More...
#include <trgen.h>
Inherited by Segment::Arc, Segment::Line, Segment::Spline, and Segment::Turn.
Public Member Functions | |
virtual void | setMaxV (const TrajectoryConstraints &constr)=0 |
virtual double | getMaxAcc (const TrajectoryConstraints &constr) const |
virtual bool | isTurn () const |
virtual bool | isSpline () const |
virtual double | getDistance (double time) const =0 |
TrajectorySegment () | |
virtual | ~TrajectorySegment () |
virtual double | getLength () const =0 |
Length of the segment in meters. | |
virtual double | getUnifiedLength () const |
Unified length of the segment, used for calculations of speed and accelerations. | |
virtual void | getPointAt (double distance, Point *p)=0 |
Returns the point of the segment, located at the specific distance from the beginning or end. | |
virtual void | shortenBy (double distance, Point *newEnd)=0 |
Shorten the segment by a specific length. | |
virtual TrajectorySegment * | splitAt (double distance, Point *newEnd)=0 |
Splits the segment at the specified point. | |
virtual TrajectorySegment * | splitAtByTime (double time, Point *newEnd)=0 |
virtual double | startAt (double time) |
Sets the starting time of the segment and calculates the ending time according to this. | |
virtual void | getRefPos (double time, Pos &rp)=0 |
Return the reference position at some time. | |
int | containsTime (double t) |
Return the position in time of this segment relative to the specified time. | |
double | getT1 () |
Returns t1 . | |
double | getT2 () |
Returns t2 . | |
Public Attributes | |
double | maxv |
Maximum speed of the segment. | |
double | acc |
Acceleration at this segment [ ![]() | |
double | v1 |
double | v2 |
speed in the beginning and at the end of the segment | |
double | s |
Helper values for Trajectory::corners2arcs(). | |
double | r |
double | alphahalf |
Protected Attributes | |
double | t1 |
Time in the beginning and at the end of the segment. | |
double | t2 |
Abstract class for a segment of the trajectory.
TrajectorySegment::TrajectorySegment | ( | ) | [inline] |
virtual TrajectorySegment::~TrajectorySegment | ( | ) | [inline, virtual] |
int TrajectorySegment::containsTime | ( | double | t | ) | [inline] |
Return the position in time of this segment relative to the specified time.
t | Time |
t
is within this segment, -1 if time t
is before this segment, +1 if time t
is after this segment. virtual double TrajectorySegment::getDistance | ( | double | time | ) | const [pure virtual] |
Implemented in Segment::Line, Segment::Turn, Segment::Spline, and Segment::Arc.
virtual double TrajectorySegment::getLength | ( | ) | const [pure virtual] |
Length of the segment in meters.
Implemented in Segment::Line, Segment::Turn, Segment::Spline, and Segment::Arc.
virtual double TrajectorySegment::getMaxAcc | ( | const TrajectoryConstraints & | constr | ) | const [inline, virtual] |
Reimplemented in Segment::Turn.
virtual void TrajectorySegment::getPointAt | ( | double | distance, | |
Point * | p | |||
) | [pure virtual] |
Returns the point of the segment, located at the specific distance
from the beginning or end.
[in] | distance | Distance from the beginning (if positive) or end (if negative) of the segment in meters. |
[out] | p | Pointer to the point to sore the result. |
Implemented in Segment::Line, Segment::Turn, Segment::Spline, and Segment::Arc.
virtual void TrajectorySegment::getRefPos | ( | double | time, | |
Pos & | rp | |||
) | [pure virtual] |
Return the reference position at some time.
[in] | time | Time (within this segment time range). |
[out] | rp | Reference position. |
Implemented in Segment::Line, Segment::Turn, Segment::Spline, and Segment::Arc.
double TrajectorySegment::getT1 | ( | ) | [inline] |
Returns t1
.
double TrajectorySegment::getT2 | ( | ) | [inline] |
Returns t2
.
virtual double TrajectorySegment::getUnifiedLength | ( | ) | const [inline, virtual] |
Unified length of the segment, used for calculations of speed and accelerations.
Normally, it equal to the real length, buf for TrajectorySegmentTurn (whose length is zero) it represents angle.
Reimplemented in Segment::Turn.
virtual bool TrajectorySegment::isSpline | ( | ) | const [inline, virtual] |
Reimplemented in Segment::Spline.
virtual bool TrajectorySegment::isTurn | ( | ) | const [inline, virtual] |
Reimplemented in Segment::Turn.
virtual void TrajectorySegment::setMaxV | ( | const TrajectoryConstraints & | constr | ) | [pure virtual] |
Implemented in Segment::Line, Segment::Turn, Segment::Spline, and Segment::Arc.
virtual void TrajectorySegment::shortenBy | ( | double | distance, | |
Point * | newEnd | |||
) | [pure virtual] |
Shorten the segment by a specific length.
[in] | distance | Distance from the end (if positive) of the segment, where should be the end of the segment. |
[in] | newEnd | Point which will be set to the position of the new end. |
Implemented in Segment::Line, Segment::Turn, Segment::Spline, and Segment::Arc.
virtual TrajectorySegment* TrajectorySegment::splitAt | ( | double | distance, | |
Point * | newEnd | |||
) | [pure virtual] |
Splits the segment at the specified point.
The result will be two segments following the same trajectory as the original one.
[in] | distance | Distance of the split from the beginning of the segment. |
[in] | newEnd | Point which will be used as a middle point joining the two segments. |
Implemented in Segment::Line, Segment::Turn, Segment::Spline, and Segment::Arc.
virtual TrajectorySegment* TrajectorySegment::splitAtByTime | ( | double | time, | |
Point * | newEnd | |||
) | [pure virtual] |
Implemented in Segment::Line, Segment::Turn, Segment::Spline, and Segment::Arc.
virtual double TrajectorySegment::startAt | ( | double | time | ) | [inline, virtual] |
Sets the starting time of the segment and calculates the ending time according to this.
Also acceleration is calculated from these times and speed.
time | Starting time relative to the start of the whole trajectory (in seconds). |
Reimplemented in Segment::Spline.
double TrajectorySegment::acc |
Acceleration at this segment [ ].
double TrajectorySegment::alphahalf |
double TrajectorySegment::maxv |
Maximum speed of the segment.
Determined by constraints of the whole trajectory.
double TrajectorySegment::r |
double TrajectorySegment::s |
Helper values for Trajectory::corners2arcs().
double TrajectorySegment::t1 [protected] |
Time in the beginning and at the end of the segment.
The time is relative to the start of the whole trajectory. Units are seconds.
double TrajectorySegment::t2 [protected] |
double TrajectorySegment::v1 |
double TrajectorySegment::v2 |
speed in the beginning and at the end of the segment