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.
inlanecruising_plugin::smoothing::BSpline Class Reference

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

#include <BSpline.hpp>

Inheritance diagram for inlanecruising_plugin::smoothing::BSpline:
Inheritance graph
Collaboration diagram for inlanecruising_plugin::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 inlanecruising_plugin::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()

inlanecruising_plugin::smoothing::BSpline::~BSpline ( )
inline

Definition at line 36 of file BSpline.hpp.

36{};

Member Function Documentation

◆ first_deriv()

lanelet::BasicPoint2d inlanecruising_plugin::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 inlanecruising_plugin::smoothing::SplineI.

Definition at line 24 of file BSpline.cpp.

24 {
25 Eigen::Array2Xd v = spline_.derivatives(t, 1);
26 lanelet::BasicPoint2d output = {v(2), v(3)};
27 return output;
28}

References spline_.

◆ operator()()

lanelet::BasicPoint2d inlanecruising_plugin::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 inlanecruising_plugin::smoothing::SplineI.

Definition at line 17 of file BSpline.cpp.

18{
19 Eigen::VectorXd values = spline_(t);
20 lanelet::BasicPoint2d pt = {values.x(), values.y()};
21 return pt;
22}

References spline_.

◆ second_deriv()

lanelet::BasicPoint2d inlanecruising_plugin::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 inlanecruising_plugin::smoothing::SplineI.

Definition at line 30 of file BSpline.cpp.

30 {
31 Eigen::Array2Xd v = spline_.derivatives(t, 2);
32 lanelet::BasicPoint2d output = {v(4), v(5)};
33 return output;
34}

References spline_.

◆ setPoints()

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

Set key points which the spline will interpolate between.

Parameters
pointsThe key points

Implements inlanecruising_plugin::smoothing::SplineI.

Definition at line 7 of file BSpline.cpp.

8{
9 Eigen::MatrixXd matrix_points(2, points.size());
10 int row_index = 0;
11 for(auto const point : points){
12 matrix_points.col(row_index) << point.x(), point.y();
13 row_index++;
14 }
15 spline_ = Eigen::SplineFitting<Spline2d>::Interpolate(matrix_points,3 );
16}

References process_traj_logs::point, and spline_.

Member Data Documentation

◆ spline_

Spline2d inlanecruising_plugin::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: