I used dev UE5 version of CARLA and changed nothing, just packaged it. When I use the Semantic lidar in map "Mine_01", things went wrong. It cannot distinguish between mountains and roads, and it will name the cloud of moutians and roads as label 10: Foliage, name the cloud of the vehicle as label 14: TrafficSign. As the pic below:
But things went right when I use the semantic camera at the same position. The camera could distinguish between mountains and roads.
Below is my code:
def semantic_camera_callback(data, world):
if not world.start_collecting or not RECORD_SEM_CAM:
return
data.convert(cc.CityScapesPalette)
img = np.frombuffer(data.raw_data, dtype=np.uint8)
img = img.reshape((data.height, data.width, 4))[:, :, :3].copy()
with cache_lock:
sensor_cache['semantic_images'] = (data.frame, img)
def semantic_lidar_callback(data, world):
if not world.start_collecting or not RECORD_SEM_LIDAR:
return
points_list = []
for detection in data:
points_list.append([
detection.point.x,
detection.point.y,
detection.point.z,
detection.cos_inc_angle,
float(detection.object_idx),
float(detection.object_tag)
])
if len(points_list) == 0:
return
points = np.array(points_list, dtype=np.float32)
with cache_lock:
sensor_cache['semantic_lidar'] = (data.frame, points)
...
sem_cam_bp = blue_print_lib.find('sensor.camera.semantic_segmentation')
sem_cam_bp.set_attribute('image_size_x', '800')
sem_cam_bp.set_attribute('image_size_y', '600')
sem_cam_bp.set_attribute('fov', '90')
sem_cam_bp.set_attribute('sensor_tick', str(RECORD_INTERVAL))
sem_cam_transform = carla.Transform(carla.Location(x=0, y=0, z=SEM_SENSOR_HEIGHT),
carla.Rotation(pitch=-90, yaw=0, roll=0))
sem_cam = sim_world.spawn_actor(sem_cam_bp, sem_cam_transform, attach_to=world.player)
actor_list.append(sem_cam)
sem_cam.listen(lambda data: semantic_camera_callback(data, world))
sem_lidar_bp = blue_print_lib.find('sensor.lidar.ray_cast_semantic')
sem_lidar_bp.set_attribute('channels', '64')
sem_lidar_bp.set_attribute('points_per_second', '600000')
sem_lidar_bp.set_attribute('rotation_frequency', '10')
sem_lidar_bp.set_attribute('range', '100')
sem_lidar_bp.set_attribute('horizontal_fov', '360')
sem_lidar_bp.set_attribute('upper_fov', '30')
sem_lidar_bp.set_attribute('lower_fov', '-30')
sem_lidar_bp.set_attribute('sensor_tick', str(RECORD_INTERVAL))
sem_lidar_transform = carla.Transform(carla.Location(x=0, y=0, z=SEM_SENSOR_HEIGHT),
carla.Rotation(pitch=0, yaw=0, roll=90))
sem_lidar = sim_world.spawn_actor(sem_lidar_bp, sem_lidar_transform, attach_to=world.player)
actor_list.append(sem_lidar)
sem_lidar.listen(lambda data: semantic_lidar_callback(data, world))

I used dev UE5 version of CARLA and changed nothing, just packaged it. When I use the Semantic lidar in map "Mine_01", things went wrong. It cannot distinguish between mountains and roads, and it will name the cloud of moutians and roads as label 10: Foliage, name the cloud of the vehicle as label 14: TrafficSign. As the pic below:
But things went right when I use the semantic camera at the same position. The camera could distinguish between mountains and roads.
Below is my code:
...