|
CARLA
|
A ray-cast based Lidar sensor. More...
#include <RayCastSemanticLidar.h>
Inheritance diagram for ARayCastSemanticLidar:Public Member Functions | |
| 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). | |
| virtual void | SendData (const float DeltaTime) |
| virtual void | Set (const FActorDescription &Description) override |
| virtual void | Set (const FLidarDescription &LidarDescription) |
| void | SetMirrorState (const carla::multigpu::SensorState &State) override |
| virtual void | SimulateLidar (const float DeltaTime, bool bLockPhysics=true) |
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 ASensor | |
| static FSensorCaptureContext | MakeCaptureContext (const ASensor &Sensor) |
| Call on the game thread right after CaptureScene(). | |
Protected Types | |
| using | FSemanticDetection = carla::sensor::data::SemanticLidarDetection |
| using | FSemanticLidarData = carla::sensor::data::SemanticLidarData |
Protected Member Functions | |
| virtual void | BeginPlay () override |
| virtual void | ComputeAndSaveDetections (const FTransform &SensorTransform) |
| Copies the per-channel detections into the LidarData structure. | |
| 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 |
| virtual void | PreprocessRays (uint32_t Channels, uint32_t MaxPointsPerChannel) |
| Method that allow to preprocess if the rays will be traced. | |
| virtual void | ResetDetections (uint32_t Channels, uint32_t MaxPointsPerChannel) |
| Clear the per-channel detection buffers. | |
| 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. | |
| virtual void | WriteDetectionAsync (uint32_t Channel, const FHitResult &HitInfo, const FTransform &InverseSensorTransform, const FVector &SensorLocation) |
| Computes the detection of a hit inside the raycast ParallelFor. | |
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 | |
| 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 | |
| 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. | |
Private Attributes | |
| std::vector< std::vector< FSemanticDetection > > | SemanticDetections |
| FSemanticLidarData | SemanticLidarData |
A ray-cast based Lidar sensor.
Definition at line 28 of file RayCastSemanticLidar.h.
|
protected |
Definition at line 35 of file RayCastSemanticLidar.h.
Definition at line 34 of file RayCastSemanticLidar.h.
| ARayCastSemanticLidar::ARayCastSemanticLidar | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 36 of file RayCastSemanticLidar.cpp.
|
overrideprotectedvirtual |
Reimplemented from ASensor.
Definition at line 42 of file RayCastSemanticLidar.cpp.
|
inlinestaticprotected |
Post-processes the detections channel by channel, drops the rejected ones and writes the rest to LidarData.
Runs sequentially in channel and point order, so the random sequence for noise and drop-off is unchanged.
Definition at line 94 of file RayCastSemanticLidar.h.
Referenced by AHSSLidar::ComputeAndSaveDetections(), and ARayCastLidar::ComputeAndSaveDetections().
|
protectedvirtual |
Copies the per-channel detections into the LidarData structure.
Reimplemented in AHSSLidar, and ARayCastLidar.
Definition at line 226 of file RayCastSemanticLidar.cpp.
References FLidarDescription::Channels, Description, PointsPerChannel, carla::sensor::data::SemanticLidarData::ResetMemory(), SemanticDetections, SemanticLidarData, carla::sensor::data::SemanticLidarData::WriteChannelCount(), and carla::sensor::data::SemanticLidarData::WritePointsSync().
Referenced by SimulateLidar().
|
protected |
Compute all raw detection information.
Definition at line 243 of file RayCastSemanticLidar.cpp.
References carla::sensor::data::SemanticLidarDetection::cos_inc_angle, FActorRegistry::FindCarlaActor(), UCarlaEpisode::GetActorRegistry(), ASensor::GetEpisode(), FCarlaActor::GetPrimaryActorId(), ATagger::GetTagFromString(), ATagger::GetTagOfTaggedComponent(), carla::sensor::data::SemanticLidarDetection::object_idx, carla::sensor::data::SemanticLidarDetection::object_tag, and carla::sensor::data::SemanticLidarDetection::point.
Referenced by WriteDetectionAsync().
|
inlinestaticprotected |
Copies the kept detections into a flat x, y, z, intensity array (editor debug point cloud).
Definition at line 126 of file RayCastSemanticLidar.h.
Referenced by AHSSLidar::ComputeAndSaveDetections(), and ARayCastLidar::ComputeAndSaveDetections().
|
protected |
Creates a Laser for each channel.
Definition at line 76 of file RayCastSemanticLidar.cpp.
References FLidarDescription::Channels, Description, LaserAngles, FLidarDescription::LowerFovLimit, and FLidarDescription::UpperFovLimit.
Referenced by Set(), AHSSLidar::Set(), and ARayCastLidar::Set().
|
overrideprotectedvirtual |
Definition at line 51 of file RayCastSemanticLidar.cpp.
|
overridevirtual |
Multi-GPU: the runtime state this sensor starts its next tick from (noise generator, sweep angle, history).
Override only for sensors whose PostPhysTick runs whether or not anyone listens: the primary's sensor owns the state of a sensor computed by a secondary.
Reimplemented from ASensor.
Definition at line 314 of file RayCastSemanticLidar.cpp.
References carla::sensor::data::SemanticLidarData::GetHorizontalAngle(), URandomEngine::GetState(), ASensor::RandomEngine, SemanticLidarData, and State.
|
static |
Definition at line 31 of file RayCastSemanticLidar.cpp.
References UActorBlueprintFunctionLibrary::MakeLidarDefinition().
|
protectedvirtual |
Method that allow to preprocess if the rays will be traced.
Reimplemented in AHSSLidar, and ARayCastLidar.
Definition at line 206 of file RayCastSemanticLidar.cpp.
References RayPreprocessCondition.
Referenced by SimulateLidar().
|
inlinestaticprotected |
Clears every channel buffer and reserves room for a full scan.
Definition at line 81 of file RayCastSemanticLidar.h.
Referenced by ResetDetections(), AHSSLidar::ResetDetections(), and ARayCastLidar::ResetDetections().
|
protectedvirtual |
Clear the per-channel detection buffers.
Reimplemented in AHSSLidar, and ARayCastLidar.
Definition at line 216 of file RayCastSemanticLidar.cpp.
References ResetChannelDetections(), and SemanticDetections.
Referenced by SimulateLidar().
|
virtual |
Reimplemented in AHSSLidar, and ARayCastLidar.
Definition at line 92 of file RayCastSemanticLidar.cpp.
References carla::streaming::detail::token_type::get_stream_id(), ASensor::GetDataStream(), carla::ros2::ROS2::GetInstance(), ASensor::GetToken(), SemanticLidarData, and SendData().
Referenced by SendData().
|
overridevirtual |
Reimplemented from ASensor.
Reimplemented in AHSSLidar, and ARayCastLidar.
Definition at line 60 of file RayCastSemanticLidar.cpp.
References Set(), and UActorBlueprintFunctionLibrary::SetLidar().
Referenced by Set().
|
virtual |
Reimplemented in AHSSLidar, and ARayCastLidar.
Definition at line 68 of file RayCastSemanticLidar.cpp.
References FLidarDescription::Channels, CreateLasers(), Description, PointsPerChannel, and SemanticLidarData.
|
overridevirtual |
Reimplemented from ASensor.
Definition at line 323 of file RayCastSemanticLidar.cpp.
References ASensor::RandomEngine, SemanticLidarData, carla::sensor::data::SemanticLidarData::SetHorizontalAngle(), URandomEngine::SetState(), and State.
|
protected |
Shoot a laser ray-trace, return whether the laser hit something.
Definition at line 290 of file RayCastSemanticLidar.cpp.
References Description, and FLidarDescription::Range.
Referenced by SimulateLidar(), and AHSSLidar::SimulateLidar().
|
virtual |
Reimplemented in AHSSLidar.
Definition at line 122 of file RayCastSemanticLidar.cpp.
References FLidarDescription::Channels, ComputeAndSaveDetections(), Description, carla::sensor::data::SemanticLidarData::GetHorizontalAngle(), FLidarDescription::HorizontalFov, LaserAngles, FLidarDescription::PointsPerSecond, PreprocessRays(), RayPreprocessCondition, ResetDetections(), FLidarDescription::RotationFrequency, SemanticLidarData, carla::sensor::data::SemanticLidarData::SetHorizontalAngle(), ShootLaser(), SimulateLidar(), carla::geom::Math::ToDegrees(), carla::geom::Math::ToRadians(), and WriteDetectionAsync().
Referenced by SimulateLidar().
|
protectedvirtual |
Computes the detection of a hit inside the raycast ParallelFor.
Reimplemented in AHSSLidar, and ARayCastLidar.
Definition at line 220 of file RayCastSemanticLidar.cpp.
References ComputeRawDetection(), DEBUG_ASSERT, and SemanticDetections.
Referenced by SimulateLidar().
|
protected |
Definition at line 150 of file RayCastSemanticLidar.h.
Referenced by AHSSLidar::AHSSLidar(), ARayCastLidar::ARayCastLidar(), ComputeAndSaveDetections(), AHSSLidar::ComputeAndSaveDetections(), ARayCastLidar::ComputeAndSaveDetections(), AHSSLidar::ComputeDetection(), ARayCastLidar::ComputeDetection(), ARayCastLidar::ComputeIntensity(), CreateLasers(), AHSSLidar::PostprocessDetection(), ARayCastLidar::PostprocessDetection(), AHSSLidar::PreprocessRays(), ARayCastLidar::PreprocessRays(), ARayCastLidar::SendData(), Set(), AHSSLidar::Set(), ARayCastLidar::Set(), ShootLaser(), SimulateLidar(), and AHSSLidar::SimulateLidar().
|
protected |
Definition at line 152 of file RayCastSemanticLidar.h.
Referenced by CreateLasers(), SimulateLidar(), and AHSSLidar::SimulateLidar().
|
protected |
Definition at line 155 of file RayCastSemanticLidar.h.
Referenced by ComputeAndSaveDetections(), AHSSLidar::ComputeAndSaveDetections(), ARayCastLidar::ComputeAndSaveDetections(), Set(), AHSSLidar::Set(), and ARayCastLidar::Set().
|
protected |
Definition at line 154 of file RayCastSemanticLidar.h.
Referenced by PreprocessRays(), AHSSLidar::PreprocessRays(), ARayCastLidar::PreprocessRays(), SimulateLidar(), and AHSSLidar::SimulateLidar().
|
private |
Definition at line 160 of file RayCastSemanticLidar.h.
Referenced by ComputeAndSaveDetections(), ResetDetections(), and WriteDetectionAsync().
|
private |
Definition at line 158 of file RayCastSemanticLidar.h.
Referenced by ComputeAndSaveDetections(), GetMirrorState(), SendData(), Set(), SetMirrorState(), and SimulateLidar().