CARLA
 
载入中...
搜索中...
未找到
CarlaLightSubsystem.h
浏览该文件的文档.
1// Copyright (c) 2020 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 <vector>
10
14
15#include "Carla.h"
16#include "CoreMinimal.h"
17#include "CarlaLight.h"
18#include "Subsystems/WorldSubsystem.h"
19
20#include "CarlaLightSubsystem.generated.h"
21
22/**
23 *
24 */
25UCLASS(Blueprintable, BlueprintType)
26class CARLA_API UCarlaLightSubsystem : public UWorldSubsystem
27{
28 GENERATED_BODY()
29
30 //using cr = carla::rpc;
31
32public:
33
34 // Begin USubsystem
35 void Initialize(FSubsystemCollectionBase& Collection) override;
36 // End USubsystem
37 void Deinitialize() override;
38
39 void RegisterLight(UCarlaLight* CarlaLight);
40
41 void UnregisterLight(UCarlaLight* CarlaLight);
42
43 UFUNCTION(BlueprintCallable)
44 bool IsUpdatePending() const;
45
46 UFUNCTION(BlueprintCallable)
47 int32 NumLights() const {
48 return Lights.Num();
49 }
50
51 std::vector<carla::rpc::LightState> GetLights(FString Client);
52
53 void SetLights(
54 FString Client,
55 std::vector<carla::rpc::LightState> LightsToSet,
56 bool DiscardClient = false);
57
58 UCarlaLight* GetLight(int Id);
59
60 TMap<int, UCarlaLight* >& GetLights()
61 {
62 return Lights;
63 }
64
65 void SetDayNightCycle(const bool active);
66
67private:
68
69 void SetClientStatesdirty(FString ClientThatUpdate);
70
71 TMap<int, UCarlaLight* > Lights;
72
73 // Flag for each client to tell if an update needs to be done
74 TMap<FString, bool> ClientStates;
75 // Since the clients doesn't have a proper id on the simulation,
76 // I use the host : port pair.
77
78};
TMap< int, UCarlaLight * > Lights
TMap< int, UCarlaLight * > & GetLights()
TMap< FString, bool > ClientStates