CARLA
Loading...
Searching...
No Matches
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.

Referenced by MakeCaptureContext().

Member Function Documentation

◆ AreClientsListening()

◆ BeginPlay()

◆ ClearReadyToTick()

void ASensor::ClearReadyToTick ( )
inline

◆ EndPlay()

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

◆ GetEpisode()

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

◆ GetReadyToTickDeltaSeconds()

float ASensor::GetReadyToTickDeltaSeconds ( ) const
inline

◆ GetSeed()

int32 ASensor::GetSeed ( ) const
inline

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

References GetSeed(), and Seed.

Referenced by GetSeed().

◆ GetToken()

◆ IsReadyToTick()

bool ASensor::IsReadyToTick ( ) const
inline

◆ IsStreamReady()

bool ASensor::IsStreamReady ( )
inline

◆ MakeCaptureContext()

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

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

◆ Set()

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

References Stream.

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.

References PrimaryTickDeltaSeconds, and PrimaryTickFrame.

◆ SetSavingDataToDisk()

void ASensor::SetSavingDataToDisk ( bool bSavingData)
inline

◆ SetSeed()

◆ Tick()

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

◆ Episode

const UCarlaEpisode* ASensor::Episode = nullptr
private

◆ OnPostTickDelegate

FDelegateHandle ASensor::OnPostTickDelegate
private

◆ PrimaryTickDeltaSeconds

float ASensor::PrimaryTickDeltaSeconds = 0.0f
private

◆ PrimaryTickFrame

uint64 ASensor::PrimaryTickFrame = MAX_uint64
private

◆ RandomEngine

◆ 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 ClearReadyToTick(), IsReadyToTick(), 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 GetReadyToTickDeltaSeconds(), 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 GetSeed(), and SetSeed().

◆ SensorDescription

FActorDescription ASensor::SensorDescription
private

◆ Stream


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