CARLA
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ARayCastLidar Class Reference

A ray-cast based Lidar sensor. More...

#include <RayCastLidar.h>

+ Inheritance diagram for ARayCastLidar:
+ Collaboration diagram for ARayCastLidar:

Public Member Functions

 ARayCastLidar (const FObjectInitializer &ObjectInitializer)
 
virtual void PostPhysTick (UWorld *World, ELevelTick TickType, float DeltaTime)
 
virtual void Set (const FActorDescription &Description) override
 
virtual void Set (const FLidarDescription &LidarDescription) override
 
- Public Member Functions inherited from ARayCastSemanticLidar
 ARayCastSemanticLidar (const FObjectInitializer &ObjectInitializer)
 
- Public Member Functions inherited from ASensor
 ASensor (const FObjectInitializer &ObjectInitializer)
 
virtual void BeginPlay ()
 
boost::optional< FActorAttributeGetAttribute (const FString Name)
 
const UCarlaEpisodeGetEpisode () const
 
URandomEngineGetRandomEngine ()
 
int32 GetSeed () const
 
auto GetToken () const
 Return the token that allows subscribing to this sensor's stream. More...
 
bool IsStreamReady ()
 
FDataStream MoveDataStream ()
 
virtual void OnFirstClientConnected ()
 
virtual void OnLastClientDisconnected ()
 
void PostPhysTickInternal (UWorld *World, ELevelTick TickType, float DeltaSeconds)
 
virtual void PrePhysTick (float DeltaSeconds)
 
void SetDataStream (FDataStream InStream)
 Replace the FDataStream associated with this sensor. More...
 
void SetEpisode (const UCarlaEpisode &InEpisode)
 
void SetSeed (int32 InSeed)
 
void Tick (const float DeltaTime) final
 

Static Public Member Functions

static FActorDefinition GetSensorDefinition ()
 
- Static Public Member Functions inherited from ARayCastSemanticLidar
static FActorDefinition GetSensorDefinition ()
 

Private Types

using FDetection = carla::sensor::data::LidarDetection
 
using FLidarData = carla::sensor::data::LidarData
 

Private Member Functions

void ComputeAndSaveDetections (const FTransform &SensorTransform) override
 This method uses all the saved FHitResults, compute the RawDetections and then send it to the LidarData structure. More...
 
FDetection ComputeDetection (const FHitResult &HitInfo, const FTransform &SensorTransf) const
 
float ComputeIntensity (const FSemanticDetection &RawDetection) const
 Compute the received intensity of the point. More...
 
bool PostprocessDetection (FDetection &Detection) const
 
void PreprocessRays (uint32_t Channels, uint32_t MaxPointsPerChannel) override
 Method that allow to preprocess if the rays will be traced. More...
 

Private Attributes

float DropOffAlpha
 Slope for the intensity dropoff of lidar points, it is calculated throught the dropoff limit and the dropoff at zero intensity The points is kept with a probality alpha*Intensity + beta where alpha = (1 - dropoff_zero_intensity) / droppoff_limit beta = (1 - dropoff_zero_intensity) More...
 
float DropOffBeta
 
bool DropOffGenActive
 Enable/Disable general dropoff of lidar points. More...
 
FLidarData LidarData
 

Additional Inherited Members

- Protected Types inherited from ARayCastSemanticLidar
using FSemanticDetection = carla::sensor::data::SemanticLidarDetection
 
using FSemanticLidarData = carla::sensor::data::SemanticLidarData
 
- Protected Member Functions inherited from ARayCastSemanticLidar
void ComputeRawDetection (const FHitResult &HitInfo, const FTransform &SensorTransf, FSemanticDetection &Detection) const
 Compute all raw detection information. More...
 
void CreateLasers ()
 Creates a Laser for each channel. More...
 
void ResetRecordedHits (uint32_t Channels, uint32_t MaxPointsPerChannel)
 Clear the recorded data structure. More...
 
bool ShootLaser (const float VerticalAngle, float HorizontalAngle, FHitResult &HitResult, FCollisionQueryParams &TraceParams) const
 Shoot a laser ray-trace, return whether the laser hit something. More...
 
