CARLA
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static 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:

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
 

Detailed Description

Base class for sensors.

Definition at line 81 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Constructor & Destructor Documentation

◆ ASensor()

ASensor::ASensor ( const FObjectInitializer &  ObjectInitializer)

Definition at line 20 of file Sensor.cpp.

Member Function Documentation

◆ AreClientsListening()

bool ASensor::AreClientsListening ( )
inline

◆ BeginPlay()

void ASensor::BeginPlay ( )
virtual

◆ ClearReadyToTick()

void ASensor::ClearReadyToTick ( )
inline

◆ EndPlay()

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

◆ GetAttribute()

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().

◆ GetDataStream()

template<typename SensorType >
FAsyncDataStream ASensor::GetDataStream ( SensorType &&  Self)
inlineprotected

◆ GetEpisode()

const UCarlaEpisode & ASensor::GetEpisode ( ) const
inline

◆ GetMirrorState()

virtual void ASensor::GetMirrorState ( carla::multigpu::SensorState &  State) const
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().

◆ GetRandomEngine()

URandomEngine * ASensor::GetRandomEngine ( )
inline

◆ GetReadyToTickDeltaSeconds()

float ASensor::GetReadyToTickDeltaSeconds ( ) const
inline

◆ GetSeed()

int32 ASensor::GetSeed ( ) const
inline

◆ GetToken()

auto ASensor::GetToken ( ) const
inline

◆ IsReadyToTick()

bool ASensor::IsReadyToTick ( ) const
inline

◆ IsStreamReady()

bool ASensor::IsStreamReady ( )
inline

◆ MakeCaptureContext()

static FSensorCaptureContext ASensor::MakeCaptureContext ( const ASensor &  Sensor)
inlinestatic

◆ MoveDataStream()

FDataStream ASensor::MoveDataStream ( )
inline

◆ OnFirstClientConnected()

virtual void ASensor::OnFirstClientConnected ( )
inlinevirtual

◆ OnLastClientDisconnected()

virtual void ASensor::OnLastClientDisconnected ( )
inlinevirtual

◆ PostActorCreated()

void ASensor::PostActorCreated ( )
overrideprotected

Definition at line 111 of file Sensor.cpp.

◆ PostPhysTick()

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

◆ 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().

◆ PrePhysTick()

virtual void ASensor::PrePhysTick ( float  DeltaSeconds)
inlinevirtual

◆ SendDataToClient()

template<typename SensorType , typename ElementType >
static void ASensor::SendDataToClient ( SensorType &&  Sensor,
TArrayView< ElementType >  SensorData,
const FSensorCaptureContext &  CaptureContext 
)
inlinestaticprotected

◆ Set()

void ASensor::Set ( const FActorDescription &  Description)
virtual

◆ 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 103 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by FCarlaEngine::BindReplayedSensor(), and FActorSensorData::RestoreActorData().

◆ SetEpisode()

void ASensor::SetEpisode ( const UCarlaEpisode &  InEpisode)
inline

◆ SetMirrorState()

virtual void ASensor::SetMirrorState ( const carla::multigpu::SensorState &  State)
inlinevirtual

◆ SetPrimaryTick()

void ASensor::SetPrimaryTick ( float  DeltaSeconds)
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.

◆ SetSavingDataToDisk()

void ASensor::SetSavingDataToDisk ( bool  bSavingData)
inline

◆ SetSeed()

void ASensor::SetSeed ( int32  InSeed)

◆ Tick()

void ASensor::Tick ( const float  DeltaTime)
final

Member Data Documentation

◆ bClientsListening

bool ASensor::bClientsListening = false
private

Definition at line 338 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by Tick().

◆ bIsActive

bool ASensor::bIsActive = false
protected

◆ bPrimaryDrivenTick

bool ASensor::bPrimaryDrivenTick = false
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().

◆ bSavingDataToDisk

bool ASensor::bSavingDataToDisk = false
protected

◆ Episode

const UCarlaEpisode* ASensor::Episode = nullptr
private

◆ OnPostTickDelegate

FDelegateHandle ASensor::OnPostTickDelegate
private

◆ PrimaryTickDeltaSeconds

float ASensor::PrimaryTickDeltaSeconds = 0.0f
private

Definition at line 336 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by Tick().

◆ PrimaryTickFrame

uint64 ASensor::PrimaryTickFrame = MAX_uint64
private

Definition at line 334 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by Tick().

◆ RandomEngine

URandomEngine* ASensor::RandomEngine = nullptr
protected

◆ ReadyToTick

bool ASensor::ReadyToTick = false
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().

◆ ReadyToTickDeltaSeconds

float ASensor::ReadyToTickDeltaSeconds = 0.0f
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().

◆ Seed

int32 ASensor::Seed = 123456789
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().

◆ SensorDescription

FActorDescription ASensor::SensorDescription
private

◆ Stream

FDataStream ASensor::Stream
private

Definition at line 317 of file Unreal/CarlaUnreal/Plugins/Carla/Source/Carla/Sensor/Sensor.h.

Referenced by EndPlay(), and Tick().


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