maliput_malidrive
RoadCurveFactoryBase Class Referenceabstract

Detailed Description

Interface of a helper class to build road curve related objects by MalidriveRoadGeometryBuilder.

This class is provided as an interface to facilitate testing of MalidriveRoadGeometry via dependency injection.

#include <src/maliput_malidrive/builder/road_curve_factory.h>

Inheritance diagram for RoadCurveFactoryBase:
[legend]

Public Member Functions

 RoadCurveFactoryBase ()=delete
 
 RoadCurveFactoryBase (double linear_tolerance, double scale_length, double angular_tolerance)
 Constructs RoadCurveFactoryBase. More...
 
virtual ~RoadCurveFactoryBase ()=default
 
virtual std::unique_ptr< road_curve::FunctionMakeCubicPolynomial (double a, double b, double c, double d, double p0, double p1) const =0
 
virtual std::unique_ptr< road_curve::FunctionMakeCubicPolynomial (double p0, double p1, double y, double dy) const =0
 Creates a cubic polynomial: More...
 
virtual std::unique_ptr< road_curve::GroundCurveMakeArcGroundCurve (const xodr::Geometry &arc_geometry) const =0
 Makes a road_curve::ArcGroundCurve. More...
 
virtual std::unique_ptr< road_curve::GroundCurveMakeLineGroundCurve (const xodr::Geometry &line_geometry) const =0
 Makes a road_curve::LineGroundCurve. More...
 
virtual std::unique_ptr< road_curve::GroundCurveMakeSpiralGroundCurve (const xodr::Geometry &spiral_geometry) const =0
 Makes a road_curve::SpiralGroundCurve. More...
 
virtual std::unique_ptr< road_curve::GroundCurveMakePiecewiseGroundCurve (const std::vector< xodr::Geometry > &geometries) const =0
 Makes a road_curve::PiecewiseGroundCurve. More...
 
virtual std::unique_ptr< malidrive::road_curve::FunctionMakeElevation (const xodr::ElevationProfile &elevation_profile, double p0, double p1, bool assert_continuity) const =0
 Makes a cubic polynomial that describes the elevation of a Road. More...
 
virtual std::unique_ptr< malidrive::road_curve::FunctionMakeSuperelevation (const xodr::LateralProfile &lateral_profile, double p0, double p1, bool assert_continuity) const =0
 Makes a cubic polynomial that describes the superelevation of a Road. More...
 
virtual std::unique_ptr< malidrive::road_curve::FunctionMakeLaneWidth (const std::vector< xodr::LaneWidth > &lane_widths, double p0, double p1, bool assert_continuity) const =0
 Makes a cubic polynomial that describes the width of a Lane. More...
 
virtual std::unique_ptr< malidrive::road_curve::FunctionMakeReferenceLineOffset (const std::vector< xodr::LaneOffset > &reference_offsets, double p0, double p1) const =0
 Makes a cubic polynomial that describes the lateral shift of the road reference line. More...
 
virtual std::unique_ptr< road_curve::RoadCurveMakeMalidriveRoadCurve (std::unique_ptr< road_curve::GroundCurve > ground_curve, std::unique_ptr< road_curve::Function > elevation, std::unique_ptr< road_curve::Function > superelevation, bool assert_contiguity) const =0
 Makes a road_curve::MalidriveGroundCurve. More...
 
virtual double linear_tolerance () const
 Tolerance accessors. More...
 
virtual double scale_length () const
 
virtual double angular_tolerance () const
 

Constructor & Destructor Documentation

◆ RoadCurveFactoryBase() [1/2]

◆ RoadCurveFactoryBase() [2/2]

RoadCurveFactoryBase ( double  linear_tolerance,
double  scale_length,
double  angular_tolerance 
)

Constructs RoadCurveFactoryBase.

Parameters
linear_toleranceRoadGeometry's linear tolerance. It will be used to build geometry objects. It must be non negative.
scale_lengthRoadGeometry's scale length. It will be used to build geometry objects. It must be positive.
angular_toleranceRoadGeometry's angular tolerance. It will be used to build geometry objects. It must be positive.
Exceptions
maliput::common::assertion_errorWhen linear_tolerance is not positive.
maliput::common::assertion_errorWhen scale_length is not positive.
maliput::common::assertion_errorWhen angular_tolerance is not positive.

◆ ~RoadCurveFactoryBase()

virtual ~RoadCurveFactoryBase ( )
virtualdefault

Member Function Documentation

◆ angular_tolerance()

virtual double angular_tolerance ( ) const
virtual

◆ linear_tolerance()

virtual double linear_tolerance ( ) const
virtual

Tolerance accessors.

◆ MakeArcGroundCurve()

virtual std::unique_ptr<road_curve::GroundCurve> MakeArcGroundCurve ( const xodr::Geometry arc_geometry) const
pure virtual

Makes a road_curve::ArcGroundCurve.

Its linear tolerance will be the constructor argument.

Parameters
arc_geometryxodr::Geometry definition to construct a road_curve::ArcGroundCurve. Its type must be xodr::Geometry::Type::kArc.
Returns
A road_curve::ArcGroundCurve.
Exceptions
maliput::common::assertion_errorWhen arc_geometry.type is not xodr::Geometry::Type::kArc.

Implemented in RoadCurveFactory.

◆ MakeCubicPolynomial() [1/2]

virtual std::unique_ptr<road_curve::Function> MakeCubicPolynomial ( double  a,
double  b,
double  c,
double  d,
double  p0,
double  p1 
) const
pure virtual
See also
road_curve::CubicPolynomial::CubicPolynomial() for argument details.
Returns
A road_curve::CubicPolynomial.

Implemented in RoadCurveFactory.

◆ MakeCubicPolynomial() [2/2]

virtual std::unique_ptr<road_curve::Function> MakeCubicPolynomial ( double  p0,
double  p1,
double  y,
double  dy 
) const
pure virtual

Creates a cubic polynomial:

\( f(p) = a p^3 + b p^2 + c p + d / p ∈ [`p0`; `p1`] \).

Meeting the following considerations: f(p0) = 0 f'(p0) = 0 f(p1) = y f'(p1) = dy

Parameters
p0Lower bound extreme of the parameter range. It must not be negative and must be less than p1.
p1Upper bound extreme of the parameter range. It must be greater than p0.
yPolynomial evaluated at \( p = `p1` \).
dyDerived polynomial evaluated at \( p = `p1` \).
Returns
A road_curve::CubicPolynomial.
Exceptions
maliput::common::assertion_errorWhen p0 is negative.
maliput::common::assertion_errorWhen p1 is not greater than p0.

Implemented in RoadCurveFactory.

◆ MakeElevation()

virtual std::unique_ptr<malidrive::road_curve::Function> MakeElevation ( const xodr::ElevationProfile elevation_profile,
double  p0,
double  p1,
bool  assert_continuity 
) const
pure virtual

Makes a cubic polynomial that describes the elevation of a Road.

Constructs a road::curve::Function out of elevation_profile. There could be two scenarios that depends on elevation_profile:

  • If it is empty then a zero cubic polynomial is created in the range [p0, p1]
  • If it contains one or more elevations then a piecewised function is created in the range [p0, p1]
Note
Handling tolerance: If there is a gap between p0 and the S0 value of the first elevation then a cubic polynomial is created to fullfill that gap.
See also
MakeCubicPolynomial To know characteristics of the cubic polynomial that is created.
Parameters
elevation_profileContains the elevation described in the XODR for the Road.
p0Lower bound extreme of the parameter range. It must not be negative and must be less than p1.
p1Upper bound extreme of the parameter range. It must be greater than p0.
assert_continuityIf true, C1 continuity is assert when function describing the elevation is built. Otherwise only warning messages are printed.
Returns
A function that describes the elevation of the Road.
Exceptions
maliput::common::assertion_errorWhen p0 is negative.
maliput::common::assertion_errorWhen p1 is not greater enough than p0.

Implemented in RoadCurveFactory.

◆ MakeLaneWidth()

virtual std::unique_ptr<malidrive::road_curve::Function> MakeLaneWidth ( const std::vector< xodr::LaneWidth > &  lane_widths,
double  p0,
double  p1,
bool  assert_continuity 
) const
pure virtual

Makes a cubic polynomial that describes the width of a Lane.

Constructs a road::curve::Function out of lane_widths.

Parameters
lane_widthsContains the width described in the XODR for the Lane.
p0Lower bound extreme of the parameter range. It must not be negative and must be less than p1.
p1Upper bound extreme of the parameter range. It must be greater than p0.
assert_continuityIf true, C1 continuity is assert when function describing the lane width is built. Otherwise only warning messages are printed.
Returns
A function that describes the width of the Lane.
Exceptions
maliput::common::assertion_errorWhen p0 is negative.
maliput::common::assertion_errorWhen p1 is not greater enough than p0.
maliput::common::assertion_errorWhen lane_widths 's size is zero.
maliput::common::assertion_errorWhen the first offset value of lane_widths is different than zero.
maliput::common::assertion_errorWhen lane_widths 's start points are distanced less than linear tolerance.
maliput::common::assertion_errorWhen lane_widths 's functions aren't at least as long as road::curve::GroundCurve::kEpsilon.

Implemented in RoadCurveFactory.

◆ MakeLineGroundCurve()

virtual std::unique_ptr<road_curve::GroundCurve> MakeLineGroundCurve ( const xodr::Geometry line_geometry) const
pure virtual

Makes a road_curve::LineGroundCurve.

Its linear tolerance will be the constructor argument.

Parameters
line_geometryxodr::Geometry definition to construct a road_curve::LineGroundCurve. Its type must be xodr::Geometry::Type::kLine.
Returns
A road_curve::LineGroundCurve.
Exceptions
maliput::common::assertion_errorWhen line_geometry.type is not xodr::Geometry::Type::kLine.

