CARLA
Loading...
Searching...
No Matches
RayCastLidar.h
Go to the documentation of this file.
1// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#pragma once
8
9
12#include "Carla/Sensor/Sensor.h"
15
19
20#include "RayCastLidar.generated.h"
21
22/// A ray-cast based Lidar sensor.
23UCLASS()
24class CARLA_API ARayCastLidar : public ARayCastSemanticLidar
25{
26 GENERATED_BODY()
27
28 using FLidarData = carla::sensor::data::LidarData;
29 using FDetection = carla::sensor::data::LidarDetection;
30
31public:
32 static FActorDefinition GetSensorDefinition();
33
34 ARayCastLidar(const FObjectInitializer &ObjectInitializer);
35 virtual void Set(const FActorDescription &Description) override;
36 virtual void Set(const FLidarDescription &LidarDescription) override;
37
38 virtual void SendData(const float DeltaTime) override;
39
40 const TArray<float>& GetTestPointCloud() const { return PointCloudLidarData; };
41
42private:
43 /// Compute the received intensity of the point
44 float ComputeIntensity(const FSemanticDetection& RawDetection) const;
45 FDetection ComputeDetection(const FHitResult& HitInfo, const FTransform& InverseSensorTransform) const;
46
47 void PreprocessRays(uint32_t Channels, uint32_t MaxPointsPerChannel) override;
48 bool PostprocessDetection(FDetection& Detection) const;
49
50 void WriteDetectionAsync(uint32_t Channel, const FHitResult& HitInfo, const FTransform& InverseSensorTransform, const FVector& SensorLocation) override;
51 void ResetDetections(uint32_t Channels, uint32_t MaxPointsPerChannel) override;
52 void ComputeAndSaveDetections(const FTransform& SensorTransform) override;
53
55
56 std::vector<std::vector<FDetection>> Detections;
57
58 /// Enable/Disable general dropoff of lidar points
60
61 /// Slope for the intensity dropoff of lidar points, it is calculated
62 /// throught the dropoff limit and the dropoff at zero intensity
63 /// The points is kept with a probality alpha*Intensity + beta where
64 /// alpha = (1 - dropoff_zero_intensity) / droppoff_limit
65 /// beta = (1 - dropoff_zero_intensity)
68
69 // Way to access PointCloud data from the server.
70 TArray<float> PointCloudLidarData;
71};
A ray-cast based Lidar sensor.
TArray< float > PointCloudLidarData
FLidarData LidarData
float DropOffAlpha
Slope for the intensity dropoff of lidar points, it is calculated throught the dropoff limit and the ...
bool DropOffGenActive
Enable/Disable general dropoff of lidar points.
std::vector< std::vector< FDetection > > Detections
A ray-cast based Lidar sensor.
Helper class to store and serialize the data generated by a Lidar.
Definition LidarData.h:54
This file contains definitions of common data structures used in traffic manager.
A definition of a Carla Actor with all the variation and attributes.
A description of a Carla Actor with all its variation.