PJLab-ADG / PCSim

PCSim: LiDAR Point Cloud Simulation and Sensor Placement! Code of [ICRA 2023] "Analyzing Infrastructure LiDAR Placement with Realistic LiDAR Simulation Library" and [ICCV 2023] "Optimizing the Placement of Roadside LiDARs for Autonomous Driving".
Apache License 2.0
226 stars 25 forks source link

about the lidar data #16

Closed DarrenWong closed 1 year ago

DarrenWong commented 1 year ago

Hey I have a question about the lidar data generation. I am able to get the horizon and the pandar64 data. Anything is ok if I use 10hz with synchronous_mode=True, but if I use 100hz then only part of the custom lidar data is received, as attached. Did I miss any config for this custom lidar? It is fine if I use the default lidar in 10hz as well as in 100hz.

Tried to set "points_per_second" and "rotation_frequency" but no useful for the custom lidar.

The code is based on the synchronous_mode.py of the carla 0.9.14

        # new lidar
        lidar_location = carla.Location(-0.5,0,2.095)
        lidar_rotation = carla.Rotation(0,0,0)
        lidar_transform = carla.Transform(lidar_location,lidar_rotation)
        pandar64_bp = world.get_blueprint_library().find('sensor.lidar.ray_cast')
        pandar64_bp.set_attribute("lidar_type","Surround") # choose lidar_type as mechanical
        pandar64_bp.set_attribute("name","pandar64") # choose lidar name as pandar64
        pandar64_bp.set_attribute('points_per_second',str(9000000))
        pandar64_bp.set_attribute('rotation_frequency',str(100))
        lidar_pandar = world.spawn_actor(pandar64_bp,lidar_transform,attach_to=vehicle)
        lidar_pandar.listen(lambda data: lidar_callback(data, '/home/darren/Documents/test/pandar64_1', 1))

        actor_list.append(lidar_pandar)
      # old  lidar
        lidar_location = carla.Location(-0.5,0,2.095)
        lidar_rotation = carla.Rotation(0,0,0)
        lidar_transform = carla.Transform(lidar_location,lidar_rotation)
        lidar_bp = world.get_blueprint_library().find('sensor.lidar.ray_cast')
        lidar_bp.set_attribute('channels',str(32))
        lidar_bp.set_attribute('points_per_second',str(9000000))
        lidar_bp.set_attribute('rotation_frequency',str(100))
        lidar_bp.set_attribute('range',str(50))
        lidar_sen = world.spawn_actor(lidar_bp,lidar_transform,attach_to=vehicle)
        lidar_sen.listen(lambda data: lidar_callback(data, '/home/darren/Documents/test/normal_lidar', 1))

        actor_list.append(lidar_sen)

10hz horizon ok, image

10hz pandar ok, image

100hz horizon only part image

pandar image

DarrenWong commented 1 year ago

It works at 100hz after revising some hard coding parameters in creating the custom lidar for hesai

https://github.com/PJLab-ADG/LiDARSimLib-and-Placement-Evaluation/blob/a2882419ff0891bac68cda8d0536305f13e91693/LiDARSimLib/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Surround.cpp#L78 for livox https://github.com/PJLab-ADG/LiDARSimLib-and-Placement-Evaluation/blob/a2882419ff0891bac68cda8d0536305f13e91693/LiDARSimLib/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Risley_prism.cpp#L70

image