Skip to content

Commit d7060f6

Browse files
videh25Videh Patel
and
Videh Patel
authored
Reopen: Added missing path types (AtsushiSakai#949)
* added missing RS path types * modified assert condition in test3 * removed linting errors * added sign check to avoid non RS paths * Mathematical description of RS curves * Undid debugging changes * Added large step_size consideration * renamed test3 to test_too_big_step_size --------- Co-authored-by: Videh Patel <[email protected]>
1 parent 49ae54a commit d7060f6

15 files changed

+586
-115
lines changed

PathPlanning/ReedsSheppPath/reeds_shepp_path_planning.py

+209-111
Large diffs are not rendered by default.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

docs/modules/path_planning/reeds_shepp_path/reeds_shepp_path_main.rst

+375
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,381 @@ A sample code with Reeds Shepp path planning.
55

66
.. image:: https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathPlanning/ReedsSheppPath/animation.gif?raw=true
77

8+
Mathematical Description of Individual Path Types
9+
=================================================
10+
Here is an overview of mathematical derivations of formulae for individual path types.
11+
12+
In all the derivations below, radius of curvature of the vehicle is assumed to be of unit length and start pose is considered to be at origin. (*In code we are removing the offset due to start position and normalising the lengths before passing the values to these functions.*)
13+
14+
Also, (t, u, v) respresent the measure of each motion requried. Thus, in case of a turning maneuver, they represent the angle inscribed at the centre of turning circle and in case of straight maneuver, they represent the distance to be travelled.
15+
16+
1. **Left-Straight-Left**
17+
18+
.. image:: LSL.png
19+
20+
We can deduce the following facts using geometry.
21+
22+
- AGHC is a rectangle.
23+
- :math:`∠LAC = ∠BAG = t`
24+
- :math:`t + v = φ`
25+
- :math:`C(x - sin(φ), y + cos(φ))`
26+
- :math:`A(0, 1)`
27+
- :math:`u, t = polar(vector<AC>)`
28+
29+
Hence, we have:
30+
31+
- :math:`u, t = polar(x - sin(φ), y + cos(φ) - 1)`
32+
- :math:`v = φ - t`
33+
34+
35+
2. **Left-Straight-Right**
36+
37+
.. image:: LSR.png
38+
39+
With followng notations:
40+
41+
- :math:`∠MBD = t1`
42+
- :math:`∠BDF = θ`
43+
- :math:`BC = u1`
44+
45+
We can deduce the following facts using geometry.
46+
47+
- D is mid-point of BC and FG.
48+
- :math:`t - v = φ`
49+
- :math:`C(x + sin(φ), y - cos(φ))`
50+
- :math:`A(0, 1)`
51+
- :math:`u1, t1 = polar(vector<AC>)`
52+
- :math:`\frac{u1^2}{4} = 1 + \frac{u^2}{4}`
53+
- :math:`BF = 1` [Radius Of Curvature]
54+
- :math:`FD = \frac{u}{2}`
55+
- :math:`θ = arctan(\frac{BF}{FD})`
56+
- :math:`t1 + θ = t`
57+
58+
Hence, we have:
59+
60+
- :math:`u1, t1 = polar(x + sin(φ), y - cos(φ) - 1)`
61+
- :math:`u = \sqrt{u1^2 - 4}`
62+
- :math:`θ = arctan(\frac{2}{u})`
63+
- :math:`t = t1 + θ`
64+
- :math:`v = t - φ`
65+
66+
3. **LeftxRightxLeft**
67+
68+
.. image:: L_R_L.png
69+
70+
With followng notations:
71+
72+
- :math:`∠CBD = ∠CDB = A` [BCD is an isoceles triangle]
73+
- :math:`∠DBK = θ`
74+
- :math:`BD = u1`
75+
76+
We can deduce the following facts using geometry.
77+
78+
- :math:`t + u + v = φ`
79+
- :math:`D(x - sin(φ), y + cos(φ))`
80+
- :math:`B(0, 1)`
81+
- :math:`u1, θ = polar(vector<BD>)`
82+
- :math:`A = arccos(\frac{BD/2}{CD})`
83+
- :math:`u = (π - 2*A)`
84+
- :math:`∠ABK = \frac{π}{2}`
85+
- :math:`∠KBD = θ`
86+
- :math:`t = ∠ABK + ∠KBD + ∠DBC`
87+
88+
Hence, we have:
89+
90+
- :math:`u1, θ = polar(x - sin(φ), y + cos(φ) - 1)`
91+
- :math:`A = arccos(\frac{u1/2}{2})`
92+
- :math:`t = \frac{π}{2} + θ + A`
93+
- :math:`u = (π - 2*A)`
94+
- :math:`v = (φ - t - u)`
95+
96+
4. **LeftxRight-Left**
97+
98+
.. image:: L_RL.png
99+
100+
With followng notations:
101+
102+
- :math:`∠CBD = ∠CDB = A` [BCD is an isoceles triangle]
103+
- :math:`∠DBK = θ`
104+
- :math:`BD = u1`
105+
106+
We can deduce the following facts using geometry.
107+
108+
- :math:`t + u - v = φ`
109+
- :math:`D(x - sin(φ), y + cos(φ))`
110+
- :math:`B(0, 1)`
111+
- :math:`u1, θ = polar(vector<BD>)`
112+
- :math:`A = arccos(\frac{BD/2}{CD})`
113+
- :math:`u = (π - 2*A)`
114+
- :math:`∠ABK = \frac{π}{2}`
115+
- :math:`∠KBD = θ`
116+
- :math:`t = ∠ABK + ∠KBD + ∠DBC`
117+
118+
Hence, we have:
119+
120+
- :math:`u1, θ = polar(x - sin(φ), y + cos(φ) - 1)`
121+
- :math:`A = arccos(\frac{u1/2}{2})`
122+
- :math:`t = \frac{π}{2} + θ + A`
123+
- :math:`u = (π - 2*A)`
124+
- :math:`v = (-φ + t + u)`
125+
126+
5. **Left-RightxLeft**
127+
128+
.. image:: LR_L.png
129+
130+
With followng notations:
131+
132+
- :math:`∠CBD = ∠CDB = A` [BCD is an isoceles triangle]
133+
- :math:`∠DBK = θ`
134+
- :math:`BD = u1`
135+
136+
We can deduce the following facts using geometry.
137+
138+
- :math:`t - u - v = φ`
139+
- :math:`D(x - sin(φ), y + cos(φ))`
140+
- :math:`B(0, 1)`
141+
- :math:`u1, θ = polar(vector<BD>)`
142+
- :math:`BC = CD = 2` [2 * radius of curvature]
143+
- :math:`cos(2π - u) = \frac{BC^2 + CD^2 - BD^2}{2 * BC * CD}` [Cosine Rule]
144+
- :math:`\frac{sin(A)}{BC} = \frac{sin(u)}{u1}` [Sine Rule]
145+
- :math:`∠ABK = \frac{π}{2}`
146+
- :math:`∠KBD = θ`
147+
- :math:`t = ∠ABK + ∠KBD - ∠DBC`
148+
149+
Hence, we have:
150+
151+
- :math:`u1, θ = polar(x - sin(φ), y + cos(φ) - 1)`
152+
- :math:`u = arccos(1 - \frac{u1^2}{8})`
153+
- :math:`A = arcsin(\frac{sin(u)}{u1}*2)`
154+
- :math:`t = \frac{π}{2} + θ - A`
155+
- :math:`v = (t - u - φ)`
156+
157+
6. **Left-RightxLeft-Right**
158+
159+
.. image:: LR_LR.png
160+
161+
With followng notations:
162+
163+
- :math:`∠CLG = ∠BCL = ∠CBG = ∠LGB = A = u` [BGCL is an isoceles trapezium]
164+
- :math:`∠KBG = θ`
165+
- :math:`BG = u1`
166+
167+
We can deduce the following facts using geometry.
168+
169+
- :math:`t - 2u + v = φ`
170+
- :math:`G(x + sin(φ), y - cos(φ))`
171+
- :math:`B(0, 1)`
172+
- :math:`u1, θ = polar(vector<BG>)`
173+
- :math:`BC = CL = LG = 2` [2 * radius of curvature]
174+
- :math:`CG^2 = CL^2 + LG^2 - 2*CL*LG*cos(A)` [Cosine rule in LGC]
175+
- :math:`CG^2 = CL^2 + LG^2 - 2*CL*LG*cos(A)` [Cosine rule in LGC]
176+
- From the previous two equations: :math:`A = arccos(\frac{u1 + 2}{4})`
177+
- :math:`∠ABK = \frac{π}{2}`
178+
- :math:`t = ∠ABK + ∠KBG + ∠GBC`
179+
180+
Hence, we have:
181+
182+
- :math:`u1, θ = polar(x + sin(φ), y - cos(φ) - 1)`
183+
- :math:`u = arccos(\frac{u1 + 2}{4})`
184+
- :math:`t = \frac{π}{2} + θ + u`
185+
- :math:`v = (φ - t + 2u)`
186+
187+
7. **LeftxRight-LeftxRight**
188+
189+
.. image:: L_RL_R.png
190+
191+
With followng notations:
192+
193+
- :math:`∠GBC = A` [BGCL is an isoceles trapezium]
194+
- :math:`∠KBG = θ`
195+
- :math:`BG = u1`
196+
197+
We can deduce the following facts using geometry.
198+
199+
- :math:`t - v = φ`
200+
- :math:`G(x + sin(φ), y - cos(φ))`
201+
- :math:`B(0, 1)`
202+
- :math:`u1, θ = polar(vector<BG>)`
203+
- :math:`BC = CL = LG = 2` [2 * radius of curvature]
204+
- :math:`CD = 1` [radius of curvature]
205+
- D is midpoint of BG
206+
- :math:`BD = \frac{u1}{2}`
207+
- :math:`cos(u) = \frac{BC^2 + CD^2 - BD^2}{2*BC*CD}` [Cosine rule in BCD]
208+
- :math:`sin(A) = CD*\frac{sin(u)}{BD}` [Sine rule in BCD]
209+
- :math:`∠ABK = \frac{π}{2}`
210+
- :math:`t = ∠ABK + ∠KBG + ∠GBC`
211+
212+
Hence, we have:
213+
214+
- :math:`u1, θ = polar(x + sin(φ), y - cos(φ) - 1)`
215+
- :math:`u = arccos(\frac{20 - u1^2}{16})`
216+
- :math:`A = arcsin(2*\frac{sin(u)}{u1})`
217+
- :math:`t = \frac{π}{2} + θ + A`
218+
- :math:`v = (t - φ)`
219+
220+
221+
8. **LeftxRight90-Straight-Left**
222+
223+
.. image:: L_R90SL.png
224+
225+
With followng notations:
226+
227+
- :math:`∠FBM = A` [BGCL is an isoceles trapezium]
228+
- :math:`∠KBF = θ`
229+
- :math:`BF = u1`
230+
231+
We can deduce the following facts using geometry.
232+
233+
- :math:`t + \frac{π}{2} - v = φ`
234+
- :math:`F(x - sin(φ), y + cos(φ))`
235+
- :math:`B(0, 1)`
236+
- :math:`u1, θ = polar(vector<BF>)`
237+
- :math:`BM = CB = 2` [2 * radius of curvature]
238+
- :math:`MD = CD = 1` [CGDM is a rectangle]
239+
- :math:`MC = GD = u` [CGDM is a rectangle]
240+
- :math:`MF = MD + DF = 2`
241+
- :math:`BM = \sqrt{BF^2 - MF^2}` [Pythagoras theorem on BFM]
242+
- :math:`tan(A) = \frac{MF}{BM}`
243+
- :math:`u = MC = BM - CB`
244+
- :math:`t = ∠ABK + ∠KBF + ∠FBC`
245+
246+
Hence, we have:
247+
248+
- :math:`u1, θ = polar(x - sin(φ), y + cos(φ) - 1)`
249+
- :math:`u = arccos(\sqrt{u1^2 - 4} - 2)`
250+
- :math:`A = arctan(\frac{2}{\sqrt{u1^2 - 4}})`
251+
- :math:`t = \frac{π}{2} + θ + A`
252+
- :math:`v = (t - φ + \frac{π}{2})`
253+
254+
255+
9. **Left-Straight-Right90xLeft**
256+
257+
.. image:: LSR90_L.png
258+
259+
With followng notations:
260+
261+
- :math:`∠MBH = A` [BGCL is an isoceles trapezium]
262+
- :math:`∠KBH = θ`
263+
- :math:`BH = u1`
264+
265+
We can deduce the following facts using geometry.
266+
267+
- :math:`t - \frac{π}{2} - v = φ`
268+
- :math:`H(x - sin(φ), y + cos(φ))`
269+
- :math:`B(0, 1)`
270+
- :math:`u1, θ = polar(vector<BH>)`
271+
- :math:`GH = 2` [2 * radius of curvature]
272+
- :math:`CM = DG = 1` [CGDM is a rectangle]
273+
- :math:`CD = MG = u` [CGDM is a rectangle]
274+
- :math:`BM = BC + CM = 2`
275+
- :math:`MH = \sqrt{BH^2 - BM^2}` [Pythagoras theorem on BHM]
276+
- :math:`tan(A) = \frac{HM}{BM}`
277+
- :math:`u = MC = BM - CB`
278+
- :math:`t = ∠ABK + ∠KBH - ∠HBC`
279+
280+
Hence, we have:
281+
282+
- :math:`u1, θ = polar(x - sin(φ), y + cos(φ) - 1)`
283+
- :math:`u = arccos(\sqrt{u1^2 - 4} - 2)`
284+
- :math:`A = arctan(\frac{2}{\sqrt{u1^2 - 4}})`
285+
- :math:`t = \frac{π}{2} + θ - A`
286+
- :math:`v = (t - φ - \frac{π}{2})`
287+
288+
289+
10. **LeftxRight90-Straight-Right**
290+
291+
.. image:: L_R90SR.png
292+
293+
With followng notations:
294+
295+
- :math:`∠KBG = θ`
296+
- :math:`BG = u1`
297+
298+
We can deduce the following facts using geometry.
299+
300+
- :math:`t - \frac{π}{2} - v = φ`
301+
- :math:`G(x + sin(φ), y - cos(φ))`
302+
- :math:`B(0, 1)`
303+
- :math:`u1, θ = polar(vector<BG>)`
304+
- :math:`BD = 2` [2 * radius of curvature]
305+
- :math:`DG = EF = u` [DGFE is a rectangle]
306+
- :math:`DG = BG - BD = 2`
307+
- :math:`∠ABK = \frac{π}{2}`
308+
- :math:`t = ∠ABK + ∠KBG`
309+
310+
Hence, we have:
311+
312+
- :math:`u1, θ = polar(x + sin(φ), y - cos(φ) - 1)`
313+
- :math:`u = u1 - 2`
314+
- :math:`t = \frac{π}{2} + θ`
315+
- :math:`v = (t - φ - \frac{π}{2})`
316+
317+
318+
11. **Left-Straight-Left90xRight**
319+
320+
.. image:: LSL90xR.png
321+
322+
With followng notations:
323+
324+
- :math:`∠KBH = θ`
325+
- :math:`BH = u1`
326+
327+
We can deduce the following facts using geometry.
328+
329+
- :math:`t + \frac{π}{2} + v = φ`
330+
- :math:`H(x + sin(φ), y - cos(φ))`
331+
- :math:`B(0, 1)`
332+
- :math:`u1, θ = polar(vector<BH>)`
333+
- :math:`GH = 2` [2 * radius of curvature]
334+
- :math:`DC = BG = u` [DGBC is a rectangle]
335+
- :math:`BG = BH - GH`
336+
- :math:`∠ABC= ∠KBH`
337+
338+
Hence, we have:
339+
340+
- :math:`u1, θ = polar(x + sin(φ), y - cos(φ) - 1)`
341+
- :math:`u = u1 - 2`
342+
- :math:`t = θ`
343+
- :math:`v = (φ - t - \frac{π}{2})`
344+
345+
346+
12. **LeftxRight90-Straight-Left90xRight**
347+
348+
.. image:: L_R90SL90_R.png
349+
350+
With followng notations:
351+
352+
- :math:`∠KBH = θ`
353+
- :math:`∠HBM = A`
354+
- :math:`BH = u1`
355+
356+
We can deduce the following facts using geometry.
357+
358+
- :math:`t - v = φ`
359+
- :math:`H(x + sin(φ), y - cos(φ))`
360+
- :math:`B(0, 1)`
361+
- :math:`u1, θ = polar(vector<BH>)`
362+
- :math:`GF = ED = 1` [radius of curvature]
363+
- :math:`BD = GH = 2` [2 * radius of curvature]
364+
- :math:`FN = GH = 2` [ENMD is a rectangle]
365+
- :math:`NH = GF = 1` [FNHG is a rectangle]
366+
- :math:`MN = ED = 1` [ENMD is a rectangle]
367+
- :math:`DO = EF = u` [DOFE is a rectangle]
368+
- :math:`MH = MN + NH = 2`
369+
- :math:`BM = \sqrt{BH^2 - MH^2}` [Pythagoras theorem on BHM]
370+
- :math:`DO = BM - BD - OM`
371+
- :math:`tan(A) = \frac{MH}{BM}`
372+
- :math:`∠ABC = ∠ABK + ∠KBH + ∠HBM`
373+
374+
Hence, we have:
375+
376+
- :math:`u1, θ = polar(x + sin(φ), y - cos(φ) - 1)`
377+
- :math:`u = /sqrt{u1^2 - 4} - 4`
378+
- :math:`A = arctan(\frac{2}{u1^2 - 4})`
379+
- :math:`t = \frac{π}{2} + θ + A`
380+
- :math:`v = (t - φ)`
381+
382+
8383
Ref:
9384

10385
- `15.3.2 Reeds-Shepp

0 commit comments

Comments
 (0)