Skip to content

Fix last_pose bug in nuscenes_converter.py#244

Open
gusongen wants to merge 1 commit into
fundamentalvision:masterfrom
gusongen:master
Open

Fix last_pose bug in nuscenes_converter.py#244
gusongen wants to merge 1 commit into
fundamentalvision:masterfrom
gusongen:master

Conversation

@gusongen

@gusongen gusongen commented Apr 7, 2024

Copy link
Copy Markdown

Thanks for this amazing work! I got into a little trouble when reading can_bus data using nuscenes_converter.py .
After I checked, I noticed that there was a small bug in this script.
as you can see , the vel , velocity and rotation_rate are one frame lagging

data = pickle.load(open(<pkl_path>, 'rb') as f)
data['infos']['scene-0003'][1]['can_bus']
>>>
array([ 2.49872966e+02,  9.17558592e+02,  0.00000000e+00,  9.98390395e-01,
        0.00000000e+00,  0.00000000e+00, -5.67152390e-02, -8.88715231e-03,
       -3.97558906e-01,  9.80574822e+00, -7.58608920e-04,  4.25659760e-04,
       -3.16689089e-02,  8.12085215e-08,  0.00000000e+00,  0.00000000e+00,
        0.00000000e+00,  0.00000000e+00])

However , you will find that the raw data in nuscenes/can_bus/scene-0003_pose.json looks like this:

[
...

    {
        "accel": [
            -0.02809354193250988,
            -0.39169555596793926,
            9.776298785696437
        ],
        "orientation": [
            0.9983903954177029,
            0.0,
            0.0,
            -0.056715239025175467
        ],
        "pos": [
            249.87296600685508,
            917.5585920742254,
            0.0
        ],
        "rotation_rate": [
            -0.0013980914372950792,
            -0.0021305647678673267,
            -0.03170059993863106
        ],
        "utime": 1533201470937524,
        "vel": [
            1.225028636241502e-07,
            0.0,
            0.0
        ]
    },
    {
        "accel": [
            -0.00888715230771263,
            -0.39755890555260953,
            9.805748215542922
        ],
        "orientation": [
            0.998388355813101,
            0.0,
            0.0,
            -0.0567511319430092
        ],
        "pos": [
            249.87279020125354,
            917.5587293410829,
            0.0
        ],
        "rotation_rate": [
            -0.0007586089195683599,
            0.00042565976036712527,
            -0.03166890889406204
        ],
        "utime": 1533201470957393,
        "vel": [
            8.120852151007131e-08,
            0.0,
            0.0
        ]
    },
...
]

the pos and orientation come from the former, but the rest of them come from the latter.
I assume that this won't be a big problem since those two frames are quite close.

@usergxx

usergxx commented Apr 28, 2024

Copy link
Copy Markdown

yes,
in nuscenes_converter.py line 174,
can_bus.extend(pose[key]) # 16 elements

@kaitolucifer

kaitolucifer commented Jan 9, 2025

Copy link
Copy Markdown

@gusongen
Also wondering that is this last_pose really former frame?
Sincepose['utime'] == sample_timestamp is the current frame.
So this last_pose is actually current frame?

    for i, pose in enumerate(pose_list):
        if pose['utime'] > sample_timestamp:
            break
        last_pose = pose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants