irsim.lib.handler#

Handler classes for IR-SIM simulation.

This package contains factory classes for: - kinematics_handler: Kinematics factory - geometry_handler: Geometry factory

Submodules#

Classes#

GeometryFactory

Factory class to create geometry handlers.

KinematicsFactory

Factory class to create kinematics handlers.

Package Contents#

class irsim.lib.handler.GeometryFactory[源代码]#

Factory class to create geometry handlers.

static create_geometry(name: str = 'circle', **kwargs) geometry_handler[源代码]#

Create a geometry handler from a YAML shape name.

参数:
  • name -- Shape name. Supported values are circle, polygon, rectangle, compound, linestring, and map.

  • **kwargs -- Shape-specific parameters forwarded to the handler.

返回:

Concrete geometry handler.

返回类型:

geometry_handler

抛出:

ValueError -- If name is not supported.

class irsim.lib.handler.KinematicsFactory[源代码]#

Factory class to create kinematics handlers.

static create_kinematics(name: str | None = None, noise: bool = False, alpha: list | None = None, mode: str | None = None, wheelbase: float | None = None, role: str = 'robot', *, shape_wheelbase: float | None = None, **kwargs: Any) KinematicsHandler[源代码]#

Create a kinematics handler from a YAML kinematics block.

参数:
  • name -- Registered kinematics name: diff, omni, omni_angular, acker, or a custom name registered with register_kinematics(). None defaults to diff; static is retained as the static-object sentinel.

  • noise -- Whether to apply motion noise.

  • alpha -- Noise parameters passed to the handler.

  • mode -- Steering mode of acker handlers; forwarded when given.

  • wheelbase -- Wheelbase set under kinematics; forwarded when given and takes precedence over shape_wheelbase.

  • role -- Object role, retained for API compatibility.

  • shape_wheelbase -- Wheelbase taken from a car-like shape; the fallback for acker handlers (default 1.0) when wheelbase is not given.

  • **kwargs -- Any other kinematics key, forwarded to the handler's __init__ (a custom handler's own parameters).

返回:

Handler instance for name.

返回类型:

KinematicsHandler

抛出:
  • NotImplementedError -- If name is not registered.

  • TypeError -- If the handler does not accept a forwarded parameter.

static get_handler_class(name: str) type[KinematicsHandler] | None[源代码]#

Look up a registered handler class by name without instantiation.

参数:

name (str) -- Kinematics name (e.g. "diff", "omni").

返回:

The class, or None if not found.

返回类型:

type[KinematicsHandler] | None