Base class for sensors. More...
#include <Sensor.h>
Public Member Functions | |
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 () |
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. More... | |
void | SetEpisode (const UCarlaEpisode &InEpisode) |
void | SetSeed (int32 InSeed) |
void | Tick (const float DeltaTime) final |
Protected Member Functions | |
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 | |
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... | |
Private Attributes | |
bool | bClientsListening = false |
const UCarlaEpisode * | Episode = nullptr |
FDelegateHandle | OnPostTickDelegate |
bool | ReadyToTick = false |
Allows the sensor to tick with the tick rate from UE4. More... | |
FActorDescription | SensorDescription |
FDataStream | Stream |
Base class for sensors.
Definition at line 23 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
ASensor::ASensor | ( | const FObjectInitializer & | ObjectInitializer | ) |
Definition at line 17 of file Sensor.cpp.
|
virtual |
Reimplemented in ASceneCaptureSensor, AInertialMeasurementUnit, AGnssSensor, ARadar, and ASceneCaptureCamera.
Definition at line 27 of file Sensor.cpp.
References Episode, UCarlaStatics::GetCurrentEpisode(), UCarlaEpisode::GetSensorManager(), and FSensorManager::RegisterSensor().
|
overrideprotected |
Definition at line 113 of file Sensor.cpp.
References FSensorManager::DeRegisterSensor(), Episode, UCarlaStatics::GetCurrentEpisode(), GetEpisode(), UCarlaStatics::GetGameInstance(), UCarlaEpisode::GetSensorManager(), FDataStreamTmpl< T >::GetToken(), and Stream.
boost::optional< FActorAttribute > ASensor::GetAttribute | ( | const FString | Name | ) |
Definition at line 49 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 110 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by ACollisionSensor::OnCollisionEvent(), AObstacleDetectionSensor::OnObstacleDetectionEvent(), AGnssSensor::PostPhysTick(), AInertialMeasurementUnit::PostPhysTick(), ARayCastLidar::PostPhysTick(), ARayCastSemanticLidar::PostPhysTick(), ARadar::PostPhysTick(), and ADVSCamera::PostPhysTick().
|
inline |
Definition at line 93 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by ASceneCaptureSensor::BeginPlay(), ARayCastSemanticLidar::ComputeRawDetection(), EndPlay(), ACollisionSensor::OnCollisionEvent(), AObstacleDetectionSensor::OnObstacleDetectionEvent(), and ADVSCamera::Simulation().
|
inline |
Definition at line 79 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by UActorBlueprintFunctionLibrary::SetGnss(), UActorBlueprintFunctionLibrary::SetIMU(), and UActorBlueprintFunctionLibrary::SetRadar().
|
inline |
Definition at line 85 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
inline |
Return the token that allows subscribing to this sensor's stream.
Definition at line 56 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FActorRegistry::GetDescriptionFromStream(), ACollisionSensor::OnCollisionEvent(), AObstacleDetectionSensor::OnObstacleDetectionEvent(), AGnssSensor::PostPhysTick(), AInertialMeasurementUnit::PostPhysTick(), ARayCastLidar::PostPhysTick(), ARayCastSemanticLidar::PostPhysTick(), ARadar::PostPhysTick(), and ADVSCamera::PostPhysTick().
|
inline |
Definition at line 61 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by AObstacleDetectionSensor::OnObstacleDetectionEvent().
|
inline |
Definition at line 50 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FActorSensorData::RecordActorData().
|
inlinevirtual |
Reimplemented in ASceneCaptureCamera.
Definition at line 71 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
inlinevirtual |
Reimplemented in ASceneCaptureCamera.
Definition at line 73 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
overrideprotected |
Definition at line 94 of file Sensor.cpp.
|
inlinevirtual |
Reimplemented in ASceneCaptureSensor, ADVSCamera, ARadar, ARayCastSemanticLidar, ARayCastLidar, AInertialMeasurementUnit, AGnssSensor, ASceneCaptureCamera, AInstanceSegmentationCamera, AObstacleDetectionSensor, ADepthCamera, ANormalsCamera, ASemanticSegmentationCamera, and AOpticalFlowCamera.
Definition at line 69 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by PostPhysTickInternal().
void ASensor::PostPhysTickInternal | ( | UWorld * | World, |
ELevelTick | TickType, | ||
float | DeltaSeconds | ||
) |
Definition at line 131 of file Sensor.cpp.
References PostPhysTick(), and ReadyToTick.
|
inlinevirtual |
Reimplemented in ASceneCaptureSensor.
Definition at line 68 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
virtual |
Reimplemented in ASceneCaptureSensor, AShaderBasedSensor, ADVSCamera, ARayCastSemanticLidar, ARayCastLidar, AGnssSensor, AInertialMeasurementUnit, ARadar, and AObstacleDetectionSensor.
Definition at line 35 of file Sensor.cpp.
References UActorBlueprintFunctionLibrary::ActorAttributeToFloat(), SensorDescription, and FActorDescription::Variations.
Referenced by ARayCastLidar::Set().
|
inline |
Replace the FDataStream associated with this sensor.
Definition at line 45 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by FActorSensorData::RestoreActorData().
|
inline |
Definition at line 31 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
void ASensor::SetSeed | ( | int32 | InSeed | ) |
Definition at line 87 of file Sensor.cpp.
References RandomEngine, URandomEngine::Seed(), and Seed.
Referenced by ARayCastLidar::ARayCastLidar(), UActorBlueprintFunctionLibrary::SetGnss(), UActorBlueprintFunctionLibrary::SetIMU(), and UActorBlueprintFunctionLibrary::SetRadar().
|
final |
Definition at line 59 of file Sensor.cpp.
References FDataStreamTmpl< T >::AreClientsListening(), bClientsListening, OnFirstClientConnected(), OnLastClientDisconnected(), PrePhysTick(), ReadyToTick, and Stream.
|
private |
Definition at line 139 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by Tick().
|
protected |
Definition at line 124 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
private |
Definition at line 134 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by BeginPlay(), EndPlay(), ACollisionSensor::OnCollisionEvent(), and AObstacleDetectionSensor::OnObstacleDetectionEvent().
|
private |
Definition at line 130 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
|
protected |
Random Engine used to provide noise for sensor output.
Definition at line 121 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by ADVSCamera::ADVSCamera(), AGnssSensor::AGnssSensor(), AInertialMeasurementUnit::AInertialMeasurementUnit(), ARadar::ARadar(), ARayCastLidar::ARayCastLidar(), AInertialMeasurementUnit::ComputeAccelerometerNoise(), AInertialMeasurementUnit::ComputeGyroscopeNoise(), AGnssSensor::PostPhysTick(), ARayCastLidar::PostprocessDetection(), ARayCastLidar::PreprocessRays(), ARadar::SendLineTraces(), SetSeed(), and ADVSCamera::Simulation().
|
private |
Allows the sensor to tick with the tick rate from UE4.
Definition at line 137 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by PostPhysTickInternal(), and Tick().
|
protected |
Seed of the pseudo-random engine.
Definition at line 117 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by SetSeed().
|
private |
Definition at line 132 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by GetAttribute(), and Set().
|
private |
Definition at line 128 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.
Referenced by EndPlay(), AGnssSensor::PostPhysTick(), AInertialMeasurementUnit::PostPhysTick(), ADVSCamera::PostPhysTick(), and Tick().