CARLA
Loading...
Searching...
No Matches
OpenDriveActor.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
11
12#include <util/ue-header-guard-begin.h>
13#include "GameFramework/Actor.h"
14#include "Components/BillboardComponent.h"
15#include "Components/SceneComponent.h"
16#include "CoreMinimal.h"
17#include <util/ue-header-guard-end.h>
18
19#include "OpenDriveActor.generated.h"
20
21UCLASS()
22class CARLA_API AOpenDriveActor : public AActor
23{
24 GENERATED_BODY()
25
26protected:
27
28 /// A UBillboardComponent to hold Icon sprite
29 UBillboardComponent *SpriteComponent;
30
31 /// Sprite for the Billboard Component
32 UTexture2D *SpriteTexture;
33
34private:
35
36 UPROPERTY()
38
39#if WITH_EDITORONLY_DATA
40 /// Generate the road network using an OpenDrive file (named as the current
41 /// .umap, or the custom one)
42 UPROPERTY(Category = "Generate", EditAnywhere)
43 bool bGenerateRoutes = false;
44#endif // WITH_EDITORONLY_DATA
45
46 /// Specify a custom path. Expected a full path to the xodr.
47 UPROPERTY(Category = "Generate", EditAnywhere)
48 FString CustomPath = "";
49
50 /// Distance between waypoints where the cars will drive
51 UPROPERTY(Category = "Generate", EditAnywhere, meta = (ClampMin = "0.01", UIMin = "0.01"))
52 float RoadAccuracy = 2.f;
53
54 /// Trigger elevantion
55 UPROPERTY(Category = "Generate", EditAnywhere, meta = (ClampMin = "0.01", UIMin = "0.01"))
56 float TriggersHeight = 100.f;
57
58#if WITH_EDITORONLY_DATA
59 /// Remove the previously generated road network. Also, it will remove
60 /// spawners if necessary
61 UPROPERTY(Category = "Generate", EditAnywhere)
62 bool bRemoveRoutes = false;
63#endif // WITH_EDITORONLY_DATA
64
65 /// If true, spawners will be placed when generating the routes
66 UPROPERTY(Category = "Spawners", EditAnywhere)
67 bool bAddSpawners = false;
68
69 /// If true, spawners will be placed on junctions too
70 UPROPERTY(Category = "Spawners", EditAnywhere)
71 bool bOnIntersections = false;
72
73 /// Determine the height where the spawners will be placed, relative to each
74 /// RoutePlanner
75 UPROPERTY(Category = "Spawners", EditAnywhere)
76 float SpawnersHeight = 300.f;
77
78#if WITH_EDITORONLY_DATA
79 /// Remove already placed spawners if necessary
80 UPROPERTY(Category = "Spawners", EditAnywhere)
81 bool bRemoveCurrentSpawners = false;
82#endif // WITH_EDITORONLY_DATA
83
84#if WITH_EDITORONLY_DATA
85 /// Show / Hide additional debug information
86 UPROPERTY(Category = "Debug", EditAnywhere)
87 bool bShowDebug = true;
88#endif // WITH_EDITORONLY_DATA
89
90public:
91
92 AOpenDriveActor(const FObjectInitializer &ObjectInitializer);
93
94 void BuildRoutes();
95
96 void BuildRoutes(FString MapName);
97
98 /// Remove all the existing ARoutePlanner and VehicleSpawners previously
99 /// generated by this class to avoid overlapping
100 void RemoveRoutes();
101
102 void DebugRoutes() const;
103
104 void RemoveDebugRoutes() const;
105
106#if WITH_EDITOR
107 void PostEditChangeProperty(struct FPropertyChangedEvent &PropertyChangedEvent);
108
109#endif // WITH_EDITOR
110
111 void AddSpawners();
112
113 void RemoveSpawners();
114
115 UPROPERTY()
117};
float TriggersHeight
Trigger elevantion.
float SpawnersHeight
Determine the height where the spawners will be placed, relative to each RoutePlanner.
AOpenDriveActor(const FObjectInitializer &ObjectInitializer)
bool bOnIntersections
If true, spawners will be placed on junctions too.
float RoadAccuracy
Distance between waypoints where the cars will drive.
bool bAddSpawners
If true, spawners will be placed when generating the routes.
void RemoveRoutes()
Remove all the existing ARoutePlanner and VehicleSpawners previously generated by this class to avoid...
UBillboardComponent * SpriteComponent
A UBillboardComponent to hold Icon sprite.
void DebugRoutes() const
UTexture2D * SpriteTexture
Sprite for the Billboard Component.
FString CustomPath
Specify a custom path. Expected a full path to the xodr.
TArray< ARoutePlanner * > RoutePlanners
TArray< AVehicleSpawnPoint * > VehicleSpawners
void RemoveDebugRoutes() const
Assign a random route to every ACarlaWheeledVehicle entering the trigger volume.
Base class for spawner locations for walkers.