trajectory_supervisor.helper_funcs.src.path_matching module¶
- trajectory_supervisor.helper_funcs.src.path_matching.angle3pt(a: list, b: list, c: list) → float[source]¶
Calculate the angle by turning from coordinate a to c around b.
- Parameters
a – coordinate a (x, y)
b – coordinate b (x, y)
c – coordinate c (x, y)
- Returns
ang - angle between a and c
- Authors
Tim Stahl <tim.stahl@tum.de>
- Created on
25.06.2020
- trajectory_supervisor.helper_funcs.src.path_matching.closest_path_index(path: numpy.ndarray, pos: tuple, n_closest: int = 1) → tuple[source]¶
Return index of n closest coordinates to “pos” in the “path” array.
- Parameters
path – m x 2 array of x-,y-coordinates
pos – reference position
n_closest – (optional) number of closest indexes to be returned
- Returns
idx_array - array of indexes of points closest to ref.-pos (sorted by index nbrs, NOT distance to pos!)
distances2 - squared distances to all path coordinates
- Authors
Tim Stahl <tim.stahl@tum.de>
- Created on
25.06.2020
- trajectory_supervisor.helper_funcs.src.path_matching.get_s_coord(ref_line: numpy.ndarray, pos: tuple, s_array: Optional[numpy.ndarray] = None, only_index=False, closed=False) → tuple[source]¶
Get the s coordinate of a provided coordinate on a provided coordinate and (optional s) array.
- Parameters
ref_line – m x 2 array of x-,y-coordinates
pos – reference position
s_array – matching s values for the provided “ref_line”, if not set: euclidean distances between the points will be calculated
only_index – only return indexes and do not calculate coordinates
closed – boolean flag, set to true if the reference line should be interpreted as a closed line
- Returns
s - interpolated s value of the provided pos
closest_index - index in the ref_line array which is closest to the provided pos
- Authors
Tim Stahl <tim.stahl@tum.de>
- Created on
25.06.2020