BSpline

Functions

void interpolate(InputDataSet Input, int Num, int P, OutputDataSet *Output)

This function takes the Input structure, performs the BSpline interpolation and outputs the result into Output structure

void approximate(InputDataSet Input, int Num, int Q, int P, OutputDataSet *Output)

This function takes the Input structure, performs the BSpline LS approximation and outputs the result into Output structure

void basisFunction(double t, Eigen::VectorXd U, int I, int P, double *NN, double *NN1, double *NN2)

This function calculates the basis functions NN of order P, and derivatives NN1, NN2, for a given time t and knot vector U

class InputDataSet
#include <BSpline.h>

The InputDataSet class contains the information about the points that must be interpolated. It is used as a data structure to intialize the inputs that are passed to the interpolating function.

Public Functions

InputDataSet()

This constructor initializes an Input structure for BSpline interpolation

InputDataSet(Eigen::VectorXd X1, Eigen::VectorXd X2, Eigen::VectorXd X3)

The constructor requires 3 N-dimensional vectors containing the coordinates of the waypoints

~InputDataSet()

Generic destructor

void setXDot_0(Eigen::Vector3d XDot_0)

Set the first derivative of the starting point (optional)

void setXDot_N(Eigen::Vector3d XDot_N)

Set the first derivative of the last point (optional)

void setXDDot_0(Eigen::Vector3d XDDot_0)

Set the second derivative of the starting point (optional)

void setXDDot_N(Eigen::Vector3d XDDot_N)

Set the second derivative of the last point (optional)

void setT(Eigen::VectorXd T)

Set the time tags for each waypoint (optional). Cannot be imposed together with avg velocity norm below

void setW(Eigen::VectorXd W)

Set the weights for each waypoint. Weights are used in the LS approximation

void setAvgXDot(double AvgXDot)

Set the average velocity norm (optional). Cannot be imposed together with time tag vector above

Public Members

double AvgXDot

desired average velocity norm

Eigen::VectorXd T

time tags: specifies at what time each waypoint is hit

Eigen::VectorXd W

weight vector for the LS approximation

Eigen::VectorXd X1

coordinate #1 of the waypoints

Eigen::VectorXd X2

coordinate #2 of the waypoints

Eigen::VectorXd X3

coordinate #3 of the waypoints

Eigen::Vector3d XDot_0

3D vector containing the first derivative at starting point

Eigen::Vector3d XDot_N

3D vector containing the first derivative at final point

Eigen::Vector3d XDDot_0

3D vector containing the second derivative at starting point

Eigen::Vector3d XDDot_N

3D vector containing the second derivative at final point

bool T_flag

indicates that time tags have been specified; if true, AvgXDot_flag is false

bool AvgXDot_flag

indicates that avg velocity norm has been specified; if true, T_flag is false

bool W_flag

indicates that weight vector has been specified

bool XDot_0_flag

indicates that first derivative at starting point has been specified

bool XDot_N_flag

indicates that first derivative at final point has been specified

bool XDDot_0_flag

indicates that second derivative at starting point has been specified

bool XDDot_N_flag

indicates that second derivative at final point has been specified

class OutputDataSet
#include <BSpline.h>

The OutputDataSet class is used as a data structure to contain the interpolated function and its first- and second-order derivatives, together with the time-tag vector T.

Public Functions

OutputDataSet()

This constructor initializes an Output structure for BSpline interpolation

~OutputDataSet()

Generic destructor

void getData(double t, double x[3], double xDot[3], double xDDot[3])

This method returns x, xDot and xDDot at the desired input time T

double getStates(double t, int derivative, int index)

This method returns single coordinates of x, xDot and xDDot at the desired input time T.

It is designed to be accessible from Python

Public Members

Eigen::VectorXd T

time tags for each point of the interpolated trajectory

Eigen::VectorXd X1

coordinate #1 of the interpolated trajectory

Eigen::VectorXd X2

coordinate #2 of the interpolated trajectory

Eigen::VectorXd X3

coordinate #3 of the interpolated trajectory

Eigen::VectorXd XD1

first derivative of coordinate #1 of the interpolated trajectory

Eigen::VectorXd XD2

first derivative of coordinate #2 of the interpolated trajectory

Eigen::VectorXd XD3

first derivative of coordinate #3 of the interpolated trajectory

Eigen::VectorXd XDD1

second derivative of coordinate #1 of the interpolated trajectory

Eigen::VectorXd XDD2

second derivative of coordinate #2 of the interpolated trajectory

Eigen::VectorXd XDD3

second derivative of coordinate #3 of the interpolated trajectory

int P

polynomial degree of the BSpline

Eigen::VectorXd U

knot vector of the BSpline

Eigen::VectorXd C1

coordinate #1 of the control points

Eigen::VectorXd C2

coordinate #2 of the control points

Eigen::VectorXd C3

coordinate #3 of the control points