void SimulateLidar (const float DeltaTime)
 Updates LidarMeasurement with the points read in DeltaTime. More...
 
void WritePointAsync (uint32_t Channel, FHitResult &Detection)
 Saving the hits the raycast returns per channel. More...
 
- Protected Member Functions inherited from ASensor
void EndPlay (EEndPlayReason::Type EndPlayReason) override
 
template<typename SensorT >
FAsyncDataStream GetDataStream (const SensorT &Self)
 Return the FDataStream associated with this sensor. More...
 
void PostActorCreated () override
 
- Protected Attributes inherited from ARayCastSemanticLidar
FLidarDescription Description
 
TArray< float > LaserAngles
 
std::vector< uint32_t > PointsPerChannel
 
std::vector< std::vector< bool > > RayPreprocessCondition
 
std::vector< std::vector< FHitResult > > RecordedHits
 
- Protected Attributes inherited from ASensor
bool bIsActive = false
 
URandomEngineRandomEngine = nullptr
 Random Engine used to provide noise for sensor output. More...
 
int32 Seed = 123456789
 Seed of the pseudo-random engine. More...
 

Detailed Description

A ray-cast based Lidar sensor.

Definition at line 24 of file RayCastLidar.h.

Member Typedef Documentation

◆ FDetection

Definition at line 29 of file RayCastLidar.h.

◆ FLidarData

Definition at line 28 of file RayCastLidar.h.

Constructor & Destructor Documentation

◆ ARayCastLidar()

ARayCastLidar::ARayCastLidar ( const FObjectInitializer &  ObjectInitializer)

Definition at line 30 of file RayCastLidar.cpp.

References ARayCastSemanticLidar::Description, ASensor::RandomEngine, FLidarDescription::RandomSeed, and ASensor::SetSeed().

+ Here is the call graph for this function:

Member Function Documentation

◆ ComputeAndSaveDetections()

void ARayCastLidar::ComputeAndSaveDetections ( const FTransform &  SensorTransform)
overrideprivatevirtual

This method uses all the saved FHitResults, compute the RawDetections and then send it to the LidarData structure.

Reimplemented from ARayCastSemanticLidar.

Definition at line 149 of file RayCastLidar.cpp.

References FLidarDescription::Channels, ComputeDetection(), ARayCastSemanticLidar::Description, LidarData, ARayCastSemanticLidar::PointsPerChannel, PostprocessDetection(), ARayCastSemanticLidar::RecordedHits, carla::sensor::data::LidarData::ResetMemory(), carla::sensor::data::SemanticLidarData::WriteChannelCount(), and carla::sensor::data::LidarData::WritePointSync().

+ Here is the call graph for this function:

◆ ComputeDetection()

ARayCastLidar::FDetection ARayCastLidar::ComputeDetection ( const FHitResult &  HitInfo,
const FTransform &  SensorTransf 
) const
private

Definition at line 106 of file RayCastLidar.cpp.

References FLidarDescription::AtmospAttenRate, ARayCastSemanticLidar::Description, carla::sensor::data::LidarDetection::intensity, carla::geom::Vector3D::Length(), and carla::sensor::data::LidarDetection::point.

Referenced by ComputeAndSaveDetections().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ComputeIntensity()

float ARayCastLidar::ComputeIntensity ( const FSemanticDetection RawDetection) const
private

Compute the received intensity of the point.

Definition at line 93 of file RayCastLidar.cpp.

References FLidarDescription::AtmospAttenRate, ARayCastSemanticLidar::Description, carla::geom::Vector3D::Length(), and carla::sensor::data::SemanticLidarDetection::point.

+ Here is the call graph for this function:

◆ GetSensorDefinition()

FActorDefinition ARayCastLidar::GetSensorDefinition ( )
static

Definition at line 24 of file RayCastLidar.cpp.

References UActorBlueprintFunctionLibrary::MakeLidarDefinition().

+ Here is the call graph for this function:

