@@ -4,6 +4,104 @@ Pure pursuit tracking
44Path tracking simulation with pure pursuit steering control and PID
55speed control.
66
7+ .. raw :: latex
8+ \usepackage {tikz }
9+ \usetikzlibrary {shapes.misc, shadows, calc, positioning, backgrounds}
10+ \usepackage [margin=1cm ]{geometry } % 调整页面边距
11+
12+ \begin {document }
13+
14+ \begin {figure }[htbp]
15+ \c entering
16+ \b egin{tikzpicture}[line width=1.7pt, scale=0.6, every node/.style={scale=0.6}] % 缩放图形
17+
18+ \p gfmathsetmacro{\d ist}{3}
19+ \p gfmathsetmacro{\d eltavar}{11.3}
20+ \p gfmathsetmacro{\a x}{tan(90-\d eltavar)*\d ist*(-1)}
21+ \p gfmathsetmacro{\l ookahead}{12}
22+ \p gfmathsetmacro{\c s}{17}
23+ \p gfmathsetmacro{\c sb}{4}
24+
25+ \p ath[clip] (-\c s,-\c sb)--(-\c s,\c s)--(\c s,\c s)--(\c s, -\c sb) --cycle;
26+
27+ % NODES
28+ \n ode(tire1)[draw=blue, thick, fill=white,
29+ shape=rounded rectangle,
30+ drop shadow={opacity=.5,shadow xshift=0pt},
31+ minimum width=1.8cm,
32+ minimum height=0.5cm,
33+ line width =2,
34+ rotate=90] at (0,0) {};
35+
36+ \n ode(tire2)[draw=blue, thick, fill=white,
37+ shape=rounded rectangle,
38+ drop shadow={opacity=.5,shadow xshift=0pt},
39+ minimum width=1.8cm,
40+ minimum height=0.5cm,
41+ line width =2,
42+ rotate=\d eltavar-90] at (0,\d ist) {};
43+
44+ \n ode(triangle_left) at (\a x,0){};
45+
46+ % TRIANGLE
47+ \d raw[line width=2, color=blue] (tire1.center) -- (tire2.center);
48+ \d raw[dashed] (triangle_left.center) -- (tire2.center);
49+ \d raw[dashed] (triangle_left.center) -- (tire1.center);
50+
51+ % length R and L
52+ \d raw[<->] (\a x, -1) -- (0,-1) node[midway, fill=white] {\H uge $R$};
53+ \d raw[<->] (\l ookahead, 0) -- (0,0) node[midway, fill=white] {\H uge $l_d$};
54+
55+ % angle delta top
56+ \d raw[dashed] (0, \d ist) -- (0,\d ist+6);
57+ \d raw[dashed] (0, \d ist) -- ({-sin(\d eltavar)*6},{\d ist+6)});
58+ \d raw[color=black] (0,\d ist+3.3) arc (90:90+\d eltavar:3.3);
59+ \d raw (-0.27, \d ist+2.9) node[black] {\H uge $\d elta$};
60+
61+ % angle delta left
62+ \d raw[color=black] ({\a x+2.7},0) arc (0:1.3*\d eltavar:2);
63+ \d raw (\a x+1.9, 0.85) node[black] {\H uge $\d elta$};
64+
65+ % circle
66+ \d raw[ ->, orange, line width=3] (0,0) arc (0:70:-\a x);
67+
68+ % circle LookAhead
69+ \d raw[ ->, dotted] (\l ookahead,0) arc (0:360:\l ookahead);
70+
71+ % ICR
72+ \n ode[red](ICR) at (\a x,0.5)[above]{\H uge Center of Rotation};
73+ \d raw[red, fill] (triangle_left) circle(0.13);
74+
75+ % PATH
76+ \d raw[green!80!gray, line width =3](1, -6) --(0,-3) -- (-0.5, -1) -- (-1,0) -- (-1.5,1) -- (-2,2) -- (-3, 8) -- (-6,13) ;
77+ \n ode[green!80!gray] at (0.6,-2.6)[right=-0.4]{\H uge path};
78+
79+ % target
80+ \n ode[red] at (-4.8,11)[above right=0.5 and -0.1]{\H uge Target Point};
81+ \d raw[red, fill] (-4.8,11) circle(0.13);
82+
83+ % magenta triangle
84+ \d raw[magenta, line width=3] (0,0) -- (triangle_left) -- (-4.8,11) -- (0,0);
85+
86+ % angle \g amma_1
87+ \d raw[color=magenta, line width=3] ({\a x+5},0) arc (0:47:5);
88+ \d raw (-11.2,1.5) node[magenta] {\H uge $\g amma_1$};
89+
90+ % gamma_2
91+ \d raw[color=magenta, line width=3] (-3.6, 8.2) arc (290:226:3.05);
92+ \d raw (-5, 9.2) node[magenta] {\H uge $\g amma_2$};
93+
94+ % gamma bottom
95+ \d raw[color=magenta, line width=3] (-4.5,0) arc (180:111:4.3);
96+ \d raw (-2.6,1.7) node[magenta] {\H uge $\g amma_3$};
97+
98+ % \a lpha
99+ \d raw[color=magenta, line width=3] (0,8) arc (90:113.2:8);
100+ \d raw (-1.9, 8.6) node[magenta] {\H uge $\a lpha$};
101+
102+ \e nd{tikzpicture}
103+ \end {figure }
104+
7105.. image :: https://github.com/AtsushiSakai/PythonRoboticsGifs/raw/master/PathTracking/pure_pursuit/animation.gif
8106
9107The red line is a target course, the green cross means the target point
0 commit comments