A ray-cast based Lidar sensor. More...
#include <RayCastLidar.h>
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< FActorAttribute > | GetAttribute (const FString Name) |
const UCarlaEpisode & | GetEpisode () const |
URandomEngine * | GetRandomEngine () |
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 |
URandomEngine * | RandomEngine = nullptr |
Random Engine used to provide noise for sensor output. More... | |
int32 | Seed = 123456789 |
Seed of the pseudo-random engine. More... | |
A ray-cast based Lidar sensor.
Definition at line 24 of file RayCastLidar.h.
|
private |
Definition at line 29 of file RayCastLidar.h.
|
private |
Definition at line 28 of file RayCastLidar.h.
ARayCastLidar::ARayCastLidar | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 30 of file RayCastLidar.cpp.
References ARayCastSemanticLidar::Description, ASensor::RandomEngine, FLidarDescription::RandomSeed, and ASensor::SetSeed().
|
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().
|
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().
|
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.
|
static |
Definition at line 24 of file RayCastLidar.cpp.
References UActorBlueprintFunctionLibrary::MakeLidarDefinition().
|
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().
|
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().
|
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.
|
overridevirtual |
Reimplemented from ARayCastSemanticLidar.
Definition at line 37 of file RayCastLidar.cpp.
References ASensor::Set(), and UActorBlueprintFunctionLibrary::SetLidar().
|
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.
|
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().
|
private |
Definition at line 61 of file RayCastLidar.h.
Referenced by PostprocessDetection(), and Set().
|
private |
Enable/Disable general dropoff of lidar points.
Definition at line 53 of file RayCastLidar.h.
Referenced by PreprocessRays(), and Set().
|
private |
Definition at line 50 of file RayCastLidar.h.
Referenced by ComputeAndSaveDetections(), PostPhysTick(), and Set().