Skip to content

Commit 0b6c8c7

Browse files
committed
create
0 parents  commit 0b6c8c7

23 files changed

+1070
-0
lines changed

README.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
## Waypoints Adjuster
2+
3+
Given the waypoints as in csv file with the 1st two columns representing x and y coordinates, the python script is capable to readjust the waypoints such that the heading and curvature become smoother.
4+
5+
Details are as follows:
6+
7+
8+
9+
The original waypoint data used for path following is very rugged, as shown below. It appears the oscillations are a lot.
10+
11+
| raw waypoints (x, y) | zoom of waypoints |
12+
| --------------------------------- | ------------------------ |
13+
| ![](./pics/f1_rawxy_unzoomed.png) | ![](./pics/f1_rawxy.png) |
14+
15+
A python script `wpProcess.py` is written to preprocess the data. The waypoints are first scattered to evenly distributed with a constant gap (default = 1 m). The program also creates a new csv file to contain the processed result.
16+
17+
1. The scattered process is done first. The heading angles calculated from these evenly distributed waypoints are also shown (right plot, green dots, ignore )
18+
19+
| evenly scattered waypoints | heading angles |
20+
| -------------------------- | --------------------------------- |
21+
| ![](./pics/f2_xy.png) | ![](./pics/f2_th_from_xy_ds1.png) |
22+
23+
2. The curvature values at these evenly distributed waypoints were calcualted and smoothed using a Savitzky-Golay filter. Comparisons before and after applying this filter can be seen below:
24+
25+
![](./pics/f3_curvature.png)
26+
27+
3. The steps following is similar to the paper (
28+
29+
[S. Thrun. Stanley: The Autonomous Car that Won the DARPA challenge]: https://onlinelibrary.wiley.com/doi/abs/10.1002/rob.20147
30+
31+
) to further choose and adjust the waypoints' positions. Redistribute the waypoints proportional to the curvature radius calculated in step 2. The algorithm starts from one end, try the initial max length first, if in this range no curvature value exceeds the value matched for this length in the chart below, then take the new point and find the
32+
next one; otherwise use binary search until it's satisfied.
33+
34+
The relationship of the segment length and the curvature radius can be expressed as:
35+
36+
*ds* = 0.1\*radius, and limited within \[1, 16\] m
37+
38+
| curvature | radius [m] | *ds* [m] |
39+
| --------- | ---------- | -------- |
40+
| >0.1 | <10 | 1 |
41+
| 0.1 | 10 | 1 |
42+
| 0.05 | 20 | 2 |
43+
| 0.01 | 100 | 10 |
44+
| <1/160 | >160 | 16 |
45+
46+
​ The result after applying this redistribution algorithm is shown below with the example. It can be seen that this distribution is more reasonable by putting more waypoints at large curvature to describe the path.
47+
48+
| redistributed waypoints | curvature after redistribution |
49+
| ----------------------------- | ------------------------------- |
50+
| ![](./pics/f3_xy_density.png) | ![](./pics/f3_curv_density.png) |
51+
52+
​ The length of each segment is printed out as below. It can be seen that the algorithm successfully distribute the waypoint numbers proportional to the curvature radius. And from the curvature plot from the above right plot, it appears appropriate of this re-distribution to better describe curvature and smoothness.
53+
54+
```cmd
55+
ds = 8.0
56+
57+
16.0
58+
59+
16.0
60+
61+
16.0
62+
63+
16.0
64+
65+
8.0
66+
67+
2.0
68+
69+
2.0
70+
71+
1.0
72+
73+
1.0
74+
75+
1.0
76+
77+
1.0
78+
79+
1.0
80+
81+
1.0
82+
83+
1.0
84+
85+
2.0
86+
87+
16.0
88+
89+
8.65849505794
90+
```
91+
92+
4. Readjust the waypoints' positions from step 3 to reduce the heading changes in between neighboring waypoints. The optimization is used to penalize two items. One is the heading changes between neighboring waypoints. The other is the deviation from orignal waypoints. Results are shown below. See how the heading angles are smoothed through this process.
93+
94+
| Adjusted waypoionts after optimization | Heading angles after optimization |
95+
| -------------------------------------- | --------------------------------- |
96+
| ![](./pics/f4_xy_smth.png) | ![](./pics/f4_th_smth.png) |
97+

README.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
Files content
3+
4+
- wpProcess.py: pre-process the unsmoothed waypoints (including methods such as scatter evenly distributed, smooth and realignment)
5+
6+
7+
8+
9+
- smooth the path, make comparisons with existing ones.
10+
11+
- improve the ros package on path following, may use MPC following as well...
12+
13+
14+
15+

pics/.~lock.update.odt#

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
,codezs09,t450s,03.03.2020 14:47,file:///home/codezs09/.config/libreoffice/4;

pics/f1_rawth.png

19.2 KB
Loading

pics/f1_rawxy.png

20.7 KB
Loading

pics/f1_rawxy_unzoomed.png

21.4 KB
Loading

pics/f1_ros_wpupdate_markers.png

291 KB
Loading

pics/f2_th.png

26.8 KB
Loading

pics/f2_th_from_xy_ds1.png

37.6 KB
Loading

pics/f2_xy.png

24.6 KB
Loading

0 commit comments

Comments
 (0)