CARLA
Toggle main menu visibility
Loading...
Searching...
No Matches
Unreal
CarlaUnreal
Plugins
Carla
Source
Carla
OpenDrive
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
9
#include "
Traffic/RoutePlanner.h
"
10
#include "
Vehicle/VehicleSpawnPoint.h
"
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
21
UCLASS()
22
class CARLA_API
AOpenDriveActor
: public
AActor
23
{
24
GENERATED_BODY()
25
26
protected
:
27
28
/// A UBillboardComponent to hold Icon sprite
29
UBillboardComponent *
SpriteComponent
;
30
31
/// Sprite for the Billboard Component
32
UTexture2D *
SpriteTexture
;
33
34
private
:
35
36
UPROPERTY()
37
TArray<
AVehicleSpawnPoint
*>
VehicleSpawners
;
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
90
public
:
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()
116
TArray<
ARoutePlanner
*>
RoutePlanners
;
117
};
RoutePlanner.h
VehicleSpawnPoint.h
AActor
AOpenDriveActor::TriggersHeight
float TriggersHeight
Trigger elevantion.
Definition
OpenDriveActor.h:56
AOpenDriveActor::SpawnersHeight
float SpawnersHeight
Determine the height where the spawners will be placed, relative to each RoutePlanner.
Definition
OpenDriveActor.h:76
AOpenDriveActor::AOpenDriveActor
AOpenDriveActor(const FObjectInitializer &ObjectInitializer)
Definition
OpenDriveActor.cpp:29
AOpenDriveActor::bOnIntersections
bool bOnIntersections
If true, spawners will be placed on junctions too.
Definition
OpenDriveActor.h:71
AOpenDriveActor::RoadAccuracy
float RoadAccuracy
Distance between waypoints where the cars will drive.
Definition
OpenDriveActor.h:52
AOpenDriveActor::bAddSpawners
bool bAddSpawners
If true, spawners will be placed when generating the routes.
Definition
OpenDriveActor.h:67
AOpenDriveActor::AddSpawners
void AddSpawners()
Definition
OpenDriveActor.cpp:279
AOpenDriveActor::RemoveRoutes
void RemoveRoutes()
Remove all the existing ARoutePlanner and VehicleSpawners previously generated by this class to avoid...
Definition
OpenDriveActor.cpp:248
AOpenDriveActor::SpriteComponent
UBillboardComponent * SpriteComponent
A UBillboardComponent to hold Icon sprite.
Definition
OpenDriveActor.h:29
AOpenDriveActor::BuildRoutes
void BuildRoutes()
Definition
OpenDriveActor.cpp:135
AOpenDriveActor::DebugRoutes
void DebugRoutes() const
Definition
OpenDriveActor.cpp:261
AOpenDriveActor::SpriteTexture
UTexture2D * SpriteTexture
Sprite for the Billboard Component.
Definition
OpenDriveActor.h:32
AOpenDriveActor::CustomPath
FString CustomPath
Specify a custom path. Expected a full path to the xodr.
Definition
OpenDriveActor.h:48
AOpenDriveActor::RemoveSpawners
void RemoveSpawners()
Definition
OpenDriveActor.cpp:301
AOpenDriveActor::RoutePlanners
TArray< ARoutePlanner * > RoutePlanners
Definition
OpenDriveActor.h:116
AOpenDriveActor::VehicleSpawners
TArray< AVehicleSpawnPoint * > VehicleSpawners
Definition
OpenDriveActor.h:37
AOpenDriveActor::RemoveDebugRoutes
void RemoveDebugRoutes() const
Definition
OpenDriveActor.cpp:272
ARoutePlanner
Assign a random route to every ACarlaWheeledVehicle entering the trigger volume.
Definition
RoutePlanner.h:25
AVehicleSpawnPoint
Base class for spawner locations for walkers.
Definition
VehicleSpawnPoint.h:18
Generated by
1.18.0