CARLA
Loading...
Searching...
No Matches
SignComponent.h
Go to the documentation of this file.
1// Copyright (c) 2026 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
9
10#include <util/ue-header-guard-begin.h>
11#include "CoreMinimal.h"
12#include "Components/SceneComponent.h"
13#include "Components/BoxComponent.h"
14#include <util/ue-header-guard-end.h>
15
16#include <utility>
17
18#include "SignComponent.generated.h"
19
20namespace carla
21{
22namespace road
23{
24 class Map;
25namespace element
26{
27 class RoadInfoSignal;
28}
29}
30}
31
32namespace cr = carla::road;
33namespace cre = carla::road::element;
34
35/// Class representing an OpenDRIVE Signal
36UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
37class CARLA_API USignComponent : public USceneComponent
38{
39 GENERATED_BODY()
40
41public:
42 USignComponent();
43
44 UFUNCTION(Category = "Traffic Sign", BlueprintPure)
45 const FString &GetSignId() const;
46
47 UFUNCTION(Category = "Traffic Sign", BlueprintCallable)
48 void SetSignId(const FString &Id);
49
50 // Initialize sign (e.g. generate trigger boxes)
51 virtual void InitializeSign(const cr::Map &Map);
52
53 void AddEffectTriggerVolume(UBoxComponent* TriggerVolume);
54
55 const TArray<UBoxComponent*> GetEffectTriggerVolume() const;
56
57protected:
58 // Called when the game starts
59 virtual void BeginPlay() override;
60
61 // Called every frame
62 virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
63
64 TArray<std::pair<cr::RoadId, const cre::RoadInfoSignal*>>
65 GetAllReferencesToThisSignal(const cr::Map &Map);
66
67 const cr::Signal* GetSignal(const cr::Map &Map) const;
68
69 /// Generates a trigger box component in the parent actor
70 /// BoxSize should be in Unreal units
71 UBoxComponent* GenerateTriggerBox(const FTransform &BoxTransform,
72 float BoxSize);
73
74 UBoxComponent* GenerateTriggerBox(const FTransform &BoxTransform,
75 const FVector &BoxSize);
76
77private:
78
79 UPROPERTY(Category = "Traffic Sign", EditAnywhere)
80 FString SignId = "";
81
82 UPROPERTY()
83 TArray<TObjectPtr<UBoxComponent>> EffectTriggerVolumes;
84
85};
std::map< std::string, unsigned int > road
This file contains definitions of common data structures used in traffic manager.