nutonomy / nuscenes-devkit

The devkit of the nuScenes dataset.
https://www.nuScenes.org
Other
2.25k stars 620 forks source link

Why does the key 'segment_length' of and ArcLinePath class correspond multiple numbers? #880

Closed AngelosSE closed 1 year ago

AngelosSE commented 1 year ago

What are the meaning of the numbers? To get the length of an ArcLinePath one must sum all numbers corresponding to the key 'segment_length'?

    nusc_map = NuScenesMap(
        dataroot='datasets/nuscenes/v1.0-mini', 
        map_name ='singapore-onenorth',
        )
    lane_token = 'ce23377c-f8b1-4923-83af-d09d06dd60f0'
    lane_paths = nusc_map.get_arcline_path(lane_token)
    print(lane_paths[0]['segment_length'])
whyekit-motional commented 1 year ago

@AngelosSE I believe the three numbers from segment_length correspond to the values f', g' and h' for a circle parameterized in 3D space over the interval a ≤ t ≤ b like so

image

Thus, getting the L2 norm of segment_length should give the length of an ArcLinePath:

image

Pls see here and here for more details

AngelosSE commented 1 year ago

I understand that the integral you are referring to is integrating the speed along a curve over the interval of "time" [a,b], or in the case of the curve being a circle the integration is over an angle in [a,b]. If (f',g',h') is the tangent of a circle, then they should vary with the parameter, but why (f',g',h') is constant vector?

The provided explanation is inconsistent with the source code. At roows 118 and 154, in nuscenes.map_expansion.arcline_path_utils it says path_length = sum(arcline_path['segment_length']).

Related to this discussion: I suspect there is an error at row 268, which says path_length = path['segment_length'].

whyekit-motional commented 1 year ago

@AngelosSE actually, I believe you are right - we should sum up the entries in arcline_path['segment_length'] to get the length of the ArcLinePath

From this documentation here, each ArcLinePath is made up of three parts, and hence there are three numbers under the segment_length key

(Apologies, I didn't write the map-related part of the codebse so it took me some time to figure that out :sweat_smile:)