maliput_malidrive
RoadCurve Class Reference

Detailed Description

Defines a class for a path in a Segment object surface.

The path is defined by an elevation and superelevation Function objects and a GroundCurve reference curve. The latter is a C1 function in the z=0 plane. Its domain is constrained in \( [GroundCurve::p0(); GroundCurve::p1()] \) interval and it should map a ℝ² curve. As per notation, \( p \) is the parameter of the reference curve, not necessarily arc length \( s \), and function interpolations and function derivatives as well as headings and heading derivatives are expressed in INERTIAL Frame coordinates.

The geometry here revolves around an abstract "world function"

\( W: (p,r,h) \mapsto (x,y,z) ∈ ℝ³ \)

which maps a Lane-frame position to its corresponding representation in world coordinates (with the caveat that instead of the lane's native longitudinal coordinate 's', the reference curve parameter 'p' is used).

W is derived from three functions which define the lane:

G: p --> (x,y) = the reference ground curve. Z: p --> z = the elevation function. Θ: p --> θ = the superelevation function.

as:

(x,y,z) = W(p,r,h) = (G(p), Z(p)) + R_αβγ*(0, r, h)

where:

  • R_αβγ is the roll/pitch/yaw rotation given by angles:

    α = Θ(p) β = -atan2(dZ/dp, sqrt((dG_x/dp)^2 + (dG_y/dp)^2)) at p γ = atan2(dG_y/dp, dG_x/dp) at p

(R_αβγ is essentially the orientation of the (s,r,h) Lane-frame at a location (s,0,0) on the reference-line of the lane. However, it is not necessarily the correct orientation at r != 0 or h != 0.)

The W(p,r,h) "world function" is defined by the RoadCurve referenced by a Lane's Segment. A Lane is also defined by a r0 lateral offset with respect to the reference curve of the RoadCurve. Thus, a mapping from the local (s,r,h) lane-frame of the Lane becomes:

(x,y,z) = L(s,r,h) = W(P(s, r0), r + r0, h),

where P:(s, r0) --> (p) is a (potentially non-linear) function dependent on the RoadCurve's reference-curve, elevation, and superelevation functions.

#include <src/maliput_malidrive/road_curve/road_curve.h>

Public Member Functions

 MALIDRIVE_NO_COPY_NO_MOVE_NO_ASSIGN (RoadCurve)
 
 RoadCurve (double linear_tolerance, double scale_length, std::unique_ptr< GroundCurve > ground_curve, std::unique_ptr< Function > elevation, std::unique_ptr< Function > superelevation, bool assert_contiguity)
 Constructs a RoadCurve. More...
 
 ~RoadCurve ()=default
 
double p0 () const
 
double p1 () const
 
double LMax () const
 
double linear_tolerance () const
 
double scale_length () const
 
maliput::math::Vector3 W (const maliput::math::Vector3 &prh) const
 Evaluates \( W(p, r, h) \). More...
 
maliput::math::Vector3 WDot (const maliput::math::Vector3 &prh) const
 Evaluates \( W'(p, r, h) \) with respect to \( p \). More...
 
maliput::math::Vector3 WDot (const maliput::math::Vector3 &prh, const Function *lane_offset) const
 Evaluates \( W'(p, r, h) \) with respect to \( p \). More...
 
maliput::math::RollPitchYaw Orientation (double p) const
 Evaluates the orientation in the INERTIAL Frame of the RoadCurve at p, i.e. More...
 
maliput::math::RollPitchYaw Orientation (const maliput::math::Vector3 &prh) const
 Evaluates the orientation in the INERTIAL Frame of the RoadCurve at prh. More...
 
maliput::math::RollPitchYaw Orientation (const maliput::math::Vector3 &prh, const Function *lane_offset) const
 Evaluates the orientation in the INERTIAL Frame of the RoadCurve at prh. More...
 
maliput::math::Vector3 WInverse (const maliput::math::Vector3 &xyz) const
 Evaluates \( W⁻¹(x, y, z) \). More...
 
maliput::math::Vector3 SHat (const maliput::math::Vector3 &prh, const Function *lane_offset) const
 Evaluates \( W'(p, r, h) / |W'(p, r, h)|` with respect to \) p \(. @param prh A vector in the RoadCurve domain. @return A normalized tangent vector in the direction of increasing \) p \( at @p prh. maliput::math::Vector3 SHat(const maliput::math::Vector3& prh) const; Evaluates \) W'(p, r, h) / |W'(p, r, h)|` with respect to \( p \). More...
 
maliput::math::Vector3 RHat (const maliput::math::Vector3 &prh) const
 Evaluates the r-axis unit vector at \( (p, r, h) \). More...
 
maliput::math::Vector3 RHat (const maliput::math::Vector3 &prh, const Function *lane_offset) const
 Evaluates the r-axis unit vector at \( (p, r, h) \). More...
 
maliput::math::Vector3 HHat (double p, const maliput::math::Vector3 &s_hat) const
 Evaluates the h-axis unit vector at \( (p, r, h) \). More...
 
double PFromP (double xodr_p) const
 Calculates the \( p \) value that matches with the \( p \) value in the XODR description. More...
 

Constructor & Destructor Documentation

◆ RoadCurve()

RoadCurve ( double  linear_tolerance,
double  scale_length,
std::unique_ptr< GroundCurve ground_curve,
std::unique_ptr< Function elevation,
std::unique_ptr< Function superelevation,
bool  assert_contiguity 
)

Constructs a RoadCurve.

Parameters
linear_toleranceIt is expected to be the same as maliput::api::RoadGeometry::linear_tolerance(). It must be non negative. It is used to integrate an offset RoadCurve's arc length and adjust integration parameters accordingly.
scale_lengthIt is expected to be the same as maliput::api::RoadGeometry::scale_length(). It must be non negative. It is used to integrate an offset RoadCurve's arc length and adjust integration parameters accordingly.
ground_curveThe reference GroundCurve of this RoadCurve. It must not be nullptr and must be G¹.
elevationThe elevation Function of this RoadCurve. It must not be nullptr.
superelevationThe superelevation Function of this RoadCurve. It must not be nullptr.
assert_contiguityTrue for assert contiguity for elevation and superelevation functions.
Exceptions
maliput::common::assertion_errorWhen linear_tolerance or scale_length are negative.
maliput::common::assertion_errorWhen ground_curve or elevation or superelevation are nullptr.
maliput::common::assertion_errorWhen ground_curve or elevation or superelevation are not G¹.
maliput::common::assertion_errorWhen ground_curve is not G¹.
maliput::common::assertion_errorWhen ground_curve, elevation and superelevation do not share the same range within linear_tolerance.

◆ ~RoadCurve()

~RoadCurve ( )
default

Member Function Documentation

◆ HHat()

maliput::math::Vector3 HHat ( double  p,
const maliput::math::Vector3 s_hat 
) const

Evaluates the h-axis unit vector at \( (p, r, h) \).

Parameters
pThe GroundCurve parameter.
s_hatA normalized tangent vector in the direction of increasing \( p \).
Returns
A normalized tangent vector in the direction of increasing \( h \) at p, i.e. at \( (p, 0, 0) \). It is orthogonal to s_hat by construction.
Exceptions
maliput::common::assertion_errorWhen lane_offset is nullptr.
maliput::common::assertion_errorWhen p is not in range [p0, p1].

◆ linear_tolerance()

double linear_tolerance ( ) const
Returns
The linear tolerance used to compute all the methods.
See also
maliput::api::RoadGeometry::linear_tolerance().

◆ LMax()

double LMax ( ) const

◆ MALIDRIVE_NO_COPY_NO_MOVE_NO_ASSIGN()

MALIDRIVE_NO_COPY_NO_MOVE_NO_ASSIGN ( RoadCurve  )

◆ Orientation() [1/3]

maliput::math::RollPitchYaw Orientation ( const maliput::math::Vector3 prh) const

Evaluates the orientation in the INERTIAL Frame of the RoadCurve at prh.

Parameters
prhA vector in the RoadCurve domain.
Returns
The orientation in the INERTIAL Frame of the RoadCurve at prh.

◆ Orientation() [2/3]

maliput::math::RollPitchYaw Orientation ( const maliput::math::Vector3 prh,
const Function lane_offset 
) const

Evaluates the orientation in the INERTIAL Frame of the RoadCurve at prh.

Parameters
prhA vector in the RoadCurve domain.
lane_offsetHolds the function, \( r(p) \), that describes the lateral offset at p. Used to calculate the derivative at prh.
Returns
The orientation in the INERTIAL Frame of the RoadCurve at prh.
Exceptions
maliput::common::assertion_errorWhen lane_offset is nullptr.
maliput::common::assertion_errorWhen prh .x() is not in range [p0, p1].

◆ Orientation() [3/3]

maliput::math::RollPitchYaw Orientation ( double  p) const

Evaluates the orientation in the INERTIAL Frame of the RoadCurve at p, i.e.

at \( (p, 0, 0) \).

Parameters
pThe GroundCurve parameter.
Returns
The orientation in the INERTIAL Frame of the RoadCurve at p.

◆ p0()

double p0 ( ) const

◆ p1()

double p1 ( ) const

◆ PFromP()

double PFromP ( double  xodr_p) const

Calculates the \( p \) value that matches with the \( p \) value in the XODR description.

Parameters
xodr_pThe parameter in the XODR description.
Returns
The \( p \) value in the GroundCurve domain.

◆ RHat() [1/2]

maliput::math::Vector3 RHat ( const maliput::math::Vector3 prh) const

Evaluates the r-axis unit vector at \( (p, r, h) \).

Parameters
prhA vector in the RoadCurve domain.
Returns
A normalized vector pointing in the direction of increasing \( r \) coordinate at prh.

◆ RHat() [2/2]

maliput::math::Vector3 RHat ( const maliput::math::Vector3 prh,
const Function lane_offset 
) const

Evaluates the r-axis unit vector at \( (p, r, h) \).

Parameters
prhA vector in the RoadCurve domain.
lane_offsetHolds the function, \( r(p) \), that describes the lateral offset at p. Used to calculate the derivative at prh.
Returns
A normalized tangent vector in the direction of increasing \( r \) at prh.
Exceptions
maliput::common::assertion_errorWhen lane_offset is nullptr.
maliput::common::assertion_errorWhen prh .x() is not in range [p0, p1].

◆ scale_length()

double scale_length ( ) const
Returns
The scale length of the tolerance used to compute all the methods.
See also
maliput::api::RoadGeometry::scale_length().

◆ SHat()

maliput::math::Vector3 SHat ( const maliput::math::Vector3 prh,
const Function lane_offset 
) const

Evaluates \( W'(p, r, h) / |W'(p, r, h)|` with respect to \) p \(. @param prh A vector in the RoadCurve domain. @return A normalized tangent vector in the direction of increasing \) p \( at @p prh. maliput::math::Vector3 SHat(const maliput::math::Vector3& prh) const; Evaluates \) W'(p, r, h) / |W'(p, r, h)|` with respect to \( p \).

Parameters
prhA vector in the RoadCurve domain.
lane_offsetHolds the function, \( r(p) \), that describes the lateral offset at p. Used to calculate the derivative at prh.
Returns
A normalized tangent vector in the direction of increasing \( p \) at prh.
Exceptions
maliput::common::assertion_errorWhen lane_offset is nullptr.
maliput::common::assertion_errorWhen prh .x() is not in range [p0, p1].

◆ W()

Evaluates \( W(p, r, h) \).

Parameters
prhA vector in the RoadCurve domain.
Returns
A vector in the INERTIAL Frame which is the image of the RoadCurve.

◆ WDot() [1/2]

maliput::math::Vector3 WDot ( const maliput::math::Vector3 prh) const

Evaluates \( W'(p, r, h) \) with respect to \( p \).

Parameters
prhA vector in the RoadCurve domain.
Returns
The derivative of \( W \) with respect to \( p \) at prh.

◆ WDot() [2/2]

maliput::math::Vector3 WDot ( const maliput::math::Vector3 prh,
const Function lane_offset 
) const

Evaluates \( W'(p, r, h) \) with respect to \( p \).

Note
Recall that W is the lane-to-world transform, defined by \( (x,y,z) = W(p,r,h) = (G(p), Z(p)) + R_{αβγ}*(0,r(p),h) \)
where \( G \) is the reference curve, \( Z \) is the elevation profile, and \( R_{αβγ} \) is a rotation matrix derived from reference curve (heading), elevation, and superelevation. Thus:
\( ∂W/∂p = (∂G(p)/∂p, ∂Z(p)/∂p) + (∂R_{αβγ}/∂p)*(0,r(p),h) + R_{αβγ}*∂(0,r(p),0)/∂p \),
where:
\( ∂G(p)/∂p = G'(p) \)
\( ∂Z(p)/∂p = Z'(p) \)
\( ∂R_{αβγ}/∂p = (∂R_{αβγ}/∂α ∂R_{αβγ}/∂β ∂R_{αβγ}/∂γ)*(dα/dp, dβ/dp, dγ/dp) \)
Parameters
prhA vector in the RoadCurve domain.
lane_offsetHolds the function, \( r(p) \), that describes the lateral offset at p. Used to calculate the derivative at prh.
Returns
The derivative of \( W \) with respect to \( p \) at prh.
Exceptions
maliput::common::assertion_errorWhen lane_offset is nullptr.
maliput::common::assertion_errorWhen prh .x() is not in range [p0, p1].
maliput::common::assertion_errorWhen lane_offset ->p0() is not in range [p0, p1].
maliput::common::assertion_errorWhen lane_offset ->p1() is not in range [p0, p1].

◆ WInverse()

maliput::math::Vector3 WInverse ( const maliput::math::Vector3 xyz) const

Evaluates \( W⁻¹(x, y, z) \).

Parameters
xyzA point in ℝ³ that would be used to minimize the Euclidean distance the image of \( W \).
Returns
A vector in RoadCurve's domain whose image through \( W \) would minimize the Euclidean distance to xyz.

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