smarts.core.coordinates module
- class smarts.core.coordinates.BoundingBox(min_pt: Point, max_pt: Point)[source]
A 2-dimensional axis aligned box located in a [x, y] coordinate system.
- property as_dimensions: Dimensions
The box dimensions. This will lose offset information.
- property center
The center point of the box.
- contains(pt: Point) bool [source]
Determines if the given point is within this bounding box. If any bounding box coordinates are None, it is considered unbounded on that dimension/axis.
- Parameters:
pt (Point) – The point to test against.
- Returns:
True if pt is fully within the bounding box.
- property height
The height of the box.
- property length
The length of the box.
- property width
The width of the box.
- class smarts.core.coordinates.Dimensions(length: float, width: float, height: float)[source]
Representation of the size of a 3-dimensional form.
- property as_lwh: Tuple[float, float, float]
Convert to a tuple consisting of (length, width, height).
- classmethod copy_with_defaults(dims: Dimensions, defaults: Dimensions) Dimensions [source]
Make a copy of the given dimensions with a default option.
- equal_if_defined(length: float, width: float, height: float) bool [source]
Test if dimensions are matching.
- height: float
Alias for field number 2
- classmethod init_with_defaults(length: float, width: float, height: float, defaults: Dimensions) Dimensions [source]
Create with the given default values
- length: float
Alias for field number 0
- width: float
Alias for field number 1
- class smarts.core.coordinates.Heading(x: SupportsFloat | SupportsIndex | ellipsis = Ellipsis)[source]
In this space we use radians, 0 is facing north, and turn counter-clockwise.
- property as_panda3d: float
Convert to Panda3D facing format.
- property as_sumo: float
Convert to SUMO facing format
- direction_vector() ndarray [source]
Convert to a 2D directional vector that aligns with Cartesian Coordinate System
- classmethod from_bullet(bullet_heading) Heading [source]
Bullet’s space is in radians, 0 faces north, and turns counter-clockwise.
- classmethod from_panda3d(p3d_heading) Heading [source]
Panda3D’s space is in degrees, 0 faces north, and turns counter-clockwise.
- classmethod from_sumo(sumo_heading) Heading [source]
Sumo’s space uses degrees, 0 faces north, and turns clockwise.
- relative_to(other: Heading) Heading [source]
Computes the relative heading w.r.t. the given heading >>> Heading(math.pi/4).relative_to(Heading(math.pi)) Heading(-2.356194490192345)
- property source: str | None
The source of this heading.
- class smarts.core.coordinates.Point(x: float, y: float, z: float | None = 0)[source]
A coordinate in space.
- property as_np_array: ndarray
Convert this Point to a read-only numpy array and cache the result.
- property as_shapely: Point
Use with caution! Convert this point to a shapely point.
- classmethod from_np_array(np_array: ndarray) Point [source]
Factory for constructing a Point object from a numpy array.
- x: float
Alias for field number 0
- y: float
Alias for field number 1
- z: float | None
Alias for field number 2
- class smarts.core.coordinates.Pose(position: ndarray, orientation: ndarray, heading_: Heading | None = None)[source]
A pair of position and orientation values.
- as_bullet() Tuple[ndarray, ndarray] [source]
Convert to bullet origin (position of bullet origin, orientation quaternion
- as_panda3d() Tuple[ndarray, float] [source]
Convert to panda3D (object bounds center position, heading)
- as_sumo(length, local_heading)[source]
Convert to SUMO (position of front bumper, cw_heading)
- Parameters:
heading – The heading of the pose
length – The length dimension of the object’s physical bounds
local_heading – An additional orientation that re-faces the length offset
- classmethod from_center(base_position: Collection[float], heading: Heading) Pose [source]
Convert from centered location
- Parameters:
base_position – The center of the object’s bounds
heading – The heading of the object
- classmethod from_explicit_offset(offset_from_center, base_position: ndarray, heading: Heading, local_heading: Heading) Pose [source]
Convert from an explicit offset
- Parameters:
offset_from_center – The offset away from the center of the object’s bounds
heading – The heading of the pose
base_position – The base position without offset
local_heading – An additional orientation that re-faces the center offset
- classmethod from_front_bumper(front_bumper_position, heading, length) Pose [source]
Convert from front bumper location to a Pose with center of vehicle.
- Parameters:
front_bumper_position – The (x, y) position of the center front of the front bumper
heading – The heading of the pose
length – The length dimension of the object’s physical bounds
- orientation: ndarray
- position: ndarray
Center of vehicle.
- property position_tuple: Tuple[float | None, ...]
The position value of this pose as a tuple.
- class smarts.core.coordinates.RefLinePoint(s: float, t: float | None = 0, h: float | None = 0)[source]
A reference line coordinate. See the Reference Line coordinate system in OpenDRIVE here: https://www.asam.net/index.php?eID=dumpFile&t=f&f=4089&token=deea5d707e2d0edeeb4fccd544a973de4bc46a09#_coordinate_systems Also known as the Frenet coordinate system.
- h: float | None
The vertical displacement from surface of lane.
- s: float
The offset along lane from start of lane.
- t: float | None
The horizontal displacement from center of lane.