|
CARLA
|
Base class for sensors. More...
#include <Sensor.h>
Inheritance diagram for ASensor:Public Member Functions | |
| bool | AreClientsListening () |
| ASensor (const FObjectInitializer &ObjectInitializer) | |
| virtual void | BeginPlay () |
| void | ClearReadyToTick () |
| std::optional< FActorAttribute > | GetAttribute (const FString Name) |
| const UCarlaEpisode & | GetEpisode () const |
| virtual void | GetMirrorState (carla::multigpu::SensorState &State) const |
| Multi-GPU: the runtime state this sensor starts its next tick from (noise generator, sweep angle, history). | |
| 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) |
| virtual void | Set (const FActorDescription &Description) |
| void | SetDataStream (FDataStream InStream) |
| Replace the FDataStream associated with this sensor. | |
| void | SetEpisode (const UCarlaEpisode &InEpisode) |
| virtual void | SetMirrorState (const carla::multigpu::SensorState &State) |
| 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 FSensorCaptureContext | MakeCaptureContext (const ASensor &Sensor) |
| Call on the game thread right after CaptureScene(). | |
Protected Member Functions | |
| 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 SensorType , typename ElementType > | |
| static void | SendDataToClient (SensorType &&Sensor, TArrayView< ElementType > SensorData, const FSensorCaptureContext &CaptureContext) |
Protected Attributes | |
| 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 | |
| bool | bClientsListening = false |
| bool | bPrimaryDrivenTick = false |
| Multi-GPU secondary: ticks are driven by the primary's frames. | |
| const UCarlaEpisode * | Episode = nullptr |
| FDelegateHandle | OnPostTickDelegate |
| float | PrimaryTickDeltaSeconds = 0.0f |
| uint64 | PrimaryTickFrame = MAX_uint64 |
| bool | ReadyToTick = false |
| Allows the sensor to tick using the configured UE5 tick interval. | |
| float | ReadyToTickDeltaSeconds = 0.0f |
| Elapsed time computed by UE5's tick scheduler for the most recent Tick(). | |
| FActorDescription | SensorDescription |
| FDataStream | Stream |
Base class for sensors.
Definition at line 81 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
| ASensor::ASensor | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 20 of file Sensor.cpp.
|
inline |
Definition at line 124 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by ADepthCamera::PostPhysTick(), ADepthCamera_WideAngleLens::PostPhysTick(), AInstanceSegmentationCamera_WideAngleLens::PostPhysTick(), ANormalsCamera::PostPhysTick(), AOpticalFlowCamera::PostPhysTick(), ASceneCaptureCamera::PostPhysTick(), ASceneCaptureCamera_RayTracedLens::PostPhysTick(), ASceneCaptureCamera_RayTracedLensDistance::PostPhysTick(), ASceneCaptureCamera_RayTracedLensInstance::PostPhysTick(), ASceneCaptureCamera_WideAngleLens::PostPhysTick(), ASemanticSegmentationCamera::PostPhysTick(), ASemanticSegmentationCamera_WideAngleLens::PostPhysTick(), ADVSCamera::PostPhysTick(), ASceneCaptureSensor::ShouldCaptureThisFrame(), and ASceneCaptureCamera_RayTracedLens::TickCaptureAndReadback().
|
virtual |
Reimplemented in AAutowareGnssSensor, AVehicleStatusSensor, AGnssSensor, AInertialMeasurementUnit, ARadar, ARayCastSemanticLidar, ASceneCaptureCamera, ASceneCaptureCamera_RayTracedLensDistance, ASceneCaptureCamera_RayTracedLensInstance, ASceneCaptureCamera_WideAngleLens, ASceneCaptureSensor, and ASceneCaptureSensor_WideAngleLens.
Definition at line 30 of file Sensor.cpp.
References UCarlaEpisode::bIsPrimaryServer, bPrimaryDrivenTick, UCarlaStatics::GetCurrentEpisode(), UCarlaEpisode::GetSensorManager(), and FSensorManager::RegisterSensor().
|
inline |
Definition at line 146 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
overrideprotected |
Definition at line 130 of file Sensor.cpp.
References FSensorManager::DeRegisterSensor(), carla::streaming::detail::token_type::get_stream_id(), UCarlaStatics::GetCurrentEpisode(), GetEpisode(), UCarlaStatics::GetGameInstance(), UCarlaEpisode::GetSensorManager(), FDataStreamTmpl< T >::GetToken(), and Stream.
| std::optional< FActorAttribute > ASensor::GetAttribute | ( | const FString | Name | ) |
Definition at line 59 of file Sensor.cpp.
References SensorDescription, and FActorDescription::Variations.
Referenced by ADVSCamera::PostPhysTick().
|
inlineprotected |
Return the FDataStream associated with this sensor.
You need to provide a reference to self, this is necessary for template deduction.
Definition at line 221 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by AVehicleStatusSensor::CollectAndStream(), ACollisionSensor::OnCollisionEvent(), AObstacleDetectionSensor::OnObstacleDetectionEvent(), AAutowareGnssSensor::PostPhysTick(), AGnssSensor::PostPhysTick(), ACustomV2XSensor::PostPhysTick(), ADVSCamera::PostPhysTick(), AInertialMeasurementUnit::PostPhysTick(), ARadar::PostPhysTick(), AV2XSensor::PostPhysTick(), ARayCastSemanticLidar::SendData(), AHSSLidar::SendData(), and ARayCastLidar::SendData().
|
inline |
Definition at line 188 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by ASceneCaptureSensor::BeginPlay(), ASceneCaptureSensor_WideAngleLens::BeginPlay(), ASceneCaptureSensor_WideAngleLens::CaptureSceneExtended(), ARayCastSemanticLidar::ComputeRawDetection(), EndPlay(), ASceneCaptureSensor::EnqueueRenderSceneImmediate(), MakeCaptureContext(), ACollisionSensor::OnCollisionEvent(), AObstacleDetectionSensor::OnObstacleDetectionEvent(), ADVSCamera::Simulation(), and ASceneCaptureCamera_RayTracedLens::TickCaptureAndReadback().
|
inlinevirtual |
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 in AAutowareGnssSensor, AGnssSensor, AInertialMeasurementUnit, ARadar, and ARayCastSemanticLidar.
Definition at line 169 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FFrameData::AddSensorTick().
|
inline |
Definition at line 174 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by UActorBlueprintFunctionLibrary::SetAutowareGnss(), UActorBlueprintFunctionLibrary::SetCustomV2X(), UActorBlueprintFunctionLibrary::SetGnss(), UActorBlueprintFunctionLibrary::SetIMU(), and UActorBlueprintFunctionLibrary::SetV2X().
|
inline |
Definition at line 151 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FFrameData::AddSensorTick().
|
inline |
Definition at line 180 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
inline |
Return the token that allows subscribing to this sensor's stream.
Definition at line 114 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FCarlaServer::FPimpl::BindActions(), FCarlaEngine::BindReplayedSensor(), AVehicleStatusSensor::CollectAndStream(), FActorRegistry::FindCarlaActorFromStream(), ACollisionSensor::OnCollisionEvent(), AObstacleDetectionSensor::OnObstacleDetectionEvent(), AAutowareGnssSensor::PostPhysTick(), AGnssSensor::PostPhysTick(), ADVSCamera::PostPhysTick(), AInertialMeasurementUnit::PostPhysTick(), ARadar::PostPhysTick(), ARayCastSemanticLidar::SendData(), AHSSLidar::SendData(), and ARayCastLidar::SendData().
|
inline |
Definition at line 141 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FFrameData::AddSensorTick(), and UCarlaLidarSubsystem::StartLidarSimulations().
|
inline |
Definition at line 119 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FCarlaEngine::BindReplayedSensor(), and AObstacleDetectionSensor::OnObstacleDetectionEvent().
|
inlinestatic |
Call on the game thread right after CaptureScene().
Definition at line 197 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
References FSensorCaptureContext::FrameIndex, UCarlaEpisode::GetElapsedGameTime(), GetEpisode(), FCarlaEngine::GetFrameCounter(), FSensorCaptureContext::RelativeTransform, FSensorCaptureContext::Timestamp, and FSensorCaptureContext::Transform.
Referenced by ASceneCaptureSensor_WideAngleLens::CaptureAndSendToClient(), ADepthCamera::PostPhysTick(), AInstanceSegmentationCamera::PostPhysTick(), ANormalsCamera::PostPhysTick(), AOpticalFlowCamera::PostPhysTick(), ASceneCaptureCamera::PostPhysTick(), ASemanticSegmentationCamera::PostPhysTick(), and ASceneCaptureCamera_RayTracedLens::TickCaptureAndReadback().
|
inline |
Definition at line 108 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FActorSensorData::RecordActorData().
|
inlinevirtual |
Reimplemented in ASceneCaptureCamera, ASceneCaptureCamera_RayTracedLens, and ASceneCaptureCamera_WideAngleLens.
Definition at line 134 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
inlinevirtual |
Reimplemented in ASceneCaptureCamera, ASceneCaptureCamera_RayTracedLens, and ASceneCaptureCamera_WideAngleLens.
Definition at line 136 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
overrideprotected |
Definition at line 111 of file Sensor.cpp.
|
inlinevirtual |
Reimplemented in AAutowareGnssSensor, AVehicleStatusSensor, ADepthCamera, ADepthCamera_WideAngleLens, AGnssSensor, AInstanceSegmentationCamera, AInstanceSegmentationCamera_WideAngleLens, ANormalsCamera, AObstacleDetectionSensor, AOpticalFlowCamera, ASceneCaptureCamera, ASceneCaptureCamera_RayTracedLens, ASceneCaptureCamera_RayTracedLensDistance, ASceneCaptureCamera_RayTracedLensInstance, ASceneCaptureCamera_WideAngleLens, ASemanticSegmentationCamera, ASemanticSegmentationCamera_WideAngleLens, ACustomV2XSensor, ADVSCamera, AInertialMeasurementUnit, ARadar, ASceneCaptureSensor, ASceneCaptureSensor_WideAngleLens, and AV2XSensor.
Definition at line 132 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by PostPhysTickInternal().
| void ASensor::PostPhysTickInternal | ( | UWorld * | World, |
| ELevelTick | TickType, | ||
| float | DeltaSeconds | ||
| ) |
Definition at line 148 of file Sensor.cpp.
References PostPhysTick(), PostPhysTickInternal(), ReadyToTick, and ReadyToTickDeltaSeconds.
Referenced by PostPhysTickInternal().
|
inlinevirtual |
Reimplemented in ACustomV2XSensor, ASceneCaptureSensor, ASceneCaptureSensor_WideAngleLens, and AV2XSensor.
Definition at line 131 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
inlinestaticprotected |
Definition at line 233 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
References carla::BufferView::CreateFrom(), FSensorCaptureContext::FrameIndex, carla::streaming::detail::token_type::get_stream_id(), carla::ros2::ROS2::GetInstance(), FSensorCaptureContext::RelativeTransform, FSensorCaptureContext::Timestamp, and FSensorCaptureContext::Transform.
Referenced by ADepthCamera::PostPhysTick(), AInstanceSegmentationCamera::PostPhysTick(), ANormalsCamera::PostPhysTick(), AOpticalFlowCamera::PostPhysTick(), ASceneCaptureCamera::PostPhysTick(), ASceneCaptureCamera_RayTracedLens::PostPhysTick(), ASceneCaptureCamera_RayTracedLensDistance::PostPhysTick(), ASceneCaptureCamera_RayTracedLensInstance::PostPhysTick(), and ASemanticSegmentationCamera::PostPhysTick().
|
virtual |
Reimplemented in AAutowareGnssSensor, AGnssSensor, AVehicleStatusSensor, ACustomV2XSensor, ADVSCamera, AInertialMeasurementUnit, ASceneCaptureCamera_RayTracedLens, ASceneCaptureCamera_RayTracedLensDistance, ASceneCaptureCamera_RayTracedLensInstance, ASceneCaptureSensor, ASceneCaptureSensor_WideAngleLens, AShaderBasedSensor, AShaderBasedSensor_WideAngleLens, AV2XSensor, AHSSLidar, AObstacleDetectionSensor, ARadar, ARayCastLidar, and ARayCastSemanticLidar.
Definition at line 45 of file Sensor.cpp.
References UActorBlueprintFunctionLibrary::ActorAttributeToFloat(), SensorDescription, and FActorDescription::Variations.
Referenced by AHSSLidar::Set(), and ARayCastLidar::Set().
|
inline |
Replace the FDataStream associated with this sensor.
Definition at line 103 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FCarlaEngine::BindReplayedSensor(), and FActorSensorData::RestoreActorData().
|
inline |
Definition at line 89 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
inlinevirtual |
Reimplemented in AAutowareGnssSensor, AGnssSensor, AInertialMeasurementUnit, ARadar, and ARayCastSemanticLidar.
Definition at line 171 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
inline |
Multi-GPU secondary: tick in this engine frame, with the primary's delta.
A mirror ticks on the primary's frames only, never on its own tick interval, so its sensor_tick phase is the primary's.
Definition at line 159 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
inline |
Definition at line 194 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
| void ASensor::SetSeed | ( | int32 | InSeed | ) |
Definition at line 104 of file Sensor.cpp.
References RandomEngine, Seed, and URandomEngine::Seed().
Referenced by AHSSLidar::AHSSLidar(), ARayCastLidar::ARayCastLidar(), AHSSLidar::Set(), ARayCastLidar::Set(), UActorBlueprintFunctionLibrary::SetAutowareGnss(), UActorBlueprintFunctionLibrary::SetCustomV2X(), UActorBlueprintFunctionLibrary::SetGnss(), UActorBlueprintFunctionLibrary::SetIMU(), and UActorBlueprintFunctionLibrary::SetV2X().
|
final |
Definition at line 69 of file Sensor.cpp.
References FDataStreamTmpl< T >::AreClientsListening(), bClientsListening, bPrimaryDrivenTick, OnFirstClientConnected(), OnLastClientDisconnected(), PrePhysTick(), PrimaryTickDeltaSeconds, PrimaryTickFrame, ReadyToTick, ReadyToTickDeltaSeconds, Stream, and Tick().
Referenced by Tick().
|
private |
Definition at line 338 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
protected |
Definition at line 310 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
private |
Multi-GPU secondary: ticks are driven by the primary's frames.
Definition at line 332 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by BeginPlay(), and Tick().
|
protected |
Definition at line 313 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by AHSSLidar::ComputeAndSaveDetections(), and ARayCastLidar::ComputeAndSaveDetections().
|
private |
Definition at line 323 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
private |
Definition at line 319 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
private |
Definition at line 336 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
private |
Definition at line 334 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
protected |
Random Engine used to provide noise for sensor output.
Definition at line 307 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by AAutowareGnssSensor::AAutowareGnssSensor(), ACustomV2XSensor::ACustomV2XSensor(), ADVSCamera::ADVSCamera(), AGnssSensor::AGnssSensor(), AHSSLidar::AHSSLidar(), AInertialMeasurementUnit::AInertialMeasurementUnit(), ARadar::ARadar(), ARayCastLidar::ARayCastLidar(), AV2XSensor::AV2XSensor(), AInertialMeasurementUnit::ComputeAccelerometerNoise(), AInertialMeasurementUnit::ComputeGyroscopeNoise(), AAutowareGnssSensor::GetMirrorState(), AGnssSensor::GetMirrorState(), AInertialMeasurementUnit::GetMirrorState(), ARadar::GetMirrorState(), ARayCastSemanticLidar::GetMirrorState(), AAutowareGnssSensor::PostPhysTick(), AGnssSensor::PostPhysTick(), AHSSLidar::PostprocessDetection(), ARayCastLidar::PostprocessDetection(), AHSSLidar::PreprocessRays(), ARayCastLidar::PreprocessRays(), ARadar::SendLineTraces(), AAutowareGnssSensor::SetMirrorState(), AGnssSensor::SetMirrorState(), AInertialMeasurementUnit::SetMirrorState(), ARadar::SetMirrorState(), ARayCastSemanticLidar::SetMirrorState(), SetSeed(), and ADVSCamera::Simulation().
|
private |
Allows the sensor to tick using the configured UE5 tick interval.
Definition at line 326 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by PostPhysTickInternal(), and Tick().
|
private |
Elapsed time computed by UE5's tick scheduler for the most recent Tick().
Definition at line 329 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by PostPhysTickInternal(), and Tick().
|
protected |
Seed of the pseudo-random engine.
Definition at line 303 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by SetSeed().
|
private |
Definition at line 321 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by GetAttribute(), and Set().
|
private |
Definition at line 317 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.