CARLA
 
载入中...
搜索中...
未找到
YieldSignComponent.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" // 核心极小的:包含UE4核心编程环境的普遍存在类型(包括FString / FName / TArray 等)
10#include "SignComponent.h"
11#include "Carla/Vehicle/WheeledVehicleAIController.h"// 包含Carla中关于轮式车辆AI控制器的定义
12#include "YieldSignComponent.generated.h"// 包含UYieldSignComponent类的生成代码
13
14// UCLASS宏定义了一个新的类UYieldSignComponent,继承自USignComponent
15// ClassGroup=(Custom)将该类归入自定义类别
16// meta=(BlueprintSpawnableComponent)允许这个组件在虚幻编辑器中被蓝图脚本生成
17UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
18class CARLA_API UYieldSignComponent : public USignComponent
19{
20 GENERATED_BODY()
21
22public:
23// 覆盖基类的InitializeSign函数,用于初始化交通标志
24 virtual void InitializeSign(const carla::road::Map &Map) override;
25
26private:
27// 生成让路标志的盒子
28 void GenerateYieldBox(const FTransform BoxTransform,
29 const FVector BoxSize);
30
31 void GenerateCheckBox(const FTransform BoxTransform,
32 float BoxSize);
33
34 /// 尽量给“让路”车辆让路,并检查复选框中的车辆数量
35 UFUNCTION(BlueprintCallable)
36 void GiveWayIfPossible();
37// 延迟让路函数
38 void DelayedGiveWay(float Delay);
39
40 UFUNCTION(BlueprintCallable)
41 void OnOverlapBeginYieldEffectBox(UPrimitiveComponent *OverlappedComp,
42 AActor *OtherActor,
43 UPrimitiveComponent *OtherComp,
44 int32 OtherBodyIndex,
45 bool bFromSweep,
46 const FHitResult &SweepResult);
47// 当车辆停止与让路效果盒子重叠时调用
48 UFUNCTION(BlueprintCallable)
49 void OnOverlapEndYieldEffectBox(UPrimitiveComponent *OverlappedComp,
50 AActor *OtherActor,
51 UPrimitiveComponent *OtherComp,
52 int32 OtherBodyIndex);
53// 当有车辆开始与复选框重叠时调用
54 UFUNCTION(BlueprintCallable)
55 void OnOverlapBeginYieldCheckBox(UPrimitiveComponent *OverlappedComp,
56 AActor *OtherActor,
57 UPrimitiveComponent *OtherComp,
58 int32 OtherBodyIndex,
59 bool bFromSweep,
60 const FHitResult &SweepResult);
61// 当车辆停止与复选框重叠时调用
62 UFUNCTION(BlueprintCallable)
63 void OnOverlapEndYieldCheckBox(UPrimitiveComponent *OverlappedComp,
64 AActor *OtherActor,
65 UPrimitiveComponent *OtherComp,
66 int32 OtherBodyIndex);
67// 从两个列表中移除相同的车辆
68 void RemoveSameVehicleInBothLists();
69// 存储在让路标志中的车辆
70 UPROPERTY()
71 TSet<ACarlaWheeledVehicle*> VehiclesInYield;
72// 存储需要检查的车辆及其数量
73 UPROPERTY()
74 TMap<ACarlaWheeledVehicle*, int> VehiclesToCheck;
75};
sode override
Definition ActorData.h:280
Base class for CARLA wheeled vehicles.
地图类的前向声明,用于在LaneInvasionSensor类中可能的引用。
CARLA模拟器的主命名空间。
Definition Carla.cpp:139