utilities.hpp
Go to the documentation of this file.
1 /*********************************************************************
2 * Copyright (c) 2017 - for information on the respective copyright
3 * owner see the NOTICE file and/or the repository
4 *
5 * https://github.com/hbanzhaf/steering_functions.git
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16 * implied. See the License for the specific language governing
17 * permissions and limitations under the License.
18 
19 * This source code is derived from Continuous Curvature (CC) Steer.
20 * Copyright (c) 2016, Thierry Fraichard and Institut national de
21 * recherche en informatique et en automatique (Inria), licensed under
22 * the BSD license, cf. 3rd-party-licenses.txt file in the root
23 * directory of this source tree.
24 **********************************************************************/
25 
26 #ifndef UTILITIES_HPP
27 #define UTILITIES_HPP
28 
29 #include "fresnel.data"
30 
31 #define PI 3.1415926535897932384
32 #define HALF_PI 1.5707963267948966192
33 #define TWO_PI 6.2831853071795864770
34 #define SQRT_PI 1.7724538509055160273
35 #define SQRT_PI_INV 0.56418958354775628695
36 #define SQRT_TWO_PI_INV 0.39894228040143267794
37 
38 namespace steering
39 {
40 
41 const double epsilon = 1e-4;
42 
44 double get_epsilon();
45 
47 double sgn(double x);
48 
50 double point_distance(double x1, double y1, double x2, double y2);
51 
53 void polar(double x, double y, double &r, double &theta);
54 
56 double twopify(double alpha);
57 
59 double pify(double alpha);
60 
64 void fresnel(double s, double &S_f, double &C_f);
65 
73 void end_of_clothoid(double x_i, double y_i, double theta_i, double kappa_i, double sigma, double direction,
74  double length, double *x_f, double *y_f, double *theta_f, double *kappa_f);
75 
83 void end_of_circular_arc(double x_i, double y_i, double theta_i, double kappa, double direction, double length,
84  double *x_f, double *y_f, double *theta_f);
85 
93 void end_of_straight_line(double x_i, double y_i, double theta, double direction, double length, double *x_f,
94  double *y_f);
95 
97 void global_frame_change(double x, double y, double theta, double local_x, double local_y, double *global_x,
98  double *global_y);
99 
101 void local_frame_change(double x, double y, double theta, double global_x, double global_y, double *local_x,
102  double *local_y);
103 
105 int array_index_min(double array[], int size);
106 
108 void double_array_init(double array[], int size, double value);
109 
111 void pointer_array_init(void *array[], int size);
112 
113 } // namespace steering
114 
115 #endif
plot_states.alpha
alpha
Definition: plot_states.py:107
steering::point_distance
double point_distance(double x1, double y1, double x2, double y2)
Cartesian distance between two points.
Definition: utilities.cpp:67
steering::pify
double pify(double alpha)
Conversion of arbitrary angle given in [rad] to [-pi, pi[.
Definition: utilities.cpp:83
steering::end_of_straight_line
void end_of_straight_line(double x_i, double y_i, double theta, double direction, double length, double *x_f, double *y_f)
Computation of the end point on a straight line x_i, y_i: initial configuration theta: angle of strai...
Definition: utilities.cpp:216
steering::fresnel
void fresnel(double s, double &S_f, double &C_f)
Fresnel integrals: S_f = int_0_s(sin(pi/2 u*u)du), C_f = int_0_s(cos(pi/2 u*u)du) approximated with C...
Definition: utilities.cpp:161
steering::global_frame_change
void global_frame_change(double x, double y, double theta, double local_x, double local_y, double *global_x, double *global_y)
Transformation of (local_x, local_y) from local coordinate system to global one.
Definition: utilities.cpp:223
steering::end_of_circular_arc
void end_of_circular_arc(double x_i, double y_i, double theta_i, double kappa, double direction, double length, double *x_f, double *y_f, double *theta_f)
Computation of the end point on a circular arc x_i, y_i, theta_i: initial configuration kappa: curvat...
Definition: utilities.cpp:208
steering::direction
int direction(bool forward, bool order)
Definition: paths.cpp:312
steering::pointer_array_init
void pointer_array_init(void *array[], int size)
Initialize an array with nullptr.
Definition: utilities.cpp:264
steering::epsilon
const double epsilon
Definition: utilities.hpp:41
steering::local_frame_change
void local_frame_change(double x, double y, double theta, double global_x, double global_y, double *local_x, double *local_y)
Transformation of (global_x, global_y) from global coordinate system to local one.
Definition: utilities.cpp:232
steering::array_index_min
int array_index_min(double array[], int size)
Find index with minimal value in double array.
Definition: utilities.cpp:241
steering::end_of_clothoid
void end_of_clothoid(double x_i, double y_i, double theta_i, double kappa_i, double sigma, double direction, double length, double *x_f, double *y_f, double *theta_f, double *kappa_f)
Computation of the end point on a clothoid x_i, y_i, theta_i, kappa_i: initial configuration sigma: s...
Definition: utilities.cpp:176
steering::get_epsilon
double get_epsilon()
Return value of epsilon.
Definition: utilities.cpp:57
steering::polar
void polar(double x, double y, double &r, double &theta)
Computation of a point's polar coordinates.
Definition: utilities.cpp:72
plot_states.kappa
kappa
Definition: plot_states.py:106
steering::double_array_init
void double_array_init(double array[], int size, double value)
Initialize an array with a given value.
Definition: utilities.cpp:256
steering
Definition: dubins_state_space.hpp:70
steering::sgn
double sgn(double x)
Return sign of a number.
Definition: utilities.cpp:62
steering::twopify
double twopify(double alpha)
Conversion of arbitrary angle given in [rad] to [0, 2*pi[.
Definition: utilities.cpp:78


steering_functions
Author(s): Holger Banzhaf
autogenerated on Mon Dec 11 2023 03:27:44