Skip to content

Commit 15a7d21

Browse files
authored
New math, plus script to download latex images of equations (#44)
* New math, plus script to download latex images of equations * General Taylor Series derivation
1 parent 443de57 commit 15a7d21

File tree

61 files changed

+361
-16
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+361
-16
lines changed

dlux_global_planner/Derivation.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Full Derivation
2+
We start with our basic equation definitions.
3+
* ![P(X) = \frac{-\beta + \sqrt{\beta^2 - 4 \gamma}}{2}](doc/PX_frac_beta_sqrtbeta_2_4gamma2.gif)
4+
* ![\beta = -\Big(P(C) + P(A)\Big)](doc/beta__BigPC_PABig.gif)
5+
* ![\gamma = \frac{P(A)^2 + P(C)^2 - h^2}{2}](doc/gamma_fracPA_2_PC_2_h_22.gif)
6+
7+
## Reformulate
8+
First we want to reformulate in terms of our new ![\delta](doc/delta.gif) variable.
9+
* ![\delta = \frac{P(C) - P(A)}{h}](doc/delta_fracPC_PAh.gif)
10+
11+
We can rewrite this so we have a new definition of ![P(C)](doc/PC.gif)
12+
* ![P(C) = h\delta + P(A)](doc/PC_hdelta_PA.gif)
13+
14+
This allows us to derive new values for the other equations.
15+
* ![\beta = -\Big(P(C) + P(A)\Big)](doc/beta__BigPC_PABig.gif)
16+
* ![\beta = -\Big(h\delta + P(A) + P(A)\Big)](doc/beta__Bighdelta_PA_PABig.gif)
17+
* ![\beta = -h\delta - 2 P(A)](doc/beta__hdelta_2PA.gif)
18+
* ![\gamma = \frac{P(A)^2 + P(C)^2 - h^2}{2}](doc/gamma_fracPA_2_PC_2_h_22.gif)
19+
* ![\gamma = \frac{P(A)^2 + \Big(P(A)+h\delta\Big)^2 - h^2}{2}](doc/gamma_fracPA_2_BigPA_hdeltaBig_2_h_22.gif)
20+
* ![\gamma = P(A)^2 + h\delta P(A) + \frac{h^2\delta^2 - h^2}{2}](doc/gamma_PA_2_hdeltaPA_frach_2delta_2_h_22.gif)
21+
* ![P(X) = \frac{-\beta + \sqrt{\beta^2 - 4 \gamma}}{2}](doc/PX_frac_beta_sqrtbeta_2_4gamma2.gif)
22+
* ![P(X) = \frac{-(-h\delta - 2 P(A)) + \sqrt{\Big(-h\delta - 2 P(A)\Big)^2 - 4 \Big(P(A)^2 + h\delta P(A) + \frac{h^2\delta^2 - h^2}{2}\Big)}}{2}](doc/PX_frac__hdelta_2PA_sqrtBig_hdelta_2PABig_2_4BigPA_2_hdeltaPA_frach_2delta_2_h_22Big2.gif)
23+
* ![P(X) = \frac{h\delta + 2 P(A) + \sqrt{\Big(-h\delta - 2 P(A)\Big)^2 - 4 P(A)^2 -4 h\delta P(A) - 2h^2\delta^2 + 2h^2}}{2}](doc/PX_frachdelta_2PA_sqrtBig_hdelta_2PABig_2_4PA_2_4hdeltaPA_2h_2delta_2_2h_22.gif)
24+
* ![P(X) = \frac{h\delta + 2 P(A) + \sqrt{4P(A)^2 + 4h\delta P(A) + h^2\delta^2 - 4 P(A)^2 -4 h\delta P(A) - 2h^2\delta^2 + 2h^2}}{2}](doc/PX_frachdelta_2PA_sqrt4PA_2_4hdeltaPA_h_2delta_2_4PA_2_4hdeltaPA_2h_2delta_2_2h_22.gif)
25+
* ![P(X) = \frac{h\delta + 2 P(A) + \sqrt{-h^2\delta^2 + 2h^2}}{2}](doc/PX_frachdelta_2PA_sqrt_h_2delta_2_2h_22.gif)
26+
* ![P(X) = P(A) + \frac{h}{2} \Big(\delta + \sqrt{2-\delta^2}\Big)](doc/PX_PA_frach2Bigdelta_sqrt2_delta_2Big.gif)
27+
28+
We're going to call this a new function ![f(\delta)](doc/fdelta.gif), so now ![P(X)](doc/PX.gif) is in terms of ![f(\delta)](doc/fdelta.gif)
29+
* ![f(\delta) = P(A) + \frac{h}{2} \Big(\delta + \sqrt{2-\delta^2}\Big)](doc/fdelta_PA_frach2Bigdelta_sqrt2_delta_2Big.gif)
30+
31+
## Taylor Series Expansion
32+
For computational efficiency, we are going to compute the Taylor series expansion. So first, we'll need the derivatives of ![f(\delta)](doc/fdelta.gif).
33+
* ![f'(\delta) = \frac{h}{2} (1 - \frac{\delta}{\sqrt{2-\delta^2}})](doc/f_delta_frach21_fracdeltasqrt2_delta_2.gif)
34+
* ![f''(\delta) = \frac{-h}{(2-\delta^2)^\frac{3}{2}}](doc/f__delta_frac_h2_delta_2_frac32.gif)
35+
36+
### 0th Order Taylor
37+
* ![f_0(\delta, a) = f(a)](doc/f_0delta_a_fa.gif)
38+
* ![f_0(\delta, a) = P(A) + \frac{h}{2} \Big(a + \sqrt{2-a^2}\Big)](doc/f_0delta_a_PA_frach2Biga_sqrt2_a_2Big.gif)
39+
40+
### 1st Order Taylor
41+
* ![f_1(\delta, a) = f(a) + f'(a) (\delta - a)](doc/f_1delta_a_fa_f_adelta_a.gif)
42+
* ![f_1(\delta, a) = P(A) + \frac{h}{2} \Big(a + \sqrt{2-a^2}\Big) + \frac{h}{2} (1 - \frac{a}{\sqrt{2-a^2}}) (\delta - a)](doc/f_1delta_a_PA_frach2Biga_sqrt2_a_2Big_frach21_fracasqrt2_a_2delta_a.gif)
43+
* ![f_1(\delta, a) = P(A) + \frac{h}{2} \Big(a + \sqrt{2-a^2} + (1 - \frac{a}{\sqrt{2-a^2}}) (\delta - a)\Big)](doc/f_1delta_a_PA_frach2Biga_sqrt2_a_2_1_fracasqrt2_a_2delta_aBig.gif)
44+
* ![f_1(\delta, a) = P(A) + \frac{h}{2} \Big(a + \sqrt{2-a^2} + \delta - a - \frac{a\delta}{\sqrt{2-a^2}} + \frac{a^2}{\sqrt{2-a^2}}\Big)](doc/f_1delta_a_PA_frach2Biga_sqrt2_a_2_delta_a_fracadeltasqrt2_a_2_fraca_2sqrt2_a_2Big.gif)
45+
* ![f_1(\delta, a) = P(A) + \frac{h}{2} \Big(\delta - \frac{a\delta}{\sqrt{2-a^2}} + \sqrt{2-a^2} + \frac{a^2}{\sqrt{2-a^2}}\Big)](doc/f_1delta_a_PA_frach2Bigdelta_fracadeltasqrt2_a_2_sqrt2_a_2_fraca_2sqrt2_a_2Big.gif)
46+
* ![f_1(\delta, a) = P(A) + \frac{h}{2} \Big(\delta - \frac{a\delta}{\sqrt{2-a^2}} + \frac{2}{\sqrt{2-a^2}}\Big)](doc/f_1delta_a_PA_frach2Bigdelta_fracadeltasqrt2_a_2_frac2sqrt2_a_2Big.gif)
47+
48+
### 2nd Order Taylor
49+
* ![f_2(\delta, a) = f(a) + f'(a) (\delta - a) + \frac{f''(a)}{2!}(\delta - a)^2](doc/f_2delta_a_fa_f_adelta_a_fracf__a2_delta_a_2.gif)
50+
* ![f_2(\delta, a) = f_1(\delta, a) + \frac{1}{2} \frac{-h}{(2-a^2)^\frac{3}{2}} (\delta - a)^2](doc/f_2delta_a_f_1delta_a_frac12frac_h2_a_2_frac32delta_a_2.gif)
51+
* ![f_2(\delta, a) = f_1(\delta, a) + \frac{h}{2} \frac{-1}{(2-a^2)^\frac{3}{2}} (\delta^2 - 2\delta a + a^2)](doc/f_2delta_a_f_1delta_a_frach2frac_12_a_2_frac32delta_2_2deltaa_a_2.gif)
52+
* ![f_2(\delta, a) = P(A) + \frac{h}{2} \Big(\delta - \frac{a\delta}{\sqrt{2-a^2}} + \frac{2}{\sqrt{2-a^2}}\Big) + \frac{h}{2} \frac{-1}{(2-a^2)^\frac{3}{2}} (\delta^2 - 2\delta a + a^2)](doc/f_2delta_a_PA_frach2Bigdelta_fracadeltasqrt2_a_2_frac2sqrt2_a_2Big_frach2frac_12_a_2_frac32delta_2_2deltaa_a_2.gif)
53+
* ![f_2(\delta, a) = P(A) + \frac{h}{2} \Big(\delta - \frac{a\delta}{\sqrt{2-a^2}} + \frac{2}{\sqrt{2-a^2}} + \frac{-1}{(2-a^2)^\frac{3}{2}} (\delta^2 - 2\delta a + a^2)\Big)](doc/f_2delta_a_PA_frach2Bigdelta_fracadeltasqrt2_a_2_frac2sqrt2_a_2_frac_12_a_2_frac32delta_2_2deltaa_a_2Big.gif)
54+
* ![f_2(\delta, a) = P(A) + h\Big(c_0(a) + c_1(a)\delta + c_2(a) \delta^2\Big)](doc/f_2delta_a_PA_hBigc_0a_c_1adelta_c_2adelta_2Big.gif)
55+
* ![c_0(a) = \frac{1}{2}\Big(\frac{2}{\sqrt{2-a^2}} - \frac{a^2}{(2-a^2)^\frac{3}{2}}\Big)](doc/c_0a_frac12Bigfrac2sqrt2_a_2_fraca_22_a_2_frac32Big.gif)
56+
* ![c_0(a) = \frac{4 - 3a^2}{2(2-a^2)^\frac{3}{2}}](doc/c_0a_frac4_3a_222_a_2_frac32.gif)
57+
58+
* ![c_1(a) = \frac{1}{2}\Big(1 - \frac{a}{\sqrt{2-a^2}} + \frac{2a}{(2-a^2)^\frac{3}{2}} \Big)](doc/c_1a_frac12Big1_fracasqrt2_a_2_frac2a2_a_2_frac32Big.gif)
59+
* ![c_2(a) = \frac{-1}{2(2-a^2)^\frac{3}{2}}](doc/c_2a_frac_122_a_2_frac32.gif)
60+
61+
## Exact coefficients
62+
Now that we have the general equations for the Taylor series, we can evaluate it at different values of a in the range `[0, 1]`.
63+
64+
| ![a](doc/a.gif) | ![c_0(a)](doc/c_0a.gif) | ![c_1(a)](doc/c_1a.gif) | ![c_2(a)](doc/c_2a.gif) |
65+
| ------ | ----------- | ----------- | ----------- |
66+
| 0.0 | 0.7071 | 0.5000 | -0.1768 |
67+
| 0.5 | 0.7019 | 0.5270 | -0.2160 |
68+
| 1.0 | 0.5000 | 1.0000 | -0.5000 |
69+
70+
Historically, the values used by [`navfn`](https://github.com/ros-planning/navigation/blob/1f335323a605b49b4108a845c55a7c1ba93a6f2e/navfn/src/navfn.cpp#L509) are
71+
72+
| ![c_0](doc/c_0.gif) | ![c_1](doc/c_1.gif) | ![c_2](doc/c_2.gif) |
73+
| ----------- | ----------- | ----------- |
74+
| 0.7040 | 0.5307 | -0.2301 |
75+
76+
You can see these values plotted [here](https://www.desmos.com/calculator/vbpkey1mt6).
77+
78+
The historical values are pretty close to the values for ![\delta=0.5](doc/delta_0_5.gif), although the exact reason for the difference is unknown, but its close enough to not be overly concerning.

dlux_global_planner/README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,24 @@ Below, we provide a "brief" mathematical derivation of the calculation.
111111
`D` are on the other axis.
112112
* The cost of moving to a cell is the cost from the costmap, which we'll call `h` (to match the paper's notation)
113113
* We assume, without loss of generality that
114-
* `P(A) <= P(B)`
115-
* `P(C) <= P(D)`
116-
* `P(A) <= P(C)`
117-
* If `P(C)` is infinite, that is, not initialized yet, the new potential calculation is straightforwardly ![P(X) = P(A) + h](https://latex.codecogs.com/gif.latex?P%28X%29%20%3D%20P%28A%29%20&plus;%20h).
118-
* Otherwise, we want to find a value of `P(X)` that satisfies the equation ![(P(X) - P(A))^2 + (P(X) - P(C))^2 = h^2](https://latex.codecogs.com/gif.latex?%5CBig%28P%28X%29-P%28A%29%5CBig%29%5E2&plus;%5CBig%28P%28X%29-P%28C%29%5CBig%29%5E2%3Dh%5E2)
119-
* It's possible there are no real values that satisfy the equation if ![P(C) - P(A) >= h](https://latex.codecogs.com/gif.latex?P%28C%29%20-%20P%28A%29%20%5Cgeq%20h) in which case the straightforward update is used.
114+
* ![P(A) <= P(B)](doc/PA__PB.gif)
115+
* ![P(C) <= P(D)](doc/PC__PD.gif)
116+
* ![P(A) <= P(C)](doc/PA__PC.gif)
117+
* If ![P(C)](doc/PC.gif) is infinite, that is, not initialized yet, the new potential calculation is straightforwardly ![P(X) = P(A) + h](doc/PX_PA_h.gif).
118+
* Otherwise, we want to find a value of `P(X)` that satisfies the equation ![\Big(P(X) - P(A)\Big)^2 + \Big(P(X) - P(C)\Big)^2 = h^2](doc/BigPX_PABig_2_BigPX_PCBig_2_h_2.gif)
119+
* It's possible there are no real values that satisfy the equation if ![P(C) - P(A) \geq h](doc/PC_PAgeqh.gif) in which case the straightforward update is used.
120120
* Otherwise, through clever manipulation of the quadratic formula, we can solve the equation with the following:
121-
* ![P(X) = 0.5 * (-beta + sqrt(beta^2 - 4 * gamma))](https://latex.codecogs.com/gif.latex?P%28X%29%20%3D%20%5Cfrac%7B-%5Cbeta%20&plus;%20%5Csqrt%7B%5Cbeta%5E2%20-%204%20%5Cgamma%7D%7D%7B2%7D)
122-
* ![beta = -(P(A) + P(C))](https://latex.codecogs.com/gif.latex?%5Cbeta%20%3D%20-%5CBig%28P%28A%29&plus;P%28C%29%5CBig%29)
123-
* ![gamma = 0.5 * (P(A)^2 + P(C)^2 - h^2)](https://latex.codecogs.com/gif.latex?%5Cgamma%20%3D%20%5Cfrac%7BP%28A%29%5E2%20&plus;%20P%28C%29%5E2%20-%20h%5E2%7D%7B2%7D)
124-
* That all looks complicated, and computationally inefficient due to the square root operation. Hence, we calculate a second-degree Taylor series approximation at ![x=P(C)+h/2](https://latex.codecogs.com/gif.latex?x=P(C)&plus;h/2) as
125-
* ![delta = (P(C) - P(A)) / h](https://latex.codecogs.com/gif.latex?%5Cdelta%3D%5Cfrac%7BP%28C%29-P%28A%29%7D%7Bh%7D)
126-
* ![P(X) = P(A) + h (c_2 \delta^2 + c_1\delta + c_0)](https://latex.codecogs.com/gif.latex?P%28X%29%20%5Capprox%20P%28A%29%20&plus;%20h%20%28c_2%20%5Cdelta%5E2%20&plus;%20c_1%5Cdelta%20&plus;%20c_0%29)
127-
* ![c_2 = -0.2301, c_1 = 0.5307, c_0 = 0.7040](https://latex.codecogs.com/gif.latex?c_2%20%3D%20-0.2301%2C%20c_1%20%3D%200.5307%2C%20c_0%20%3D%200.7040)
128-
* You can compare the two curves on [this plot](https://www.desmos.com/calculator/axz378nfqg)
129-
130-
It is this final approximation that we use in our potential calculation. Although these constants have been used
121+
* ![P(X) = \frac{-\beta + \sqrt{\beta^2 - 4 \gamma}}{2}](doc/PX_frac_beta_sqrtbeta_2_4gamma2.gif)
122+
* ![\beta = -\Big(P(A)+P(C)\Big)](doc/beta__BigPA_PCBig.gif)
123+
* ![\gamma = \frac{P(A)^2 + P(C)^2 - h^2}{2}](doc/gamma_fracPA_2_PC_2_h_22.gif)
124+
* That all looks complicated, and computationally inefficient due to the square root operation. Hence, we reformulate the equation in terms of a new variable ![\delta](doc/delta.gif) and calculate a second-degree Taylor series approximation as
125+
* ![\delta = \frac{P(C) - P(A)}{h}](doc/delta_fracPC_PAh.gif)
126+
* ![P(X) = P(A) + \frac{h}{2} (\delta + \sqrt{2-\delta^2})](doc/PX_PA_frach2delta_sqrt2_delta_2.gif)
127+
* ![P(X) \approx P(A) + h (c_2 \delta^2 + c_1\delta + c_0)](doc/PXapproxPA_hc_2delta_2_c_1delta_c_0.gif)
128+
* If you're really interested, you can look into the [full derivation](Derivation.md)
129+
* You can compare these equations on [this plot](https://www.desmos.com/calculator/p7x6d0kg6t)
130+
131+
It is this final approximation that we use in our potential calculation. Although this method has been used
131132
[since the origins of the nav stack](https://github.com/ros-planning/navigation/blob/1f335323a605b49b4108a845c55a7c1ba93a6f2e/navfn/src/navfn.cpp#L509),
132133
this is likely the first time the meaning of the constants has ever been documented.
133134

1.42 KB
Loading
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Full Derivation
2+
We start with our basic equation definitions.
3+
* !eq[P(X) = \frac{-\beta + \sqrt{\beta^2 - 4 \gamma}}{2}]
4+
* !eq[\beta = -\Big(P(C) + P(A)\Big)]
5+
* !eq[\gamma = \frac{P(A)^2 + P(C)^2 - h^2}{2}]
6+
7+
## Reformulate
8+
First we want to reformulate in terms of our new !eq[\delta] variable.
9+
* !eq[\delta = \frac{P(C) - P(A)}{h}]
10+
11+
We can rewrite this so we have a new definition of !eq[P(C)]
12+
* !eq[P(C) = h\delta + P(A)]
13+
14+
This allows us to derive new values for the other equations.
15+
* !eq[\beta = -\Big(P(C) + P(A)\Big)]
16+
* !eq[\beta = -\Big(h\delta + P(A) + P(A)\Big)]
17+
* !eq[\beta = -h\delta - 2 P(A)]
18+
* !eq[\gamma = \frac{P(A)^2 + P(C)^2 - h^2}{2}]
19+
* !eq[\gamma = \frac{P(A)^2 + \Big(P(A)+h\delta\Big)^2 - h^2}{2}]
20+
* !eq[\gamma = P(A)^2 + h\delta P(A) + \frac{h^2\delta^2 - h^2}{2}]
21+
* !eq[P(X) = \frac{-\beta + \sqrt{\beta^2 - 4 \gamma}}{2}]
22+
* !eq[P(X) = \frac{-(-h\delta - 2 P(A)) + \sqrt{\Big(-h\delta - 2 P(A)\Big)^2 - 4 \Big(P(A)^2 + h\delta P(A) + \frac{h^2\delta^2 - h^2}{2}\Big)}}{2}]
23+
* !eq[P(X) = \frac{h\delta + 2 P(A) + \sqrt{\Big(-h\delta - 2 P(A)\Big)^2 - 4 P(A)^2 -4 h\delta P(A) - 2h^2\delta^2 + 2h^2}}{2}]
24+
* !eq[P(X) = \frac{h\delta + 2 P(A) + \sqrt{4P(A)^2 + 4h\delta P(A) + h^2\delta^2 - 4 P(A)^2 -4 h\delta P(A) - 2h^2\delta^2 + 2h^2}}{2}]
25+
* !eq[P(X) = \frac{h\delta + 2 P(A) + \sqrt{-h^2\delta^2 + 2h^2}}{2}]
26+
* !eq[P(X) = P(A) + \frac{h}{2} \Big(\delta + \sqrt{2-\delta^2}\Big)]
27+
28+
We're going to call this a new function !eq[f(\delta)], so now !eq[P(X)] is in terms of !eq[f(\delta)]
29+
* !eq[f(\delta) = P(A) + \frac{h}{2} \Big(\delta + \sqrt{2-\delta^2}\Big)]
30+
31+
## Taylor Series Expansion
32+
For computational efficiency, we are going to compute the Taylor series expansion. So first, we'll need the derivatives of !eq[f(\delta)].
33+
* !eq[f'(\delta) = \frac{h}{2} (1 - \frac{\delta}{\sqrt{2-\delta^2}})]
34+
* !eq[f''(\delta) = \frac{-h}{(2-\delta^2)^\frac{3}{2}}]
35+
36+
### 0th Order Taylor
37+
* !eq[f_0(\delta, a) = f(a)]
38+
* !eq[f_0(\delta, a) = P(A) + \frac{h}{2} \Big(a + \sqrt{2-a^2}\Big)]
39+
40+
### 1st Order Taylor
41+
* !eq[f_1(\delta, a) = f(a) + f'(a) (\delta - a)]
42+
* !eq[f_1(\delta, a) = P(A) + \frac{h}{2} \Big(a + \sqrt{2-a^2}\Big) + \frac{h}{2} (1 - \frac{a}{\sqrt{2-a^2}}) (\delta - a)]
43+
* !eq[f_1(\delta, a) = P(A) + \frac{h}{2} \Big(a + \sqrt{2-a^2} + (1 - \frac{a}{\sqrt{2-a^2}}) (\delta - a)\Big)]
44+
* !eq[f_1(\delta, a) = P(A) + \frac{h}{2} \Big(a + \sqrt{2-a^2} + \delta - a - \frac{a\delta}{\sqrt{2-a^2}} + \frac{a^2}{\sqrt{2-a^2}}\Big)]
45+
* !eq[f_1(\delta, a) = P(A) + \frac{h}{2} \Big(\delta - \frac{a\delta}{\sqrt{2-a^2}} + \sqrt{2-a^2} + \frac{a^2}{\sqrt{2-a^2}}\Big)]
46+
* !eq[f_1(\delta, a) = P(A) + \frac{h}{2} \Big(\delta - \frac{a\delta}{\sqrt{2-a^2}} + \frac{2}{\sqrt{2-a^2}}\Big)]
47+
48+
### 2nd Order Taylor
49+
* !eq[f_2(\delta, a) = f(a) + f'(a) (\delta - a) + \frac{f''(a)}{2!}(\delta - a)^2]
50+
* !eq[f_2(\delta, a) = f_1(\delta, a) + \frac{1}{2} \frac{-h}{(2-a^2)^\frac{3}{2}} (\delta - a)^2]
51+
* !eq[f_2(\delta, a) = f_1(\delta, a) + \frac{h}{2} \frac{-1}{(2-a^2)^\frac{3}{2}} (\delta^2 - 2\delta a + a^2)]
52+
* !eq[f_2(\delta, a) = P(A) + \frac{h}{2} \Big(\delta - \frac{a\delta}{\sqrt{2-a^2}} + \frac{2}{\sqrt{2-a^2}}\Big) + \frac{h}{2} \frac{-1}{(2-a^2)^\frac{3}{2}} (\delta^2 - 2\delta a + a^2)]
53+
* !eq[f_2(\delta, a) = P(A) + \frac{h}{2} \Big(\delta - \frac{a\delta}{\sqrt{2-a^2}} + \frac{2}{\sqrt{2-a^2}} + \frac{-1}{(2-a^2)^\frac{3}{2}} (\delta^2 - 2\delta a + a^2)\Big)]
54+
* !eq[f_2(\delta, a) = P(A) + h\Big(c_0(a) + c_1(a)\delta + c_2(a) \delta^2\Big)]
55+
* !eq[c_0(a) = \frac{1}{2}\Big(\frac{2}{\sqrt{2-a^2}} - \frac{a^2}{(2-a^2)^\frac{3}{2}}\Big)]
56+
* !eq[c_0(a) = \frac{4 - 3a^2}{2(2-a^2)^\frac{3}{2}}]
57+
58+
* !eq[c_1(a) = \frac{1}{2}\Big(1 - \frac{a}{\sqrt{2-a^2}} + \frac{2a}{(2-a^2)^\frac{3}{2}} \Big)]
59+
* !eq[c_2(a) = \frac{-1}{2(2-a^2)^\frac{3}{2}}]
60+
61+
## Exact coefficients
62+
Now that we have the general equations for the Taylor series, we can evaluate it at different values of a in the range `[0, 1]`.
63+
64+
| !eq[a] | !eq[c_0(a)] | !eq[c_1(a)] | !eq[c_2(a)] |
65+
| ------ | ----------- | ----------- | ----------- |
66+
| 0.0 | 0.7071 | 0.5000 | -0.1768 |
67+
| 0.5 | 0.7019 | 0.5270 | -0.2160 |
68+
| 1.0 | 0.5000 | 1.0000 | -0.5000 |
69+
70+
Historically, the values used by [`navfn`](https://github.com/ros-planning/navigation/blob/1f335323a605b49b4108a845c55a7c1ba93a6f2e/navfn/src/navfn.cpp#L509) are
71+
72+
| !eq[c_0] | !eq[c_1] | !eq[c_2] |
73+
| ----------- | ----------- | ----------- |
74+
| 0.7040 | 0.5307 | -0.2301 |
75+
76+
You can see these values plotted [here](https://www.desmos.com/calculator/vbpkey1mt6).
77+
78+
The historical values are pretty close to the values for !eq[\delta=0.5], although the exact reason for the difference is unknown, but its close enough to not be overly concerning.

dlux_global_planner/doc/PA__PB.gif

523 Bytes
Loading

dlux_global_planner/doc/PA__PC.gif

518 Bytes
Loading

dlux_global_planner/doc/PC.gif

283 Bytes
Loading
581 Bytes
Loading

dlux_global_planner/doc/PC__PD.gif

520 Bytes
Loading
624 Bytes
Loading

0 commit comments

Comments
 (0)