irsim.lib.handler.geometry_handler#
Classes#
This class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object. |
|
This class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object. |
|
This class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object. |
|
This class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object. |
|
This class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object. |
|
This class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object. |
|
This class is used to handle the 3D geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object. |
|
Factory class to create geometry handlers. |
Module Contents#
- class irsim.lib.handler.geometry_handler.geometry_handler(name: str, **kwargs)[source]#
Bases:
abc.ABCThis class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object.
- name#
- geometry#
- wheelbase#
- abstractmethod construct_original_geometry(**kwargs)[source]#
Construct the original geometry of the object when the state is in the origin of coordinates.
- Parameters:
**kwargs – shape parameters
Returns: Geometry of the object
- step(state)[source]#
Transform geometry to the new state.
- Parameters:
state (np.ndarray) – State vector [x, y, theta].
- Returns:
Transformed geometry.
- get_init_Gh()[source]#
Generate initial G and h for convex object.
- Returns:
(N, 2) h vector: (N, 1) cone_type (str): “norm2” for circle or “Rpositive” for polygon convex_flag (bool): for convex or not
- Return type:
G matrix
- get_polygon_Gh(vertices: numpy.ndarray | None = None)[source]#
Generate G and h for convex polygon.
- Parameters:
vertices – (2, N), N: Edge number of the object
- Returns:
(N, 2) h vector: (N, 1) cone_type (str): “norm2” for circle or “Rpositive” for polygon convex_flag (bool): for convex or not
- Return type:
G matrix
- get_circle_Gh(center: numpy.ndarray, radius: float)[source]#
Generate G and h for circle.
- Parameters:
center – (2, 1) array of center
radius – float of radius
- Returns:
(3, 2) h vector: (3, 1) cone_type (str): “norm2” convex_flag (bool): True
- Return type:
G matrix
- property vertices#
- property init_vertices#
[[x1, y1], [x2, y2]…. [[x1, y1]]]; [x1, y1] will repeat twice
- Type:
return original_vertices
- property original_vertices: numpy.ndarray#
Get the original vertices of the geometry.
- property original_centroid: numpy.ndarray#
Get the original centroid of the geometry.
- Returns:
The original centroid of the geometry.
- Return type:
np.ndarray
- property radius#
- class irsim.lib.handler.geometry_handler.CircleGeometry(name: str = 'circle', **kwargs)[source]#
Bases:
geometry_handlerThis class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object.
- construct_original_geometry(radius: float = 0.2, center: list = [0, 0], random_shape: bool = False, radius_range: list = [0.1, 1.0], wheelbase: float | None = None)[source]#
Construct the original geometry of the object when the state is in the origin of coordinates.
- Parameters:
**kwargs – shape parameters
Returns: Geometry of the object
- class irsim.lib.handler.geometry_handler.PolygonGeometry(name: str = 'polygon', **kwargs)[source]#
Bases:
geometry_handlerThis class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object.
- construct_original_geometry(vertices=None, random_shape: bool = False, is_convex: bool = False, **kwargs)[source]#
Construct a polygon geometry.
- Parameters:
vertices – [[x1, y1], [x2, y2]..]
random_shape – whether to generate random shape, default is False
is_convex – whether to generate convex shape, default is False
**kwargs – see random_generate_polygon()
- Returns:
Polygon object
- class irsim.lib.handler.geometry_handler.RectangleGeometry(name: str = 'rectangle', **kwargs)[source]#
Bases:
geometry_handlerThis class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object.
- class irsim.lib.handler.geometry_handler.LinestringGeometry(name: str = 'linestring', **kwargs)[source]#
Bases:
geometry_handlerThis class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object.
- construct_original_geometry(vertices, random_shape: bool = False, is_convex: bool = True, **kwargs)[source]#
Construct a LineString object.
- Parameters:
vertices – [[x1, y1], [x2, y2]..]
random_shape – whether to generate random shape, default is False
is_convex – whether to generate convex shape, default is False
**kwargs – see random_generate_polygon()
- Returns:
LineString object
- class irsim.lib.handler.geometry_handler.PointsGeometry(name: str = 'map', **kwargs)[source]#
Bases:
geometry_handlerThis class is used to handle the geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object.
- class irsim.lib.handler.geometry_handler.geometry_handler3d(name: str, **kwargs)[source]#
Bases:
abc.ABCThis class is used to handle the 3D geometry of the object. It reads the shape parameters from yaml file and constructs the geometry of the object.
- name#
- geometry#
- wheelbase#
- class irsim.lib.handler.geometry_handler.GeometryFactory[source]#
Factory class to create geometry handlers.
- static create_geometry(name: str = 'circle', **kwargs) geometry_handler[source]#