carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
11.23k stars 3.63k forks source link

Problem when calculating velocity from GNSS data #4996

Closed rFurgan closed 2 years ago

rFurgan commented 2 years ago

Hi, I'm currently working with CARLA 0.9.12 on Windows 10 trying to work with data provided from the GNSS sensors but I have some trouble with the coordinates.

What I'm doing: Take the timestamp and position the GNSS sensor sends to me and calculate the velocity of the actor (calculating every second). So I calculate the travelled distance with the previous position and the current position and divide it by the timestamp difference.

My problem: Sometimes the values jump too much, I mean a pedestrian "runs" with 1400+ km/h even though it should be 6 km/h. I've checked my calculations multiple times and they look fine.

My question: Are the positions provided together with the timestamp reliable? I don't mean to suspect the correctness of your code, but rather if the actors act different depending on the current FPS. I'm asking because I noticed that when I scale the window size of CARLA down to a smaller window, the whole world seems to accelarate (pedestrians walking faster, trees shaking faster in the wind, etc.). When I ran my code then, the speed of the pedestrians had more errors than before. (Maybe my computer has trouble rendering when the window is too big and then works "normal" when the window is more managable?)

Why I'm not using the internal commands for velocity: I'm currently researching the detection of road users (cars, pedestrians, bicycles, etc.) with GNSS data so I need to calculate the velocity of everyone myself that's why I can only use the internal commands for comparison.

Would be great if you could help me on this problem/question.

Thank you very much!

Edit: You can download the code here to reproduce my issue: https://github.com/rFurgan/reCarlos The velocity calculation happens in https://github.com/rFurgan/reCarlos/blob/main/common/road_user_data.py:108

rFurgan commented 2 years ago

The problem is, that even though it's a flat road, the altitude of the actor is rising for some reason which then falsifies my calculations