Implemented in RoadCurveFactory.

◆ MakeMalidriveRoadCurve()

virtual std::unique_ptr<road_curve::RoadCurve> MakeMalidriveRoadCurve ( std::unique_ptr< road_curve::GroundCurve ground_curve,
std::unique_ptr< road_curve::Function elevation,
std::unique_ptr< road_curve::Function superelevation,
bool  assert_contiguity 
) const
pure virtual

Makes a road_curve::MalidriveGroundCurve.

Its linear tolerance and scale length will be the constructor arguments.

See also
road_curve::RoadCurve::RoadCurve() for argument details.
Returns
A road_curve::MalidriveGroundCurve.

Implemented in RoadCurveFactory.

◆ MakePiecewiseGroundCurve()

virtual std::unique_ptr<road_curve::GroundCurve> MakePiecewiseGroundCurve ( const std::vector< xodr::Geometry > &  geometries) const
pure virtual

Makes a road_curve::PiecewiseGroundCurve.

Its linear tolerance will be the constructor argument.

Parameters
geometriesA vector of xodr::Geometry definitions to construct a road_curve::PiecewiseGroundCurve. Item's type must be one of {xodr::Geometry::Type::kArc, xodr::Geometry::Type::kLine, xodr::Geometry::Type::kSpiral}. It must not be empty. Geometries whose length is less than GroundCurve::kEpsilon are discarded.
Returns
A road_curve::PiecewiseGroundCurve.
Exceptions
maliput::common::assertion_errorWhen any item of geometries has other type than {xodr::Geometry::Type::kArc, xodr::Geometry::Type::kLine, xodr::Geometry::Type::kSpiral}.
maliput::common::assertion_errorWhen geometries is empty.

Implemented in RoadCurveFactory.

◆ MakeReferenceLineOffset()

virtual std::unique_ptr<malidrive::road_curve::Function> MakeReferenceLineOffset ( const std::vector< xodr::LaneOffset > &  reference_offsets,
double  p0,
double  p1 
) const
pure virtual

Makes a cubic polynomial that describes the lateral shift of the road reference line.

When reference_offsets is empty, a zero cubic polynomial is created in the range [p0, p1]. Otherwise, a PiecewiseFunction is created in the range [p0, p1].

Note
Handling tolerance: If there is a gap between p0 and the S0 value of the first offset function then a zero cubic polynomial is created to fullfill that gap.
Parameters
reference_offsetsContains the offset described in the XODR's laneOffset record for the road reference line.
p0Lower bound extreme of the parameter range. It must not be negative and must be less than p1.
p1Upper bound extreme of the parameter range. It must be greater than p0.
Returns
A function that describes the lateral shift of the road reference line.
Exceptions
maliput::common::assertion_errorWhen p0 is negative.
maliput::common::assertion_errorWhen p1 is not greater enough than p0.

Implemented in RoadCurveFactory.

◆ MakeSpiralGroundCurve()

virtual std::unique_ptr<road_curve::GroundCurve> MakeSpiralGroundCurve ( const xodr::Geometry spiral_geometry) const
pure virtual

Makes a road_curve::SpiralGroundCurve.

Its linear tolerance will be the constructor argument.

Parameters
spiral_geometryxodr::Geometry definition to construct a road_curve::SpiralGroundCurve. Its type must be xodr::Geometry::Type::kSpiral.
Returns
A road_curve::SpiralGroundCurve.
Exceptions
maliput::common::assertion_errorWhen spiral_geometry.type is not xodr::Geometry::Type::kSpiral.

Implemented in RoadCurveFactory.

◆ MakeSuperelevation()

virtual std::unique_ptr<malidrive::road_curve::Function> MakeSuperelevation ( const xodr::LateralProfile lateral_profile,
double  p0,
double  p1,
bool  assert_continuity 
) const
pure virtual

Makes a cubic polynomial that describes the superelevation of a Road.

Constructs a road::curve::Function out of lateral_profile. There could be two scenarios that depends on lateral_profile:

  • If it is empty then a zero cubic polynomial is created in the range [p0, p1]
  • If it contains one or more superelevations then a piecewised function is created in the range [p0, p1]
Note
Handling tolerance: If there is a gap between p0 and the S0 value of the first superelevation then a cubic polynomial is created to fullfill that gap.
See also
MakeCubicPolynomial To know characteristics of the cubic polynomial that is created.
Parameters
lateral_profileContains the superelevation described in the XODR for the Road.
p0Lower bound extreme of the parameter range. It must not be negative and must be less than p1.
p1Upper bound extreme of the parameter range. It must be greater than p0.
assert_continuityIf true, C1 continuity is assert when function describing the superelevation is built. Otherwise only warning messages are printed.
Returns
A function that describes the superelevation of the Road.
Exceptions
maliput::common::assertion_errorWhen p0 is negative.
maliput::common::assertion_errorWhen p1 is not greater enough than p0.

Implemented in RoadCurveFactory.

◆ scale_length()

virtual double scale_length ( ) const
virtual

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