CARLA
TrafficLightGroup.h
Go to the documentation of this file.
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 "CoreMinimal.h"
10 #include "GameFramework/Actor.h"
11 #include "Components/SceneComponent.h"
12 #include "TrafficLightComponent.h"
13 #include "TrafficLightController.h"
14 #include "TrafficLightGroup.generated.h"
15 
17 
18 /// Class which implements the state changing of traffic lights
19 UCLASS()
20 class CARLA_API ATrafficLightGroup : public AActor
21 {
22  GENERATED_BODY()
23 
24 public:
25  // Sets default values for this actor's properties
27 
28  UFUNCTION(Category = "Traffic Group", BlueprintPure)
29  TArray<UTrafficLightController*>& GetControllers()
30  {
31  return Controllers;
32  }
33 
34  UFUNCTION(Category = "Traffic Group", BlueprintCallable)
35  void SetFrozenGroup(bool InFreeze);
36 
37  UFUNCTION(Category = "Traffic Group", BlueprintCallable)
38  bool IsFrozen() const;
39 
40  UFUNCTION(Category = "Traffic Group", BlueprintPure)
41  int GetJunctionId() const;
42 
43  UFUNCTION(Category = "Traffic Group", BlueprintCallable)
44  void ResetGroup();
45 
46  UFUNCTION(Category = "Traffic Group", BlueprintCallable)
47  void AddController(UTrafficLightController* Controller);
48 
49 protected:
50  // Called every frame
51  virtual void Tick(float DeltaTime) override;
52 
53 private:
54 
56 
57  UPROPERTY(Category = "Traffic Group", VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
58  USceneComponent *SceneComponent;
59 
60  UPROPERTY(Category = "Traffic Group", EditAnywhere)
61  TArray<UTrafficLightController*> Controllers;
62 
63  UPROPERTY(Category = "Traffic Group", VisibleAnywhere)
64  int CurrentController = 0;
65 
66  UFUNCTION()
67  void NextController();
68 
69  UPROPERTY(Category = "Traffic Group", EditAnywhere)
70  bool bIsFrozen = false;
71 
72  UPROPERTY(Category = "Traffic Group", EditAnywhere)
73  int JunctionId = -1;
74 };
Class which implements the state changing of traffic lights.
USceneComponent * SceneComponent
Maps a controller from OpenDrive.
Class In charge of creating and assigning traffic light groups, controllers and components.