Skip to content

Clarification on segment length and width in map observations #521

@itsbman

Description

@itsbman

Hi,

As I understand from the GPUDrive paper, road objects contain information on their segment length/width/height. When looking into the code, it seems that map observation is processed in level_gen.cpp. In particular these two lines suggest that for both polylines and polygons, it is the half lengths (& half widths) that are used:

auto scale = Diag3x3{.d0 = start.distance(end)/2, .d1 = 0.1, .d2 = 0.1};

auto scale = Diag3x3{.d0 = lengths[maxLength_i]/2, .d1 = lengths[minLength_i]/2, .d2 = 0.1};

For road edges, this seems to be confirmed in the visualization code:

def _get_endpoints(self, x, y, length, yaw):
"""Compute the start and end points of a road segment."""
center = np.array([x, y])
start = center - np.array([length * np.cos(yaw), length * np.sin(yaw)])
end = center + np.array([length * np.cos(yaw), length * np.sin(yaw)])
return start, end

But for polygons like crosswalks, it seems to suggest that they are full lengths and widths:

# corners
tl = pt + (length / 2) * u - (width / 2) * ut
tr = pt + (length / 2) * u + (width / 2) * ut
br = pt - (length / 2) * u + (width / 2) * ut
bl = pt - (length / 2) * u - (width / 2) * ut

I would like to confirm whether in practice, the segment information you get from GPUDriveTorchEnv's observation is actually half lengths for both polylines and polygons or do polygons get full lengths?

Thank you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions