CARLA
 
载入中...
搜索中...
未找到
SignComponent.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 "Components/SceneComponent.h"
11#include "Components/BoxComponent.h"
13#include <utility>
14#include "SignComponent.generated.h"
15
16namespace carla
17{
18namespace road
19{
20 class Map;
21namespace element
22{
23 class RoadInfoSignal;
24}
25}
26}
27
28namespace cr = carla::road;
29namespace cre = carla::road::element;
30
31/// 表示 OpenDRIVE 标志的类
32UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
33class CARLA_API USignComponent : public USceneComponent
34{
35 GENERATED_BODY()
36
37public:
38 USignComponent();
39
40 UFUNCTION(Category = "Traffic Sign", BlueprintPure)
41 const FString &GetSignId() const;
42
43 UFUNCTION(Category = "Traffic Sign", BlueprintCallable)
44 void SetSignId(const FString &Id);
45
46 // 初始化标志(例如生成触发框)
47 virtual void InitializeSign(const cr::Map &Map);
48
49 void AddEffectTriggerVolume(UBoxComponent* TriggerVolume);
50
51 const TArray<UBoxComponent*> GetEffectTriggerVolume() const;
52
53protected:
54 // 游戏开始时调用
55 virtual void BeginPlay() override;
56
57 // 每帧调用
58 virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
59
60 TArray<std::pair<cr::RoadId, const cre::RoadInfoSignal*>>
61 GetAllReferencesToThisSignal(const cr::Map &Map);
62
63 const cr::Signal* GetSignal(const cr::Map &Map) const;
64
65 /// 在父级参与者中生成触发框组件
66 /// BoxSize 应采用虚幻单位
67 UBoxComponent* GenerateTriggerBox(const FTransform &BoxTransform,
68 float BoxSize);
69
70 UBoxComponent* GenerateTriggerBox(const FTransform &BoxTransform,
71 const FVector &BoxSize);
72
73private:
74
75 UPROPERTY(Category = "Traffic Sign", EditAnywhere)
76 FString SignId = "";
77
78 UPROPERTY()
79 TArray<UBoxComponent*> EffectTriggerVolumes;
80
81};
sode override
Definition ActorData.h:280
地图类的前向声明,用于在LaneInvasionSensor类中可能的引用。
Carlaе·عܵռ
CARLA模拟器的主命名空间。
Definition Carla.cpp:139