CARLA
SignComponent.h
Go to the documentation of this file.
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 
16 namespace carla
17 {
18 namespace road
19 {
20  class Map;
21 namespace element
22 {
23  class RoadInfoSignal;
24 }
25 }
26 }
27 
28 namespace cr = carla::road;
29 namespace cre = carla::road::element;
30 
31 /// Class representing an OpenDRIVE Signal
32 UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
33 class CARLA_API USignComponent : public USceneComponent
34 {
35  GENERATED_BODY()
36 
37 public:
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 
53 protected:
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  /// Generates a trigger box component in the parent actor
64  /// BoxSize should be in Unreal units
65  UBoxComponent* GenerateTriggerBox(const FTransform &BoxTransform,
66  float BoxSize);
67 
68 private:
69 
70  UPROPERTY(Category = "Traffic Sign", EditAnywhere)
71  FString SignId = "";
72 
73  UPROPERTY()
74  TArray<UBoxComponent*> EffectTriggerVolumes;
75 
76 };
std::string SignId
Definition: RoadTypes.h:25
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:99