CARLA
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
ASensor Class Reference

Base class for sensors. More...

#include <Sensor.h>

+ Inheritance diagram for ASensor:
+ Collaboration diagram for ASensor:

Public Member Functions

 ASensor (const FObjectInitializer &ObjectInitializer)
 
virtual void BeginPlay ()
 
URandomEngineGetRandomEngine ()
 
int32 GetSeed () const
 
auto GetToken () const
 Return the token that allows subscribing to this sensor's stream. More...
 
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...
 
const UCarlaEpisodeGetEpisode () const
 
void PostActorCreated () override
 

Protected Attributes

bool bIsActive = false
 
URandomEngineRandomEngine = 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 UCarlaEpisodeEpisode = nullptr
 
FDelegateHandle OnPostTickDelegate
 
bool ReadyToTick = false
 Allows the sensor to tick with the tick rate from UE4. More...
 
FDataStream Stream
 

Detailed Description

Base class for sensors.

Definition at line 21 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Constructor & Destructor Documentation

◆ ASensor()

ASensor::ASensor ( const FObjectInitializer &  ObjectInitializer)

Definition at line 15 of file Sensor.cpp.

Member Function Documentation

◆ BeginPlay()

void ASensor::BeginPlay ( )
virtual

Reimplemented in ASceneCaptureSensor, AInertialMeasurementUnit, AGnssSensor, ARadar, and ASceneCaptureCamera.

Definition at line 25 of file Sensor.cpp.

References Episode, UCarlaStatics::GetCurrentEpisode(), UCarlaEpisode::GetSensorManager(), and FSensorManager::RegisterSensor().

+ Here is the call graph for this function:

◆ EndPlay()

void ASensor::EndPlay ( EEndPlayReason::Type  EndPlayReason)
overrideprotected

Definition at line 98 of file Sensor.cpp.

References FSensorManager::DeRegisterSensor(), Episode, UCarlaStatics::GetCurrentEpisode(), GetEpisode(), UCarlaStatics::GetGameInstance(), UCarlaEpisode::GetSensorManager(), FDataStreamTmpl< T >::GetToken(), and Stream.

+ Here is the call graph for this function:

◆ GetDataStream()

template<typename SensorT >
FAsyncDataStream ASensor::GetDataStream ( const SensorT &  Self)
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 101 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().

+ Here is the caller graph for this function:

◆ GetEpisode()

const UCarlaEpisode& ASensor::GetEpisode ( ) const
inlineprotected

Definition at line 90 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().

+ Here is the caller graph for this function:

◆ GetRandomEngine()

URandomEngine* ASensor::GetRandomEngine ( )
inline

Definition at line 70 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by UActorBlueprintFunctionLibrary::SetGnss(), UActorBlueprintFunctionLibrary::SetIMU(), and UActorBlueprintFunctionLibrary::SetRadar().

+ Here is the caller graph for this function:

◆ GetSeed()

int32 ASensor::GetSeed ( ) const
inline

◆ GetToken()

auto ASensor::GetToken ( ) const
inline

Return the token that allows subscribing to this sensor's stream.

Definition at line 52 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

◆ MoveDataStream()

FDataStream ASensor::MoveDataStream ( )
inline

Definition at line 46 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by FActorSensorData::RecordActorData().

+ Here is the caller graph for this function:

◆ OnFirstClientConnected()

virtual void ASensor::OnFirstClientConnected ( )
inlinevirtual

Reimplemented in ASceneCaptureCamera.

Definition at line 62 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by Tick().

+ Here is the caller graph for this function:

◆ OnLastClientDisconnected()

virtual void ASensor::OnLastClientDisconnected ( )
inlinevirtual

Reimplemented in ASceneCaptureCamera.

Definition at line 64 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by Tick().

+ Here is the caller graph for this function:

◆ PostActorCreated()

void ASensor::PostActorCreated ( )
overrideprotected

Definition at line 79 of file Sensor.cpp.

