CARLA
 
载入中...
搜索中...
未找到
TrafficLightBase.h
浏览该文件的文档.
1// Copyright (c) 2017 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
10
13
14#include "TrafficLightBase.generated.h"
15
18
19UCLASS()
20class CARLA_API ATrafficLightBase : public ATrafficSignBase
21{
22
23 GENERATED_BODY()
24
25public:
26
27 ATrafficLightBase(const FObjectInitializer &ObjectInitializer);
28
29 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
31
32 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
34
35 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
36 void NotifyWheeledVehicle(ACarlaWheeledVehicle *Vehicle);
37
38 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
39 void UnNotifyWheeledVehicle(ACarlaWheeledVehicle *Vehicle);
40
41 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
42 void SetGreenTime(float InGreenTime);
43
44 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
45 float GetGreenTime() const;
46
47 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
48 void SetYellowTime(float InYellowTime);
49
50 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
51 float GetYellowTime() const;
52
53 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
54 void SetRedTime(float InRedTime);
55
56 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
57 float GetRedTime() const;
58
59 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
60 float GetElapsedTime() const;
61
62 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
63 void SetTimeIsFrozen(bool InTimeIsFrozen);
64
65 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
66 bool GetTimeIsFrozen() const;
67
68 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
69 void SetPoleIndex(int InPoleIndex);
70
71 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
72 int GetPoleIndex() const;
73
74 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
75 TArray<ATrafficLightBase *> GetGroupTrafficLights() const;
76
77 UFUNCTION(Category = "Traffic Light", BlueprintCallable)
78 void SetGroupTrafficLights(TArray<ATrafficLightBase *> InGroupTrafficLights);
79
80 // used from replayer
81 void SetElapsedTime(float InElapsedTime);
82
83 UFUNCTION(Category = "Traffic Light", BlueprintPure)
84 UTrafficLightComponent* GetTrafficLightComponent();
85
86 const UTrafficLightComponent* GetTrafficLightComponent() const;
87
88 // Compatibility old traffic light system with traffic light components
89 void LightChangedCompatibility(ETrafficLightState NewLightState);
90
91 void AddTimeToRecorder();
92
93protected:
94
95 UFUNCTION(Category = "Traffic Light", BlueprintImplementableEvent)
96 void OnTrafficLightStateChanged(ETrafficLightState TrafficLightState);
97
98private:
99
100 UPROPERTY(Category = "Traffic Light", VisibleAnywhere)
101 TArray<AWheeledVehicleAIController *> Vehicles;
102
103 UPROPERTY(Category = "Traffic Light", VisibleAnywhere)
104 int PoleIndex = 0;
105
106 UPROPERTY(Category = "Traffic Light", VisibleAnywhere)
107 TArray<ATrafficLightBase *> GroupTrafficLights;
108
109 UPROPERTY(Category = "Traffic Light", EditAnywhere)
110 UTrafficLightComponent * TrafficLightComponent = nullptr;
111};
Base class for CARLA wheeled vehicles.
Wheeled vehicle controller with optional AI.
void SetTrafficLightState(ETrafficLightState InTrafficLightState)
Set traffic light state currently affecting this vehicle.
ETrafficLightState GetTrafficLightState() const
Get traffic light state currently affecting this vehicle.