carla icon indicating copy to clipboard operation
carla copied to clipboard

carla lidar point cloud just a half frame points

Open S-kewen opened this issue 2 years ago • 1 comments

CARLA version: 0.9.12 Platform/OS: Ubuntu 20.04

Problem you have experienced: I tried to use the official demo to get the lidar point cloud frame similar to KITTI Dataset (Velodyne HDL-64E), but I found that the point cloud frame returned is incomplete, only about half of it.

I have tried increasing the points_per_second ten times, but still the same, it works fine when I try to modify to the following config.

Problematic config: {range: 120, rotation_frequency: 10, upper_fov: 10.0, lower_fov: -26.8, points_per_second: 1300000, channels: 64}

Works fine config: {range: 70, rotation_frequency: 20, lower_fov: -45, points_per_second: 1280000, channels: 64}

Here is the Lidar Point Cloud Frame image and RGB camera image: https://i.postimg.cc/KvMP8sXN/320.png https://i.postimg.cc/x17qN9KN/20220916163344.png

S-kewen avatar Sep 16 '22 08:09 S-kewen

{range: 100, channels: 64, points_per_second: 1300000, rotation_frequency: 20, upper_fov: 7.0, lower_fov: -16.0, atmosphere_attenuation_rate: 0.004, noise_stddev: 0.0, dropoff_general_rate: 0.10, dropoff_zero_intensity: 0.4, dropoff_intensity_limit: 0.8}

This config can work, just change rotation_frequency, why rotation_frequency is 10 can't work?

S-kewen avatar Sep 16 '22 09:09 S-kewen

This behaviour is working as intended. Between each frame, the sensor rotates by a certain angle, and returns points for angles in between the last position and the current position.

rotation_frequency tells the lidar sensor how often it should complete a rotation (e.g. 10 times per simulation second) if your simulation FPS is 20 (i.e. 20 frames per second) the lidar sensor will only rotate 180° since the last frame, and only give you points for that 180°. For your expected results, you should keep rotation_frequency the same as your simulation frame rate, i.e. 1/fixed_delta_seconds. If you want to only get a complete lidar scan every so often, use the sensor_tick attribute.

for example:

GLOBAL_FPS=20 # world tick rate
SENSOR_FPS=4 # sensor tick rate

settings = world.get_settings()
settings.synchronous_mode = True # not sure if necessary, asynchronous might work too.
settings.fixed_delta_seconds = 1.0 / GLOBAL_FPS
world.apply_settings(settings)

... # set up stuff, get lidar blueprint

lidar_bp.set_attribute('rotation_frequency', str(GLOBAL_FPS))
lidar_bp.set_attribute("sensor_tick", str(1.0 / SENSOR_FPS))
... # spawn sensor, etc

Pyrestone avatar Oct 07 '22 15:10 Pyrestone