◆ PostPhysTick()

virtual void ASensor::PostPhysTick ( UWorld *  World,
ELevelTick  TickType,
float  DeltaSeconds 
)
inlinevirtual

Reimplemented in ASceneCaptureSensor, ADVSCamera, ARadar, ARayCastSemanticLidar, ARayCastLidar, AInertialMeasurementUnit, AGnssSensor, ASceneCaptureCamera, AInstanceSegmentationCamera, AObstacleDetectionSensor, ADepthCamera, ANormalsCamera, ASemanticSegmentationCamera, and AOpticalFlowCamera.

Definition at line 60 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by PostPhysTickInternal().

+ Here is the caller graph for this function:

◆ PostPhysTickInternal()

void ASensor::PostPhysTickInternal ( UWorld *  World,
ELevelTick  TickType,
float  DeltaSeconds 
)

Definition at line 118 of file Sensor.cpp.

References PostPhysTick(), and ReadyToTick.

+ Here is the call graph for this function:

◆ PrePhysTick()

virtual void ASensor::PrePhysTick ( float  DeltaSeconds)
inlinevirtual

Reimplemented in ASceneCaptureSensor.

Definition at line 59 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by Tick().

+ Here is the caller graph for this function:

◆ Set()

void ASensor::Set ( const FActorDescription Description)
virtual

Reimplemented in AShaderBasedSensor, ADVSCamera, ASceneCaptureSensor, ARayCastSemanticLidar, ARayCastLidar, AGnssSensor, AInertialMeasurementUnit, ARadar, and AObstacleDetectionSensor.

Definition at line 33 of file Sensor.cpp.

References UActorBlueprintFunctionLibrary::ActorAttributeToFloat(), and FActorDescription::Variations.

Referenced by ARayCastLidar::Set().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDataStream()

void ASensor::SetDataStream ( FDataStream  InStream)
inline

Replace the FDataStream associated with this sensor.

Warning
Do not change the stream after BeginPlay. It is not thread-safe.

Definition at line 41 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by FActorSensorData::RestoreActorData().

+ Here is the caller graph for this function:

◆ SetEpisode()

void ASensor::SetEpisode ( const UCarlaEpisode InEpisode)
inline

◆ SetSeed()

void ASensor::SetSeed ( int32  InSeed)

Definition at line 72 of file Sensor.cpp.

References RandomEngine, URandomEngine::Seed(), and Seed.

Referenced by ARayCastLidar::ARayCastLidar(), UActorBlueprintFunctionLibrary::SetGnss(), UActorBlueprintFunctionLibrary::SetIMU(), and UActorBlueprintFunctionLibrary::SetRadar().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Tick()

void ASensor::Tick ( const float  DeltaTime)
final

Definition at line 44 of file Sensor.cpp.

References FDataStreamTmpl< T >::AreClientsListening(), bClientsListening, OnFirstClientConnected(), OnLastClientDisconnected(), PrePhysTick(), ReadyToTick, and Stream.

+ Here is the call graph for this function:

Member Data Documentation

◆ bClientsListening

bool ASensor::bClientsListening = false
private

Definition at line 128 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by Tick().

◆ bIsActive

bool ASensor::bIsActive = false
protected

◆ Episode

const UCarlaEpisode* ASensor::Episode = nullptr
private

◆ OnPostTickDelegate

FDelegateHandle ASensor::OnPostTickDelegate
private

◆ RandomEngine

URandomEngine* ASensor::RandomEngine = nullptr
protected

◆ ReadyToTick

bool ASensor::ReadyToTick = false
private

Allows the sensor to tick with the tick rate from UE4.

Definition at line 126 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by PostPhysTickInternal(), and Tick().

◆ Seed

int32 ASensor::Seed = 123456789
protected

Seed of the pseudo-random engine.

Definition at line 108 of file Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by SetSeed().

◆ Stream

FDataStream ASensor::Stream
private

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