Skip to content

Smoothing

chaikins_corner_cutting(polyline, num_refinements=4)

Smoothing algorithm Chaikin's corner cutting

Parameters:

Name Type Description Default
polyline ndarray

(n,2) np.ndarray

required
num_refinements int

number of algorithm loops

4

Returns:

Type Description
ndarray

smoothed polyline as (n,2) np.ndarray

Source code in commonroad_global_planner/utils/smoothing.py
10
11
12
13
14
15
16
17
18
19
def chaikins_corner_cutting(
    polyline: np.ndarray, num_refinements: int = 4
) -> np.ndarray:
    """
    Smoothing algorithm Chaikin's corner cutting
    :param polyline: (n,2) np.ndarray
    :param num_refinements: number of algorithm loops
    :return: smoothed polyline as (n,2) np.ndarray
    """
    return rpccc(polyline=polyline, num_refinements=num_refinements)

elastic_band_smoothing(polyline, max_deviation=0.15)

Smoothing algorithm elastic band

Parameters:

Name Type Description Default
polyline ndarray

(n,2) np.ndarray

required
max_deviation float

maximum lateral deviation for smoothed path

0.15

Returns:

Type Description
ndarray

smoothed polyline as (n,2) np.ndarray

Source code in commonroad_global_planner/utils/smoothing.py
22
23
24
25
26
27
28
29
30
31
32
def elastic_band_smoothing(
    polyline: np.ndarray, max_deviation: float = 0.15
) -> np.ndarray:
    """
    Smoothing algorithm elastic band
    :param polyline: (n,2) np.ndarray
    :param max_deviation: maximum lateral deviation for smoothed path
    :return: smoothed polyline as (n,2) np.ndarray
    """
    x, y = smooth_path_elastic_bands(path=polyline, max_deviation=max_deviation)
    return np.concatenate((x, y), axis=1)