Spline shaped segment. More...
#include <trgen.h>
Inherits TrajectorySegment.
Public Member Functions | |
Spline (Point *_p1, Point *_p2, Point *_corner) | |
virtual bool | isSpline () const |
virtual void | setMaxV (const TrajectoryConstraints &constr) |
Finds maximal speeds vc, v1 and v2 (in the middle, in the beginning and at the end). | |
virtual double | getLength () const |
Length of the segment in meters. | |
virtual double | getDistance (double time) const |
return distance on the spline in a given time | |
virtual void | getPointAt (double distance, Point *p) |
Returns the point of the segment, located at the specific distance from the beginning or end. | |
virtual void | shortenBy (double distance, Point *newEnd) |
result is changed variable length and one of param0 and param1 changed is also p1 or p2 , but they are no more utilized | |
virtual TrajectorySegment * | splitAtByTime (double time, Point *newEnd) |
virtual TrajectorySegment * | splitAt (double distance, Point *newEnd) |
Splits the segment at the specified point. | |
virtual void | getRefPos (double time, Pos &rp) |
Return the reference position at some time. | |
virtual double | startAt (double time) |
Sets the starting time of the segment and calculates the ending time according to this. |
Spline shaped segment.
The spline is represented by x-axis polynom and y-axis polynom. Both have 5-th order. P_x(t) = A_x*t^5 + B_x*t^4 + C_x*t^3 + D_x*t^2 + E_x*t + F_x P_y(t) = A_y*t^5 + B_y*t^4 + C_y*t^3 + D_y*t^2 + E_y*t + F_y The parameter t goes from param0 to param1 (initially 0 and 1) We pressume that the parameter dt/ds = const (reasonable simplification)
TODO: comment
double Segment::Spline::getDistance | ( | double | time | ) | const [virtual] |
return distance on the spline in a given time
Implements TrajectorySegment.
virtual double Segment::Spline::getLength | ( | ) | const [inline, virtual] |
Length of the segment in meters.
Implements TrajectorySegment.
void Segment::Spline::getPointAt | ( | double | distance, | |
Point * | p | |||
) | [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. |
Implements TrajectorySegment.
void Segment::Spline::getRefPos | ( | double | time, | |
Pos & | rp | |||
) | [virtual] |
Return the reference position at some time.
[in] | time | Time (within this segment time range). |
[out] | rp | Reference position. |
Implements TrajectorySegment.
virtual bool Segment::Spline::isSpline | ( | ) | const [inline, virtual] |
Reimplemented from TrajectorySegment.
void Segment::Spline::setMaxV | ( | const TrajectoryConstraints & | constr | ) | [virtual] |
Finds maximal speeds vc, v1 and v2 (in the middle, in the beginning and at the end).
The speed profile looks like a letter 'v' because of clothoid's curvature profile shape. This is a simplified approach, but quick. Other constraints play a significant role. display constraints with on-line speed and accs values
Implements TrajectorySegment.
void Segment::Spline::shortenBy | ( | double | distance, | |
Point * | newEnd | |||
) | [virtual] |
result is changed variable length
and one of param0
and param1
changed is also p1
or p2
, but they are no more utilized
Implements TrajectorySegment.
TrajectorySegment * Segment::Spline::splitAt | ( | double | distance, | |
Point * | newEnd | |||
) | [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. |
Implements TrajectorySegment.
TrajectorySegment * Segment::Spline::splitAtByTime | ( | double | time, | |
Point * | newEnd | |||
) | [virtual] |
double Segment::Spline::startAt | ( | double | time | ) | [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 from TrajectorySegment.