CARLA
Loading...
Searching...
No Matches
CarlaSettings.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 "Engine/StaticMesh.h"
12#include <util/ue-header-guard-end.h>
13
14#include "CarlaSettings.generated.h"
15
16/// Global settings for CARLA.
17///
18/// Setting object used to hold both config settings and editable ones in one
19/// place. To ensure the settings are saved to the specified config file make
20/// sure to add props using the globalconfig or config meta.
21UCLASS(BlueprintType, Blueprintable, config = Game, defaultconfig)
22class CARLA_API UCarlaSettings : public UObject
23{
24 GENERATED_BODY()
25
26public:
27
28 /// Sets the new quality settings level and make changes in the game related
29 /// to it.
30 ///
31 /// @note This will not apply the quality settings. Use ApplyQualitySettings
32 /// functions instead
33 /// @param InQualityLevel Store the new quality.
34 UFUNCTION(BlueprintCallable, Category = "CARLA Settings")
35 void SetQualityLevel(EQualityLevel InQualityLevel)
36 {
37 QualityLevel = InQualityLevel;
38 }
39
40 /// @return current quality settings level (could not have been applied yet).
41 UFUNCTION(BlueprintCallable, Category = "CARLA Settings")
43 {
44 return QualityLevel;
45 }
46
47 /// Load the settings based on the command-line arguments and the INI file if
48 /// provided.
49 void LoadSettings();
50
51 /// Load the settings from the given string (formatted as INI). CarlaServer
52 /// section is ignored.
53 void LoadSettingsFromString(const FString &INIFileContents);
54
55 /// Log settings values.
56 void LogSettings() const;
57
58public:
59
60 /// CARLA_ROAD name to tag road mesh actors.
61 static const FName CARLA_ROAD_TAG;
62
63 /// CARLA_SKY name to tag the sky sphere (BPS) actors in the scenes.
64 static const FName CARLA_SKY_TAG;
65
66private:
67
68 void LoadSettingsFromFile(const FString &FilePath, bool bLogOnFailure);
69
70 /// File name of the settings file used to load this settings. Empty if none
71 /// used.
72 UPROPERTY(Category = "CARLA Settings|Debug", VisibleAnywhere)
74
75 // ===========================================================================
76 /// @name CARLA Server
77 // ===========================================================================
78 /// @{
79
80public:
81
82 /// World port to listen for client connections.
83 UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
84 uint32 RPCPort = 2000u;
85
86 /// setting for the streaming port.
87 uint32 StreamingPort = 2001u;
88
89 /// setting for the secondary servers port.
90 uint32 SecondaryPort = 2002u;
91
92 /// setting for the IP and Port of the primary server to connect.
93 std::string PrimaryIP = "";
94 uint32 PrimaryPort = 2002u;
95
96 /// In synchronous mode, CARLA waits every tick until the control from the
97 /// client is received.
98 UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
99 bool bSynchronousMode = false;
100
101 /// Enable or disable the viewport rendering of the world. Disabled by
102 /// default.
103 UPROPERTY(Category = "CARLA Server", VisibleAnywhere)
104 bool bDisableRendering = false;
105
106 // ===========================================================================
107 /// @name Quality Settings
108 // ===========================================================================
109 /// @{
110
111private:
112
113 /// Quality Settings level.
114 UPROPERTY(Category = "Quality Settings", VisibleAnywhere, meta = (AllowPrivateAccess = "true"))
116
117public:
118
119 /// EPIC quality Road Materials. Uses slots name to set material for each part
120 /// of the road for Epic quality.
121 UPROPERTY(Category = "Quality Settings/Epic",
122 BlueprintReadOnly,
123 EditAnywhere,
124 config,
125 DisplayName = "Road Materials List for EPIC Quality")
126 TArray<FStaticMaterial> EpicRoadMaterials;
127
128 /// Enable ROS2
129 UPROPERTY(Category = "Quality Settings/ROS2",
130 BlueprintReadOnly,
131 EditAnywhere,
132 config,
133 DisplayName = "Enable ROS2")
134 bool ROS2 = false;
135
136 /// Default ROS2 topic visibility on startup. When true, every topic offered by
137 /// the implementation is visible from the beginning; when false, only the
138 /// sensors/actors explicitly enabled via EnableForROS calls are visible.
139 UPROPERTY(Category = "Quality Settings/ROS2",
140 BlueprintReadOnly,
141 EditAnywhere,
142 config,
143 DisplayName = "ROS2 Topics Visible On Startup")
144 bool ROS2TopicVisibility = true;
145
146 /// DDS middleware (RMW) used by the native ROS2 connector. Accepted values:
147 /// "fastdds" (default) and "cyclonedds". Set via the --rmw= command-line
148 /// argument. CycloneDDS is only available on Linux.
149 UPROPERTY(Category = "Quality Settings/ROS2",
150 BlueprintReadOnly,
151 EditAnywhere,
152 config,
153 DisplayName = "ROS2 RMW")
154 FString RmwName = TEXT("fastdds");
155
156 /// ROS2 domain id. Set via --ros-domain-id=<N> on the command line.
157 /// -1 (the default) keeps each middleware's native default domain.
158 UPROPERTY(Category = "Quality Settings/ROS2",
159 BlueprintReadOnly,
160 EditAnywhere,
161 config,
162 DisplayName = "ROS2 Domain ID")
163 int32 ROS2DomainId = -1;
164
165 /// @}
166};
EQualityLevel
Global settings for CARLA.
uint32 StreamingPort
setting for the streaming port.
std::string PrimaryIP
setting for the IP and Port of the primary server to connect.
bool bDisableRendering
Enable or disable the viewport rendering of the world.
EQualityLevel GetQualityLevel() const
uint32 RPCPort
World port to listen for client connections.
static const FName CARLA_SKY_TAG
CARLA_SKY name to tag the sky sphere (BPS) actors in the scenes.
FString CurrentFileName
File name of the settings file used to load this settings.
void SetQualityLevel(EQualityLevel InQualityLevel)
Sets the new quality settings level and make changes in the game related to it.
void LoadSettingsFromFile(const FString &FilePath, bool bLogOnFailure)
bool bSynchronousMode
In synchronous mode, CARLA waits every tick until the control from the client is received.
UPROPERTY(Category="Quality Settings/Epic", BlueprintReadOnly, EditAnywhere, config, DisplayName="Road Materials List for EPIC Quality") TArray< FStaticMaterial > EpicRoadMaterials
EPIC quality Road Materials.
static const FName CARLA_ROAD_TAG
CARLA_ROAD name to tag road mesh actors.
EQualityLevel QualityLevel
Quality Settings level.
uint32 SecondaryPort
setting for the secondary servers port.