Python Bindings pycrccosy

Segment class

class Segment
__init__(self: commonroad_dc.pycrccosy.Segment, arg0: numpy.ndarray[numpy.float64[2, 1]], arg1: numpy.ndarray[numpy.float64[2, 1]], arg2: numpy.ndarray[numpy.float64[2, 1]], arg3: numpy.ndarray[numpy.float64[2, 1]]) None
Parameters:
  • p_1 – start point of the segment

  • p_2 – end point of the segment

  • t_1 – tangent vector at the start of the segment

  • t_2 – tangent vector at the end of the segment

length(self: commonroad_dc.pycrccosy.Segment) float
Returns:

segment length

normal_segment_end(self: commonroad_dc.pycrccosy.Segment) numpy.ndarray[numpy.float64[2, 1]]
Returns:

normal vector at the end of the segment

normal_segment_start(self: commonroad_dc.pycrccosy.Segment) numpy.ndarray[numpy.float64[2, 1]]
Returns:

normal vector at the start of the segment

pt_1(self: commonroad_dc.pycrccosy.Segment) numpy.ndarray[numpy.float64[2, 1]]
Returns:

start point of segment in Cartesian coordinates

pt_2(self: commonroad_dc.pycrccosy.Segment) numpy.ndarray[numpy.float64[2, 1]]
Returns:

end point of segment in Cartesian coordinates

CurvilinearCoordinateSystem class

class CurvilinearCoordinateSystem
__getstate__(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) tuple
__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[numpy.ndarray[numpy.float64[2, 1]]]) -> None

  2. __init__(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[numpy.ndarray[numpy.float64[2, 1]]], arg1: float, arg2: float) -> None

  3. __init__(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[numpy.ndarray[numpy.float64[2, 1]]], arg1: float, arg2: float, arg3: float) -> None

Creates a curvilinear coordinate system aligned to the given reference path.The unique projection domain along the reference path is automatically computed.The absolute value of the lateral distance of the projection domain border from the reference path islimited to default_projection_domain_limit.To account for numeric imprecisions, the parameter eps reduces the computed lateral distance of theprojection domain border from the reference path.

Parameters:
  • reference_path – 2D polyline in Cartesian coordinates

  • default_projection_domain_limit – maximum absolute distance of the projection domain borderfrom the reference path, defaults to 20

  • eps – reduces the lateral distance of the projection domain border from the reference path, defaults to 0.1

  • eps2 – if nonzero, add additional segments to the beginning (3 segments) and the end (2 segments) of thereference path to enable the conversion of the points near the beginning and the end of the reference path,eps2 defaults to 1e-4.

__setstate__(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: tuple) None
cartesian_point_inside_projection_domain(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: float, arg1: float) bool

Validates if a point in global coordinates is within the unique projection domain of the curvilinear coordinate system.

Parameters:
  • x – x-coordinate in the Cartesian coordinate system

  • y – y-coordinate in the Cartesian coordinate system

Returns:

True if the point is inside or on the boundary of the projection domain, False if the point is outside of the boundary of the projection domain.

compute_and_set_curvature(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, digits: int = 8) int

Automatically computes and sets the curvature information for the reference path.

Parameters:

digits – no. of decimal points for curvature value (default 8)

convert_list_of_points_to_cartesian_coords(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[numpy.ndarray[numpy.float64[2, 1]]], arg1: int) List[numpy.ndarray[numpy.float64[2, 1]]]

Converts list of points to the cartesian coordinate system.

Parameters:
  • points – vector of points in the curvilinear coordinate frame

  • num_omp_threads – number of OMP threads for computation

Returns:

transformed points

convert_list_of_points_to_curvilinear_coords(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[numpy.ndarray[numpy.float64[2, 1]]], arg1: int) List[numpy.ndarray[numpy.float64[2, 1]]]

Converts list of points to the curvilinear coordinate system.

Parameters:
  • points – vector of points in the global coordinate frame

  • num_omp_threads – number of OMP threads for computation

Returns:

transformed points

convert_list_of_polygons_to_curvilinear_coords_and_rasterize(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[List[numpy.ndarray[numpy.float64[2, 1]]]], arg1: List[int], arg2: int, arg3: int) tuple

Transforms polygons in the Cartesian coordinates to the curvilinear coordinates.

Parameters:
  • polygons – list of input polygons

  • groups_of_polygons – group ID (from 0 to num_polygon_groups-1) for each input polygon, list of integers

  • num_polygon_groups – number of polygon groups

  • num_omp_threads – number of OMP threads for parallel computation

Returns:

(list of lists of output polygons, list of lists of rasterized output polygons). Both outermost lists contain lists of output polygons - for each polygon group

convert_rectangle_to_cartesian_coords(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: float, arg1: float, arg2: float, arg3: float) tuple

Transforms a rectangle in the curvilinear coordinates to the Cartesian coordinates. Additionally, a triangle mesh of the resulting polygon is generated.

Parameters:
  • s_lo – minimum longitudinal coordinate of the rectangle

  • s_hi – maximum longitudinal coordinate of the rectangle

  • l_lo – minimum lateral coordinate of the rectangle.

  • l_hi – maximum lateral coordinate of the rectangle

Returns:

(transformed rectangle in Cartesian coordinates, triangle_mesh)

convert_to_cartesian_coords(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: float, arg1: float) numpy.ndarray[numpy.float64[2, 1]]

Transforms a point in the curvilinear coordinate frame to the global coordinate frame.

