CARLA
Loading...
Searching...
No Matches
ARadar Class Reference

A ray-cast based Radar sensor. More...

#include <Radar.h>

Inheritance diagram for ARadar:

Classes

struct  RayData

Public Member Functions

 ARadar (const FObjectInitializer &ObjectInitializer)
void GetMirrorState (carla::multigpu::SensorState &State) const override
 Multi-GPU: the runtime state this sensor starts its next tick from (noise generator, sweep angle, history).
const FRadarData & GetRadarData () const
void Set (const FActorDescription &Description) override
void SetHorizontalFOV (float NewHorizontalFOV)
void SetMirrorState (const carla::multigpu::SensorState &State) override
void SetPointsPerSecond (int NewPointsPerSecond)
void SetRange (float NewRange)
void SetVerticalFOV (float NewVerticalFOV)
Public Member Functions inherited from ASensor
bool AreClientsListening ()
 ASensor (const FObjectInitializer &ObjectInitializer)
void ClearReadyToTick ()
std::optional< FActorAttribute > GetAttribute (const FString Name)
const UCarlaEpisode & GetEpisode () const
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 ()
void PostPhysTickInternal (UWorld *World, ELevelTick TickType, float DeltaSeconds)
virtual void PrePhysTick (float DeltaSeconds)
void SetDataStream (FDataStream InStream)
 Replace the FDataStream associated with this sensor.
void SetEpisode (const UCarlaEpisode &InEpisode)
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 FActorDefinition GetSensorDefinition ()
Static Public Member Functions inherited from ASensor
static FSensorCaptureContext MakeCaptureContext (const ASensor &Sensor)
 Call on the game thread right after CaptureScene().

Protected Member Functions

void BeginPlay () override
virtual void PostPhysTick (UWorld *World, ELevelTick TickType, float DeltaTime) override
Protected Member Functions inherited from ASensor
void EndPlay (EEndPlayReason::Type EndPlayReason) override
template<typename SensorType>
FAsyncDataStream GetDataStream (SensorType &&Self)
 Return the FDataStream associated with this sensor.
void PostActorCreated () override

Protected Attributes

float HorizontalFOV
int PointsPerSecond
float Range
float VerticalFOV
Protected Attributes inherited from ASensor
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 Types

using FRadarData = carla::sensor::data::RadarData

Private Member Functions

void CalculateCurrentVelocity (const float DeltaTime)
float CalculateRelativeVelocity (const FHitResult &OutHit, const FVector &RadarLocation)
void SendLineTraces (float DeltaTime)

Private Attributes

FVector CurrentVelocity
FVector PrevLocation
 Used to compute the velocity of the radar.
FRadarData RadarData
std::vector< RayData > Rays
FCollisionQueryParams TraceParams

Additional Inherited Members

Static Protected Member Functions inherited from ASensor
template<typename SensorType, typename ElementType>
static void SendDataToClient (SensorType &&Sensor, TArrayView< ElementType > SensorData, const FSensorCaptureContext &CaptureContext)

Detailed Description

A ray-cast based Radar sensor.

Definition at line 20 of file Radar.h.

Member Typedef Documentation

◆ FRadarData

Definition at line 24 of file Radar.h.

Constructor & Destructor Documentation

◆ ARadar()

ARadar::ARadar ( const FObjectInitializer & ObjectInitializer)

Definition at line 29 of file Radar.cpp.

References ASensor::RandomEngine, and TraceParams.

Member Function Documentation

◆ BeginPlay()

void ARadar::BeginPlay ( )
overrideprotectedvirtual

Reimplemented from ASensor.

Definition at line 73 of file Radar.cpp.

References PrevLocation.

◆ CalculateCurrentVelocity()

void ARadar::CalculateCurrentVelocity ( const float DeltaTime)
private

Definition at line 116 of file Radar.cpp.

References CurrentVelocity, and PrevLocation.

Referenced by PostPhysTick().

◆ CalculateRelativeVelocity()

