scenic.simulators.metadrive.utils

Summary of Module Members

Functions

calculateFilmSize

Compute film_size (width, height) in pixels for MetaDrive's top-down renderer.

extractNetOffsetAndBoundary

Extracts the net offset and boundary from the given SUMO map file.

extractXODROffset

Return the (x, y) translation from the OpenDRIVE <header><offset> element.

getMapParameters

Retrieve the map parameters.

metaDriveToScenicHeading

Converts MetaDrive heading to Scenic heading by subtracting π/2 (90 degrees).

metadriveToScenicPosition

Converts MetaDrive position to Scenic position using map parameters.

scenicToMetaDriveHeading

Converts Scenic heading to MetaDrive heading by adding π/2 (90 degrees).

scenicToMetaDrivePosition

Converts Scenic position to MetaDrive position using map parameters.

Classes

DriveEnv

Member Details

calculateFilmSize(sumo_map_boundary, scaling=5, margin_factor=1.1, min_extent=200.0)[source]

Compute film_size (width, height) in pixels for MetaDrive’s top-down renderer.

The SUMO convBoundary gives the map extent (xmin, ymin, xmax, ymax) in meters. If one dimension is zero (e.g. a single straight road), clamp it to min_extent to avoid a zero-width/height film size.

extractNetOffsetAndBoundary(sumo_map_path)[source]

Extracts the net offset and boundary from the given SUMO map file.

extractXODROffset(xodr_map_path)[source]

Return the (x, y) translation from the OpenDRIVE <header><offset> element.

If the file has no <header> or no <offset>, returns (0.0, 0.0).

getMapParameters(sumo_map_path, xodr_map_path)[source]

Retrieve the map parameters.

metadriveToScenicPosition(loc, scenic_offset)[source]

Converts MetaDrive position to Scenic position using map parameters.

scenicToMetaDrivePosition(vec, scenic_offset)[source]

Converts Scenic position to MetaDrive position using map parameters.

scenicToMetaDriveHeading(scenicHeading)[source]

Converts Scenic heading to MetaDrive heading by adding π/2 (90 degrees).

Scenic’s coordinate system has 0 radians pointing North, while MetaDrive uses 0 radians pointing East. This function shifts the heading to align with MetaDrive’s system.

metaDriveToScenicHeading(metaDriveHeading)[source]

Converts MetaDrive heading to Scenic heading by subtracting π/2 (90 degrees).