Skip to content

Bernoulli

Class that implements a 2D Lemniscate of Bernoulli section. More...

#include <Bernoulli.h>

Inherits from PathSection

Public Functions

Name
Bernoulli(double radius, double center_x, double center_y)
Constructor for the path section that assumes the plane in which the path is placed is z=0.
Bernoulli(double radius, double center_x, double center_y, double z)
Constructor for the path section.
virtual Eigen::Vector3d eq_pd(double t) override
Path section equation.
virtual Eigen::Vector3d eq_d_pd(double t) override
First derivative of the path section equation with respect to the path parameter t.
virtual Eigen::Vector3d eq_dd_pd(double t) override
Second derivative of the path section equation with respect to the path parameter t.
virtual double curvature(double t) override
Compute the curvature using the direct formula.
virtual double getClosestPointGamma(Eigen::Vector3d & coordinate) override
Method for getting the gamma of the closest point. In this implementation the closest point is computed iteratively using Gradient Descent Method. For the first iteration, to get a good initialization, the section is divided into N partitions between [0, 2*PI] and the minimum is computed for each partition. The gamma with the minimum distance will be used to initialize the algorithm.

Additional inherited members

Public Functions inherited from PathSection

Name
virtual double tangent(double t)
Default method for computing the tangent to the path section.
virtual double derivative_norm(double t)
Default method for computing the norm of the derivative.
bool can_be_composed()
Method to return whether a pathSection can be composed with other path sections or not.
double limitGamma(double t)
Method to limit the gamma between the minimum and maximum value By default the maximum gamma is a very high number.
double getMaxGammaValue()
Method used to get the maximum gamma allowed by the path section By the default is the maximum valid number possible in c++.
double getMinGammaValue()
Method used to get the minimum gamma allowed by the path section By default is the minimum valid number possible in c++.
virtual ~PathSection()
Virtual destructor for the abstract class.

Protected Functions inherited from PathSection

Name
PathSection(bool can_be_composed)
Constructor for the abstract class i NOTE: this class is virtual, therefore an object of type PathSection cannot be instantiated in memory. Only derivatives of the class PathSection.
bool setMaxGammaValue(double gamma_max)
Method to update the max of the gamma parameter Validates if the value received is greater than gamma_min.
bool setMinGammaValue(double gamma_min)
Method to update the min value of the gamma parameter Validades if the value is received is smaller than gamma_max.
double GradientDescent(double gamma_o, Eigen::Vector3d & x_pos, double tolerance)
Method that implements the gradient descent to minimize the error of
double getInitialGammaEstimate(Eigen::Vector3d & x_pos, int num_partitions, double min_val, double max_val)
Method to get an initial estimate for the gamma. It divides the section into n sections and search for local minimums in the function that computes the distance of the vehicle inside those sections.
double bisection(Eigen::Vector3d & x_pos, double a, double b)
Method to implement bisection method

Detailed Description

class Bernoulli;

Class that implements a 2D Lemniscate of Bernoulli section.

Author:

  • Marcelo Jacinto
  • Joao Quintas
  • Joao Cruz
  • Hung Tuan

Version: 1.0a

Date: 2021

Copyright: MIT

This class is used as a part of the sections library

Public Functions Documentation

function Bernoulli

Bernoulli(
    double radius,
    double center_x,
    double center_y
)

Constructor for the path section that assumes the plane in which the path is placed is z=0.

Parameters:

  • radius The radius of the bernoulli lamniscaste section
  • center_x The x coordinate of the center of the bernoulli
  • center_y The y coordinate of the center of the bernoulli

function Bernoulli

Bernoulli(
    double radius,
    double center_x,
    double center_y,
    double z
)

Constructor for the path section.

Parameters:

  • radius The radius of the bernoulli lamniscaste section
  • center_x The x coordinate of the center of the bernoulli
  • center_y The y coordinate of the center of the bernoulli
  • z The altitude in m in which to place the bernoulli

function eq_pd

virtual Eigen::Vector3d eq_pd(
    double t
) override

Path section equation.

Parameters:

  • t The path parameter

Return: An Eigen::Vector3d with the value of the equation of the path

Reimplements: PathSection::eq_pd

function eq_d_pd

virtual Eigen::Vector3d eq_d_pd(
    double t
) override

First derivative of the path section equation with respect to the path parameter t.

Parameters:

  • t The path parameter

Return: An Eigen::Vector3d with the value of the derivate of the equation of the path

Reimplements: PathSection::eq_d_pd

function eq_dd_pd

virtual Eigen::Vector3d eq_dd_pd(
    double t
) override

Second derivative of the path section equation with respect to the path parameter t.

Parameters:

  • t The path paramter

Return: An Eigen::Vector3d with the value of the derivative of the equation of the path

Reimplements: PathSection::eq_dd_pd

function curvature

virtual double curvature(
    double t
) override

Compute the curvature using the direct formula.

Parameters:

  • t The path parameter

Return: a double with the curvature of the section

Reimplements: PathSection::curvature

function getClosestPointGamma

virtual double getClosestPointGamma(
    Eigen::Vector3d & coordinate
) override

Method for getting the gamma of the closest point. In this implementation the closest point is computed iteratively using Gradient Descent Method. For the first iteration, to get a good initialization, the section is divided into N partitions between [0, 2*PI] and the minimum is computed for each partition. The gamma with the minimum distance will be used to initialize the algorithm.

Parameters:

  • coordinate An Eigen::Vector3d with the coordinate of the vehicle

Return: a double with the gamma corresponding to the closest point

Reimplements: PathSection::getClosestPointGamma

Method to return the closest point to the path By default just calls the Gradient Descent algorithm


Updated on 2024-03-07 at 10:30:47 +0000


Last update: March 7, 2024