CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
Sensor
CarlaLidarSubsystem.h
Go to the documentation of this file.
1
// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2
// de Barcelona (UAB).
3
//
4
// This work is licensed under the terms of the MIT license.
5
// For a copy, see <https://opensource.org/licenses/MIT>.
6
7
#pragma once
8
9
#include <util/ue-header-guard-begin.h>
10
#include "CoreMinimal.h"
11
#include "Subsystems/WorldSubsystem.h"
12
#include "Async/TaskGraphInterfaces.h"
13
#include <util/ue-header-guard-end.h>
14
15
#include "CarlaLidarSubsystem.generated.h"
16
17
class
ARayCastSemanticLidar
;
18
19
/// Subsystem responsible for simulating all ray-cast LiDARs of a world.
20
///
21
/// Registered LiDARs are simulated asynchronously via TaskGraph high-priority
22
/// worker tasks while the Game Thread processes remaining sensors (cameras, etc.).
23
/// FSensorManager::PostPhysTick calls StartLidarSimulations() at the beginning of
24
/// the post-physics tick, and FinishLidarSimulations() after other sensors finish.
25
UCLASS()
26
class CARLA_API
UCarlaLidarSubsystem
: public
UWorldSubsystem
27
{
28
GENERATED_BODY()
29
30
public
:
31
32
virtual
void
Deinitialize
()
override
;
33
34
void
RegisterLidar
(
ARayCastSemanticLidar
*Lidar);
35
36
void
UnregisterLidar
(
ARayCastSemanticLidar
*Lidar);
37
38
bool
HasActiveLidars
()
const
39
{
40
return
ActiveLidars
.Num() > 0;
41
}
42
43
int32
GetActiveLidarCount
()
const
44
{
45
return
ActiveLidars
.Num();
46
}
47
48
void
StartLidarSimulations(UWorld *World,
float
DeltaSeconds);
49
50
void
FinishLidarSimulations(UWorld *World,
float
DeltaSeconds);
51
52
private
:
53
54
TArray<TWeakObjectPtr<ARayCastSemanticLidar>>
ActiveLidars
;
55
56
/// LiDARs due this frame, snapshotted on the game thread for the simulation task.
57
TArray<TObjectPtr<ARayCastSemanticLidar>>
LidarsToSimulate
;
58
59
FGraphEventRef
LidarSimulationTask
;
60
};
ARayCastSemanticLidar
A ray-cast based Lidar sensor.
Definition
RayCastSemanticLidar.h:29
UCarlaLidarSubsystem
Subsystem responsible for simulating all ray-cast LiDARs of a world.
Definition
CarlaLidarSubsystem.h:27
UCarlaLidarSubsystem::RegisterLidar
void RegisterLidar(ARayCastSemanticLidar *Lidar)
Definition
CarlaLidarSubsystem.cpp:35
UCarlaLidarSubsystem::Deinitialize
virtual void Deinitialize() override
Definition
CarlaLidarSubsystem.cpp:23
UCarlaLidarSubsystem::GetActiveLidarCount
int32 GetActiveLidarCount() const
Definition
CarlaLidarSubsystem.h:43
UCarlaLidarSubsystem::LidarsToSimulate
TArray< TObjectPtr< ARayCastSemanticLidar > > LidarsToSimulate
LiDARs due this frame, snapshotted on the game thread for the simulation task.
Definition
CarlaLidarSubsystem.h:57
UCarlaLidarSubsystem::LidarSimulationTask
FGraphEventRef LidarSimulationTask
Definition
CarlaLidarSubsystem.h:59
UCarlaLidarSubsystem::HasActiveLidars
bool HasActiveLidars() const
Definition
CarlaLidarSubsystem.h:38
UCarlaLidarSubsystem::UnregisterLidar
void UnregisterLidar(ARayCastSemanticLidar *Lidar)
Definition
CarlaLidarSubsystem.cpp:50
UCarlaLidarSubsystem::ActiveLidars
TArray< TWeakObjectPtr< ARayCastSemanticLidar > > ActiveLidars
Definition
CarlaLidarSubsystem.h:54
UWorldSubsystem
Generated by
1.18.0