CARLA
 
载入中...
搜索中...
未找到
TrafficLightGroup.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 "CoreMinimal.h"
10#include "GameFramework/Actor.h"
11#include "Components/SceneComponent.h"
14#include "TrafficLightGroup.generated.h"
15
17
18/// 如果你的类继承自UObject,你的类名上方需要加入 UCLASS() 宏
19/// 实现交通信号灯状态改变的类
20UCLASS()
21class CARLA_API ATrafficLightGroup : public AActor
22{
23 GENERATED_BODY()
24
25public:
26 // 设置该参与者属性的默认值
28
29 UFUNCTION(Category = "Traffic Group", BlueprintPure)
30 TArray<UTrafficLightController*>& GetControllers()
31 {
32 return Controllers;
33 }
34
35 UFUNCTION(Category = "Traffic Group", BlueprintCallable)
36 void SetFrozenGroup(bool InFreeze);
37
38 UFUNCTION(Category = "Traffic Group", BlueprintCallable)
39 bool IsFrozen() const;
40
41 UFUNCTION(Category = "Traffic Group", BlueprintPure)
42 int GetJunctionId() const;
43
44 UFUNCTION(Category = "Traffic Group", BlueprintCallable)
45 void ResetGroup();
46
47 UFUNCTION(Category = "Traffic Group", BlueprintCallable)
48 void AddController(UTrafficLightController* Controller);
49
50protected:
51 // 每帧调用
52 virtual void Tick(float DeltaTime) override;
53
54private:
55
57
58 UPROPERTY(Category = "Traffic Group", VisibleDefaultsOnly, BlueprintReadOnly, meta = (AllowPrivateAccess = "true"))
59 USceneComponent *SceneComponent;
60
61 UPROPERTY(Category = "Traffic Group", EditAnywhere)
62 TArray<UTrafficLightController*> Controllers;
63
64 UPROPERTY(Category = "Traffic Group", VisibleAnywhere)
65 int CurrentController = 0;
66
67 UFUNCTION()
68 void NextController();
69
70 UPROPERTY(Category = "Traffic Group", EditAnywhere)
71 bool bIsFrozen = false;
72
73 UPROPERTY(Category = "Traffic Group", EditAnywhere)
74 int JunctionId = -1;
75};
如果你的类继承自UObject,你的类名上方需要加入 UCLASS() 宏 实现交通信号灯状态改变的类
负责创建和分配交通灯组、控制器和组件的类。
USceneComponent * SceneComponent
从 OpenDrive 映射一个控制器。控制相关交通信号灯并包含其循环