◆ PostPhysTick()

void ARayCastLidar::PostPhysTick ( UWorld *  World,
ELevelTick  TickType,
float  DeltaTime 
)
virtual

Reimplemented from ARayCastSemanticLidar.

Definition at line 58 of file RayCastLidar.cpp.

References carla::streaming::detail::token_type::get_stream_id(), ASensor::GetDataStream(), carla::ros2::ROS2::GetInstance(), ASensor::GetToken(), LidarData, and ARayCastSemanticLidar::SimulateLidar().

+ Here is the call graph for this function:

◆ PostprocessDetection()

bool ARayCastLidar::PostprocessDetection ( FDetection Detection) const
private

Definition at line 134 of file RayCastLidar.cpp.

References ARayCastSemanticLidar::Description, DropOffAlpha, DropOffBeta, FLidarDescription::DropOffIntensityLimit, URandomEngine::GetNormalDistribution(), URandomEngine::GetUniformFloat(), carla::sensor::data::LidarDetection::intensity, carla::geom::Vector3D::MakeUnitVector(), FLidarDescription::NoiseStdDev, carla::sensor::data::LidarDetection::point, and ASensor::RandomEngine.

Referenced by ComputeAndSaveDetections().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ PreprocessRays()

void ARayCastLidar::PreprocessRays ( uint32_t  Channels,
uint32_t  MaxPointsPerChannel 
)
overrideprivatevirtual

Method that allow to preprocess if the rays will be traced.

Reimplemented from ARayCastSemanticLidar.

Definition at line 124 of file RayCastLidar.cpp.

References ARayCastSemanticLidar::Description, DropOffGenActive, FLidarDescription::DropOffGenRate, URandomEngine::GetUniformFloat(), ASensor::RandomEngine, and ARayCastSemanticLidar::RayPreprocessCondition.

+ Here is the call graph for this function:

◆ Set() [1/2]

void ARayCastLidar::Set ( const FActorDescription Description)
overridevirtual

Reimplemented from ARayCastSemanticLidar.

Definition at line 37 of file RayCastLidar.cpp.

References ASensor::Set(), and UActorBlueprintFunctionLibrary::SetLidar().

+ Here is the call graph for this function:

◆ Set() [2/2]

void ARayCastLidar::Set ( const FLidarDescription LidarDescription)
overridevirtual

Reimplemented from ARayCastSemanticLidar.

Definition at line 45 of file RayCastLidar.cpp.

References FLidarDescription::Channels, ARayCastSemanticLidar::CreateLasers(), ARayCastSemanticLidar::Description, DropOffAlpha, FLidarDescription::DropOffAtZeroIntensity, DropOffBeta, DropOffGenActive, FLidarDescription::DropOffGenRate, FLidarDescription::DropOffIntensityLimit, LidarData, and ARayCastSemanticLidar::PointsPerChannel.

+ Here is the call graph for this function:

Member Data Documentation

◆ DropOffAlpha

float ARayCastLidar::DropOffAlpha
private

Slope for the intensity dropoff of lidar points, it is calculated throught the dropoff limit and the dropoff at zero intensity The points is kept with a probality alpha*Intensity + beta where alpha = (1 - dropoff_zero_intensity) / droppoff_limit beta = (1 - dropoff_zero_intensity)

Definition at line 60 of file RayCastLidar.h.

Referenced by PostprocessDetection(), and Set().

◆ DropOffBeta

float ARayCastLidar::DropOffBeta
private

Definition at line 61 of file RayCastLidar.h.

Referenced by PostprocessDetection(), and Set().

◆ DropOffGenActive

bool ARayCastLidar::DropOffGenActive
private

Enable/Disable general dropoff of lidar points.

Definition at line 53 of file RayCastLidar.h.

Referenced by PreprocessRays(), and Set().

◆ LidarData

FLidarData ARayCastLidar::LidarData
private

Definition at line 50 of file RayCastLidar.h.

Referenced by ComputeAndSaveDetections(), PostPhysTick(), and Set().


The documentation for this class was generated from the following files: