Carma-platform v4.2.0
CARMA Platform is built on robot operating system (ROS) and utilizes open source software (OSS) that enables Cooperative Driving Automation (CDA) features to allow Automated Driving Systems to interact and cooperate with infrastructure and other vehicles through communication.
basic_autonomy::smoothing::BSpline Class Reference

Realization of SplineI that uses the Eigen::Splines library for interpolation. More...

#include <BSpline.hpp>

Inheritance diagram for basic_autonomy::smoothing::BSpline:
Inheritance graph
Collaboration diagram for basic_autonomy::smoothing::BSpline:
Collaboration graph

Public Member Functions

 ~BSpline ()
 
void setPoints (const std::vector< lanelet::BasicPoint2d > &points) override
 Set key points which the spline will interpolate between. More...
 
lanelet::BasicPoint2d operator() (double t) const override
 Get the BasicPoint2d coordinate along the curve at t-th step. More...
 
lanelet::BasicPoint2d first_deriv (double t) const override
 Get the BasicPoint2d representing the first_deriv along the curve at t-th step. More...
 
lanelet::BasicPoint2d second_deriv (double t) const override
 Get the BasicPoint2d representing the first_deriv along the curve at t-th step. More...
 
- Public Member Functions inherited from basic_autonomy::smoothing::SplineI
virtual ~SplineI ()
 Virtual destructor to ensure delete safety for pointers to implementing classes. More...
 
virtual void setPoints (const std::vector< lanelet::BasicPoint2d > &points)=0
 Set key points which the spline will interpolate between. More...
 
virtual lanelet::BasicPoint2d operator() (double t) const =0
 Get the BasicPoint2d coordinate along the curve at t-th step. More...
 
virtual lanelet::BasicPoint2d first_deriv (double x) const =0
 Get the BasicPoint2d representing the first_deriv along the curve at t-th step. More...
 
virtual lanelet::BasicPoint2d second_deriv (double x) const =0
 Get the BasicPoint2d representing the first_deriv along the curve at t-th step. More...
 

Private Attributes

Spline2d spline_
 

Detailed Description

Realization of SplineI that uses the Eigen::Splines library for interpolation.

Definition at line 33 of file BSpline.hpp.

Constructor & Destructor Documentation

◆ ~BSpline()

basic_autonomy::smoothing::BSpline::~BSpline ( )
inline

Definition at line 36 of file BSpline.hpp.

36{};

Member Function Documentation

◆ first_deriv()

lanelet::BasicPoint2d basic_autonomy::smoothing::BSpline::first_deriv ( double  x) const
overridevirtual

Get the BasicPoint2d representing the first_deriv along the curve at t-th step.

Parameters
tThe t-th step to solve the spline at, where t is from 0 (beginning of curve) to 1 (end of curve)
Returns
lanelet::BasicPoint2d with x, y that matches the first_deriv at t-th step along the curve. This is not partial derivatives

Implements basic_autonomy::smoothing::SplineI.

Definition at line 41 of file BSpline.cpp.

41 {
42 Eigen::Array2Xd v = spline_.derivatives(t, 1);
43 lanelet::BasicPoint2d output = {v(2), v(3)};
44 return output;
45}

References spline_.

◆ operator()()

lanelet::BasicPoint2d basic_autonomy::smoothing::BSpline::operator() ( double  t) const
overridevirtual

Get the BasicPoint2d coordinate along the curve at t-th step.

Parameters
tThe t-th step to solve the spline at, where t is from 0 (beginning of curve) to 1 (end of curve)
Returns
lanelet::BasicPoint2d with x, y that matches the t-th step along the curve

Implements basic_autonomy::smoothing::SplineI.

Definition at line 34 of file BSpline.cpp.

35{
36 Eigen::VectorXd values = spline_(t);
37 lanelet::BasicPoint2d pt = {values.x(), values.y()};
38 return pt;
39}

References spline_.

◆ second_deriv()

lanelet::BasicPoint2d basic_autonomy::smoothing::BSpline::second_deriv ( double  x) const
overridevirtual

Get the BasicPoint2d representing the first_deriv along the curve at t-th step.

Parameters
tThe t-th step to solve the spline at, where t is from 0 (beginning of curve) to 1 (end of curve)
Returns
lanelet::BasicPoint2d with x, y that matches the second_deriv at t-th step along the curve. This is not partial derivatives

Implements basic_autonomy::smoothing::SplineI.

Definition at line 47 of file BSpline.cpp.

47 {
48 Eigen::Array2Xd v = spline_.derivatives(t, 2);
49 lanelet::BasicPoint2d output = {v(4), v(5)};
50 return output;
51}

References spline_.

◆ setPoints()

void basic_autonomy::smoothing::BSpline::setPoints ( const std::vector< lanelet::BasicPoint2d > &  points)
overridevirtual

Set key points which the spline will interpolate between.

Parameters
pointsThe key points

Implements basic_autonomy::smoothing::SplineI.

Definition at line 24 of file BSpline.cpp.

25{
26 Eigen::MatrixXd matrix_points(2, points.size());
27 int row_index = 0;
28 for(auto const point : points){
29 matrix_points.col(row_index) << point.x(), point.y();
30 row_index++;
31 }
32 spline_ = Eigen::SplineFitting<Spline2d>::Interpolate(matrix_points,3 );
33}

References process_traj_logs::point, and spline_.

Member Data Documentation

◆ spline_

Spline2d basic_autonomy::smoothing::BSpline::spline_
private

Definition at line 42 of file BSpline.hpp.

Referenced by first_deriv(), operator()(), second_deriv(), and setPoints().


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