Parameters:
  • s – longitudinal coordinate

  • l – lateral coordinate

Returns:

point in global coordinates

convert_to_curvilinear_coords(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: float, arg1: float) object

Transforms a Cartesian point to the curvilinear frame.

Parameters:
  • x – x-coordinate in the Cartesian coordinate system

  • y – y-coordinate in the Cartesian coordinate system

Returns:

point in the curvilinear frame.

convert_to_curvilinear_coords_and_get_segment_idx(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: float, arg1: float) list

Transforms a Cartesian point to the curvilinear frame and returns the segment index, in which the point is contained.

Parameters:
  • x – x-coordinate in the Cartesian coordinate system

  • y – y-coordinate in the Cartesian coordinate system

Returns:

(point in the curvilinear frame, segment index in which the point is contained)

curvature_range(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: float, arg1: float) Tuple[float, float]

Returns an interval of the curvatures of the reference path within a given range of longitudinal positions

Parameters:
  • s_min – minimum longitudinal position

  • s_max – maximum longitudinal position

Returns:

enclosing interval of curvature values of the reference path within the range [s_min, s_max]

curvilinear_projection_domain(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) List[numpy.ndarray[numpy.float64[2, 1]]]

Returns the border of the unique projection domain of the curvilinear coordinate system in curvilinear coordinates

Returns:

2D line string representing the border of the projection domain

determine_subset_of_polygon_within_curvilinear_projection_domain(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[numpy.ndarray[numpy.float64[2, 1]]]) List[List[numpy.ndarray[numpy.float64[2, 1]]]]

Computes the parts of a polygon (given in curvilinear coordinates) which are inside the curvilinear projection domain of the curvilinear coordinate system.

Parameters:

polygon – vertices of the boundary of the polygon; vertices must be sorted clockwise and given as closed list (the last vertex must be the same as the first one)

Returns:

parts of the polygon which are inside the curvilinear projection domain.

determine_subset_of_polygon_within_projection_domain(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[numpy.ndarray[numpy.float64[2, 1]]]) List[List[numpy.ndarray[numpy.float64[2, 1]]]]

Computes the parts of a polygon which are inside the unique projection domain of the curvilinear coordinate system.

Parameters:

polygon – vertices of the boundary of the polygon; vertices must be sorted clockwise and given as closed list (the last vertex must be the same as the first one)

Returns:

parts of the polygon which are inside the projection domain.

determine_subsets_of_multi_polygons_within_projection_domain(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[List[numpy.ndarray[numpy.float64[2, 1]]]], arg1: List[int], arg2: int) tuple

Intersects each of the input polygons with the projection domain and returns the result of the intersection.

Parameters:
  • polygons – input list of polygons

  • groups_of_polygons – list of integers (of the same length as the list of input polygons) indicating the integer ID of the polygon group for each input polygon. It is useful because the list of output polygons after the intersection may be shorter and we return the polygon group IDs for each of the output polygons.

  • num_omp_threads – number of OMP threads for parallel computation

Returns:

(list of polygons produced after the intersection, list containing group ID for each of the output polygons).

get_curvature(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) List[float]

Returns the curvature of the reference path as a list.If the returned list is empty, please set the curvature first usingthe member function compute_and_set_curvature().

Returns:

list with curvature of reference path

length(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) float
Returns:

length of the reference path of the curvilinear coordinate system

maximum_curvature(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) float

Returns the maximum curvature along the reference path of the curvilinear coordinate system.

Returns:

maximum curvature

maximum_curvature_radius(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) float

Returns the maximum curvature radius along the reference path of the curvilinear coordinate system

Returns:

maximum curvature radius

minimum_curvature(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) float

Returns the minimum curvature along the reference path of the curvilinear coordinate system.

Returns:

minimum curvature

minimum_curvature_radius(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) float

Returns the minimum curvature radius along the reference path of the curvilinear coordinate system

Returns:

minimum curvature radius

normal(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: float) numpy.ndarray[numpy.float64[2, 1]]

Normal vector at a specific longitudinal coordinate.

Parameters:

s – longitudinal coordinate.

Returns:

normal vector

projection_domain(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) List[numpy.ndarray[numpy.float64[2, 1]]]

Returns the border of the unique projection domain of the curvilinear coordinate system in Cartesian coordinates

Returns:

2D line string representing the border of the projection domain

reference_path(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) List[numpy.ndarray[numpy.float64[2, 1]]]

Returns the reference path (extended in both directions by default, please refer to the parameter of the class constructor eps2 for more details)

Returns:

2D polyline representing the reference path (extended)

reference_path_original(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) List[numpy.ndarray[numpy.float64[2, 1]]]

Returns the initial reference path without its extension

Returns:

2D polyline representing the reference path (original)

segments_longitudinal_coordinates(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem) List[float]
Returns:

array containing longitudinal coordinates corresponding to the start point of each segment

set_curvature(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: List[float]) None

Currently, the curvature of the reference path is not computed automatically upon construction. The function sets the curvature information manually. Note that the validity of the curvature is not checked, e.g., if it indeed corresponds to the reference pathof the curvilinear coordinate system. For an automatic version, please also refer to the member function compute_and_set_curvature.

Parameters:

curvature – curvature of the reference path

tangent(self: commonroad_dc.pycrccosy.CurvilinearCoordinateSystem, arg0: float) numpy.ndarray[numpy.float64[2, 1]]

Tangent vector at a specific longitudinal coordinate.

Parameters:

s – longitudinal coordinate

Returns:

tangent vector