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