CARLA
Loading...
Searching...
No Matches
GeoTrafficSign.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
8
9#include "CoreMinimal.h"
10#include "Components/StaticMeshComponent.h"
12#include "GeoTrafficSign.generated.h"
13
14/**
15 * A traffic sign baked into a level from the regional sign catalog: a pole and a plate
16 * whose material is a constant instance of the atlas selector with the cell baked in.
17 *
18 * Being an ATrafficSignBase, ATrafficLightManager::SpawnSignals adopts it for the
19 * OpenDRIVE signal it stands at (within 5 m, TrafficSignState agreeing with the signal
20 * type/subtype) and attaches the matching USignComponent, so the map gets the regional
21 * look without a duplicate stock blueprint at the same spot.
22 */
23UCLASS()
24class CARLA_API AGeoTrafficSign : public ATrafficSignBase
25{
26 GENERATED_BODY()
27
28public:
29 AGeoTrafficSign(const FObjectInitializer &ObjectInitializer);
30
31 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Geo Sign")
32 UStaticMeshComponent* Pole;
33
34 UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Geo Sign")
35 UStaticMeshComponent* Plate;
36
37 /// Catalog identifier of the plate (e.g. "max_speed_30").
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Geo Sign")
39 FString SignName;
40
41 /// Regional style ("VC", "MUTCD", "GB").
42 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Geo Sign")
43 FString Style;
44
45 /// OpenDRIVE signal id this sign was baked for (empty for decorative signs).
46 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Geo Sign")
47 FString SignalId;
48
49 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Geo Sign")
50 FString XodrType;
51
52 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Geo Sign")
53 FString XodrSubtype;
54
55 /// Assign meshes / material and place the plate. PlateOffset is relative to the actor
56 /// (the pole base), in cm; PlateYaw in degrees turns the plate on the pole.
57 UFUNCTION(BlueprintCallable, Category = "Geo Sign")
58 void Setup(UStaticMesh* PoleMesh, UStaticMesh* PlateMesh, UMaterialInterface* PlateMaterial,
59 FVector PlateOffset, float PlateYaw, float PlateScale);
60
61 /// The ETrafficSignState the traffic-light manager matches against for an OpenDRIVE
62 /// signal type/subtype: stop, yield, or the speed-limit state for the subtype (km/h;
63 /// ETrafficSignState::SpeedLimit for values without a dedicated state — then also call
64 /// SetSpeedLimitKmh, or use ConfigureForSignal). UNKNOWN for anything else.
65 UFUNCTION(BlueprintCallable, Category = "Geo Sign")
66 static ETrafficSignState StateForSignal(const FString& Type, const FString& Subtype);
67
68 /// Set XodrType / XodrSubtype and the matching runtime state (speed limit in km/h from
69 /// the subtype) so ATrafficLightManager adopts this actor for the signal.
70 UFUNCTION(BlueprintCallable, Category = "Geo Sign")
71 void ConfigureForSignal(const FString& Type, const FString& Subtype);
72
73 /// Levels baked before every km/h value had a state carry UNKNOWN for e.g. 10 km/h signs;
74 /// derive the state from XodrType / XodrSubtype so they are adopted without a rebake.
75 virtual void PostInitializeComponents() override;
76};
ETrafficSignState
A traffic sign baked into a level from the regional sign catalog: a pole and a plate whose material i...