float ARadar::CalculateRelativeVelocity ( const FHitResult & OutHit,
const FVector & RadarLocation )
private

Definition at line 214 of file Radar.cpp.

References CurrentVelocity.

Referenced by SendLineTraces().

◆ GetMirrorState()

void ARadar::GetMirrorState ( carla::multigpu::SensorState & State) const
overridevirtual

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 from ASensor.

Definition at line 228 of file Radar.cpp.

References UCarlaStatics::GetLargeMapManager(), URandomEngine::GetState(), ALargeMapManager::LocalToGlobalLocation(), PrevLocation, ASensor::RandomEngine, and State.

◆ GetRadarData()

const carla::sensor::data::RadarData & ARadar::GetRadarData ( ) const

Definition at line 69 of file Radar.cpp.

References RadarData.

◆ GetSensorDefinition()

FActorDefinition ARadar::GetSensorDefinition ( )
static

Definition at line 24 of file Radar.cpp.

References UActorBlueprintFunctionLibrary::MakeRadarDefinition().

◆ PostPhysTick()

void ARadar::PostPhysTick ( UWorld * World,
ELevelTick TickType,
float DeltaTime )
overrideprotectedvirtual

◆ SendLineTraces()

◆ Set()

void ARadar::Set ( const FActorDescription & Description)
overridevirtual

Reimplemented from ASensor.

Definition at line 42 of file Radar.cpp.

References UActorBlueprintFunctionLibrary::SetRadar().

◆ SetHorizontalFOV()

void ARadar::SetHorizontalFOV ( float NewHorizontalFOV)

Definition at line 48 of file Radar.cpp.

References HorizontalFOV.

◆ SetMirrorState()

void ARadar::SetMirrorState ( const carla::multigpu::SensorState & State)
overridevirtual

◆ SetPointsPerSecond()

void ARadar::SetPointsPerSecond ( int NewPointsPerSecond)

◆ SetRange()

void ARadar::SetRange ( float NewRange)

Definition at line 58 of file Radar.cpp.

References Range.

◆ SetVerticalFOV()

void ARadar::SetVerticalFOV ( float NewVerticalFOV)

Definition at line 53 of file Radar.cpp.

References VerticalFOV.

Member Data Documentation

◆ CurrentVelocity

FVector ARadar::CurrentVelocity
private

Definition at line 82 of file Radar.h.

Referenced by CalculateCurrentVelocity(), and CalculateRelativeVelocity().

◆ HorizontalFOV

float ARadar::HorizontalFOV
protected

Definition at line 62 of file Radar.h.

Referenced by SendLineTraces(), and SetHorizontalFOV().

◆ PointsPerSecond

int ARadar::PointsPerSecond
protected

Definition at line 68 of file Radar.h.

Referenced by SendLineTraces(), and SetPointsPerSecond().

◆ PrevLocation

FVector ARadar::PrevLocation
private

Used to compute the velocity of the radar.

Definition at line 85 of file Radar.h.

Referenced by BeginPlay(), CalculateCurrentVelocity(), GetMirrorState(), and SetMirrorState().

◆ RadarData

FRadarData ARadar::RadarData
private

Definition at line 78 of file Radar.h.

Referenced by GetRadarData(), PostPhysTick(), SendLineTraces(), and SetPointsPerSecond().

◆ Range

float ARadar::Range
protected

Definition at line 59 of file Radar.h.

Referenced by SendLineTraces(), and SetRange().

◆ Rays

std::vector<RayData> ARadar::Rays
private

Definition at line 96 of file Radar.h.

Referenced by SendLineTraces().

◆ TraceParams

FCollisionQueryParams ARadar::TraceParams
private

Definition at line 80 of file Radar.h.

Referenced by ARadar(), and SendLineTraces().

◆ VerticalFOV

float ARadar::VerticalFOV
protected

Definition at line 65 of file Radar.h.

Referenced by SendLineTraces(), and SetVerticalFOV().


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