CARLA
Loading...
Searching...
No Matches
SensorManager.cpp
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#include "SensorManager.h"
9#include "Engine/World.h"
10#include "Sensor.h"
12
14{
15 SensorList.Emplace(Sensor);
16}
17
19{
20 SensorList.Remove(Sensor);
21}
22
23void FSensorManager::PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds)
24{
25 TRACE_CPUPROFILER_EVENT_SCOPE(FSensorManager::PostPhysTick);
26
27 UCarlaLidarSubsystem* LidarSubsystem = World ? World->GetSubsystem<UCarlaLidarSubsystem>() : nullptr;
28 if (LidarSubsystem != nullptr)
29 {
30 LidarSubsystem->StartLidarSimulations(World, DeltaSeconds);
31 }
32
33 for (ASensor * Sensor : SensorList)
34 {
35 Sensor->PostPhysTickInternal(World, TickType, DeltaSeconds);
36 }
37 // Every camera above only recorded its GPU copy; synchronize the GPU once
38 // and deliver the whole batch (one pipeline drain per tick instead of one
39 // per camera).
41
42 if (LidarSubsystem != nullptr)
43 {
44 LidarSubsystem->FinishLidarSimulations(World, DeltaSeconds);
45 }
46}
TArray< ASensor * > SensorList
void PostPhysTick(UWorld *World, ELevelTick TickType, float DeltaSeconds)
void DeRegisterSensor(ASensor *Sensor)
void RegisterSensor(ASensor *Sensor)
Subsystem responsible for simulating all ray-cast LiDARs of a world.
void FinishLidarSimulations(UWorld *World, float DeltaSeconds)
void StartLidarSimulations(UWorld *World, float DeltaSeconds)
void FlushBatchedReadbacks()