CARLA
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
AHSSLidar Class Reference

A fixed-sweep ray-cast Lidar approximating a Hybrid Solid-State LiDAR (e.g. More...

#include <HSSLidar.h>

+ Inheritance diagram for AHSSLidar:

Public Member Functions

 AHSSLidar (const FObjectInitializer &ObjectInitializer)
 
const TArray< float > & GetTestPointCloud () const
 
virtual void SendData (const float DeltaTime) override
 
virtual void Set (const FActorDescription &Description) override
 
virtual void Set (const FLidarDescription &LidarDescription) override
 
virtual void SimulateLidar (const float DeltaTime, bool bLockPhysics=true) override
 
- Public Member Functions inherited from ARayCastSemanticLidar
 ARayCastSemanticLidar (const FObjectInitializer &ObjectInitializer)
 
void GetMirrorState (carla::multigpu::SensorState &State) const override
 Multi-GPU: the runtime state this sensor starts its next tick from (noise generator, sweep angle, history).
 
void SetMirrorState (const carla::multigpu::SensorState &State) override
 
- Public Member Functions inherited from ASensor
bool AreClientsListening ()
 
 ASensor (const FObjectInitializer &ObjectInitializer)
 
void ClearReadyToTick ()
 
std::optional< FActorAttribute > GetAttribute (const FString Name)
 
const UCarlaEpisode & GetEpisode () const
 
URandomEngine * GetRandomEngine ()
 
float GetReadyToTickDeltaSeconds () const
 
int32 GetSeed () const
 
auto GetToken () const
 Return the token that allows subscribing to this sensor's stream.
 
bool IsReadyToTick () const
 
bool IsStreamReady ()
 
FDataStream MoveDataStream ()
 
virtual void OnFirstClientConnected ()
 
virtual void OnLastClientDisconnected ()
 
virtual void PostPhysTick (UWorld *World, ELevelTick TickType, float DeltaSeconds)
 
void PostPhysTickInternal (UWorld *World, ELevelTick TickType, float DeltaSeconds)
 
virtual void PrePhysTick (float DeltaSeconds)
 
void SetDataStream (FDataStream InStream)
 Replace the FDataStream associated with this sensor.
 
void SetEpisode (const UCarlaEpisode &InEpisode)
 
void SetPrimaryTick (float DeltaSeconds)
 Multi-GPU secondary: tick in this engine frame, with the primary's delta.
 
void SetSavingDataToDisk (bool bSavingData)
 
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 ()
 
- Static Public Member Functions inherited from ASensor
static FSensorCaptureContext MakeCaptureContext (const ASensor &Sensor)
 Call on the game thread right after CaptureScene().
 

Private Types

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

Private Member Functions

void ComputeAndSaveDetections (const FTransform &SensorTransform) override
 Copies the per-channel detections into the LidarData structure.
 
FDetection ComputeDetection (const FHitResult &HitInfo, const FTransform &InverseSensorTransform) const
 
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.
 
void ResetDetections (uint32_t Channels, uint32_t MaxPointsPerChannel) override
 Clear the per-channel detection buffers.
 
void WriteDetectionAsync (uint32_t Channel, const FHitResult &HitInfo, const FTransform &InverseSensorTransform, const FVector &SensorLocation) override
 Computes the detection of a hit inside the raycast ParallelFor.
 

Private Attributes

std::vector< std::vector< FDetection > > Detections
 
float DropOffAlpha
 Slope for the intensity dropoff of lidar points: alpha*Intensity + beta where alpha = dropoff_zero_intensity / dropoff_limit and beta = 1 - dropoff_zero_intensity.
 
float DropOffBeta
 
bool DropOffGenActive
 Enable/Disable general dropoff of lidar points.
 
FLidarData LidarData
 
TArray< float > PointCloudLidarData
 WITH_EDITOR-only mirror of the point cloud, used by the debug save path.
 

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
virtual void BeginPlay () override
 
void ComputeRawDetection (const FHitResult &HitInfo, const FTransform &InverseSensorTransform, const FVector &SensorLocation, FSemanticDetection &Detection) const
 Compute all raw detection information.
 
void CreateLasers ()
 Creates a Laser for each channel.
 
virtual void EndPlay (EEndPlayReason::Type EndPlayReason) override
 
bool ShootLaser (const float VerticalAngle, float HorizontalAngle, FHitResult &HitResult, FCollisionQueryParams &TraceParams, const FVector &LidarBodyLocation, const FRotator &LidarBodyRotation) const
 Shoot a laser ray-trace, return whether the laser hit something.
 
- Protected Member Functions inherited from ASensor
void EndPlay (EEndPlayReason::Type EndPlayReason) override
 
template<typename SensorType >
FAsyncDataStream GetDataStream (SensorType &&Self)
 Return the FDataStream associated with this sensor.
 
void PostActorCreated () override
 
- Static Protected Member Functions inherited from ARayCastSemanticLidar
template<typename DetectionT , typename LidarDataT , typename PostprocessT >
static void CompactAndWriteDetections (std::vector< std::vector< DetectionT > > &Detections, std::vector< uint32_t > &OutPointsPerChannel, uint32_t Channels, LidarDataT &LidarData, PostprocessT &&Postprocess)
 Post-processes the detections channel by channel, drops the rejected ones and writes the rest to LidarData.
 
template<typename DetectionT >
static void CopyDetectionsToPointCloud (const std::vector< std::vector< DetectionT > > &Detections, const std::vector< uint32_t > &InPointsPerChannel, TArray< float > &PointCloud)
 Copies the kept detections into a flat x, y, z, intensity array (editor debug point cloud).
 
template<typename DetectionT >
static void ResetChannelDetections (std::vector< std::vector< DetectionT > > &Detections, uint32_t Channels, uint32_t MaxPointsPerChannel)
 Clears every channel buffer and reserves room for a full scan.
 
- Static Protected Member Functions inherited from ASensor
template<typename SensorType , typename ElementType >
static void SendDataToClient (SensorType &&Sensor, TArrayView< ElementType > SensorData, const FSensorCaptureContext &CaptureContext)
 
- Protected Attributes inherited from ARayCastSemanticLidar
FLidarDescription Description
 
TArray< float > LaserAngles
 
std::vector< uint32_t > PointsPerChannel
 
std::vector< std::vector< bool > > RayPreprocessCondition
 
- Protected Attributes inherited from ASensor
bool bIsActive = false
 
bool bSavingDataToDisk = false
 
URandomEngine * RandomEngine = nullptr
 Random Engine used to provide noise for sensor output.
 
int32 Seed = 123456789
 Seed of the pseudo-random engine.
 

Detailed Description

A fixed-sweep ray-cast Lidar approximating a Hybrid Solid-State LiDAR (e.g.

Hesai AT128). Unlike ARayCastLidar this sensor does not rotate; each tick it casts a configurable horizontal field of view at a fixed angular resolution centred on the sensor's forward axis.

Definition at line 27 of file HSSLidar.h.

Member Typedef Documentation

◆ FDetection

Definition at line 32 of file HSSLidar.h.

◆ FLidarData

Definition at line 31 of file HSSLidar.h.

Constructor & Destructor Documentation

◆ AHSSLidar()

AHSSLidar::AHSSLidar ( const FObjectInitializer &  ObjectInitializer)

Member Function Documentation

◆ ComputeAndSaveDetections()

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

◆ ComputeDetection()

AHSSLidar::FDetection AHSSLidar::ComputeDetection ( const FHitResult &  HitInfo,
const FTransform &  InverseSensorTransform 
) const
private

◆ GetSensorDefinition()

FActorDefinition AHSSLidar::GetSensorDefinition ( )
static

◆ GetTestPointCloud()

const TArray< float > & AHSSLidar::GetTestPointCloud ( ) const
inline

Definition at line 43 of file HSSLidar.h.

◆ PostprocessDetection()

bool AHSSLidar::PostprocessDetection ( FDetection &  Detection) const
private

◆ PreprocessRays()

void AHSSLidar::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 123 of file HSSLidar.cpp.

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

Referenced by SimulateLidar().

◆ ResetDetections()

void AHSSLidar::ResetDetections ( uint32_t  Channels,
uint32_t  MaxPointsPerChannel 
)
overrideprivatevirtual

Clear the per-channel detection buffers.

Reimplemented from ARayCastSemanticLidar.

Definition at line 155 of file HSSLidar.cpp.

References Detections, and ARayCastSemanticLidar::ResetChannelDetections().

Referenced by SimulateLidar().

◆ SendData()

void AHSSLidar::SendData ( const float  DeltaTime)
overridevirtual

◆ Set() [1/2]

void AHSSLidar::Set ( const FActorDescription &  Description)
overridevirtual

Reimplemented from ARayCastSemanticLidar.

Definition at line 42 of file HSSLidar.cpp.

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

Referenced by Set().

◆ Set() [2/2]

void AHSSLidar::Set ( const FLidarDescription &  LidarDescription)
overridevirtual

◆ SimulateLidar()

void AHSSLidar::SimulateLidar ( const float  DeltaTime,
bool  bLockPhysics = true 
)
overridevirtual

◆ WriteDetectionAsync()

void AHSSLidar::WriteDetectionAsync ( uint32_t  Channel,
const FHitResult &  HitInfo,
const FTransform &  InverseSensorTransform,
const FVector &  SensorLocation 
)
overrideprivatevirtual

Computes the detection of a hit inside the raycast ParallelFor.

Reimplemented from ARayCastSemanticLidar.

Definition at line 160 of file HSSLidar.cpp.

References ComputeDetection(), DEBUG_ASSERT, and Detections.

Referenced by SimulateLidar().

Member Data Documentation

◆ Detections

std::vector<std::vector<FDetection> > AHSSLidar::Detections
private

Definition at line 59 of file HSSLidar.h.

Referenced by ComputeAndSaveDetections(), ResetDetections(), and WriteDetectionAsync().

◆ DropOffAlpha

float AHSSLidar::DropOffAlpha
private

Slope for the intensity dropoff of lidar points: alpha*Intensity + beta where alpha = dropoff_zero_intensity / dropoff_limit and beta = 1 - dropoff_zero_intensity.

Definition at line 67 of file HSSLidar.h.

Referenced by PostprocessDetection(), and Set().

◆ DropOffBeta

float AHSSLidar::DropOffBeta
private

Definition at line 68 of file HSSLidar.h.

Referenced by PostprocessDetection(), and Set().

◆ DropOffGenActive

bool AHSSLidar::DropOffGenActive
private

Enable/Disable general dropoff of lidar points.

Definition at line 62 of file HSSLidar.h.

Referenced by PreprocessRays(), and Set().

◆ LidarData

FLidarData AHSSLidar::LidarData
private

Definition at line 57 of file HSSLidar.h.

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

◆ PointCloudLidarData

TArray<float> AHSSLidar::PointCloudLidarData
private

WITH_EDITOR-only mirror of the point cloud, used by the debug save path.

Definition at line 71 of file HSSLidar.h.

Referenced by ComputeAndSaveDetections().


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