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/// Class representing an OpenDRIVE Signal
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 // Initialize sign (e.g. generate trigger boxes)
47 virtual void InitializeSign(const cr::Map &Map);
48
49 void AddEffectTriggerVolume(UBoxComponent* TriggerVolume);
50
51 const TArray<UBoxComponent*> GetEffectTriggerVolume() const;
52
53protected:
54 // Called when the game starts
55 virtual void BeginPlay() override;
56
57 // Called every frame
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 /// Generates a trigger box component in the parent actor
66 /// BoxSize should be in Unreal units
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};
This file contains definitions of common data structures used in traffic manager.
Definition Carla.cpp:133