CARLA
CarlaSettings.h
Go to the documentation of this file.
1 // Copyright (c) 2017 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 "Engine/StaticMesh.h"
10 
12 
13 #include "CarlaSettings.generated.h"
14 
15 /// Global settings for CARLA.
16 ///
17 /// Setting object used to hold both config settings and editable ones in one
18 /// place. To ensure the settings are saved to the specified config file make
19 /// sure to add props using the globalconfig or config meta.
20 UCLASS(BlueprintType, Blueprintable, config = Game, defaultconfig)
21 class CARLA_API UCarlaSettings : public UObject
22 {
23  GENERATED_BODY()
24 
25 public:
26 
27  /// Sets the new quality settings level and make changes in the game related
28  /// to it.
29  ///
30  /// @note This will not apply the quality settings. Use ApplyQualitySettings
31  /// functions instead
32  /// @param InQualityLevel Store the new quality.
33  UFUNCTION(BlueprintCallable, Category = "CARLA Settings")
34  void SetQualityLevel(EQualityLevel InQualityLevel)
35  {
36  QualityLevel = InQualityLevel;
37  }
38 
39  /// @return current quality settings level (could not have been applied yet).
40  UFUNCTION(BlueprintCallable, Category = "CARLA Settings")
41  EQualityLevel GetQualityLevel() const
42  {
43  return QualityLevel;
44  }
45 
46  /// Load the settings based on the command-line arguments and the INI file if
47  /// provided.
48  void LoadSettings();
49 
50  /// Load the settings from the given string (formatted as INI). CarlaServer
51  /// section is ignored.
52  void LoadSettingsFromString(const FString &INIFileContents);
53 
54  /// Log settings values.
55  void LogSettings() const;
56 
57 public:
58 
59  /// CARLA_ROAD name to tag road mesh actors.
60  static const FName CARLA_ROAD_TAG;
61 
62  /// CARLA_SKY name to tag the sky sphere (BPS) actors in the scenes.
63  static const FName CARLA_SKY_TAG;
64 
65 private:
66 
67  void LoadSettingsFromFile(const FString &FilePath, bool bLogOnFailure);
68 
69  /// File name of the settings file used to load this settings. Empty if none
70  /// used.
71  UPROPERTY(Category = "CARLA Settings|Debug", VisibleAnywhere)
72  FString CurrentFileName;
73 
74  // ===========================================================================
75  /// @name CARLA Server
76  // ===========================================================================
77  /// @{
78 
79 public:
80 
81  /// World port to listen for client connections.
82  UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
83  uint32 RPCPort = 2000u;
84 
85  /// setting for the streaming port.
86  uint32 StreamingPort = 2001u;
87 
88  /// setting for the secondary servers port.
89  uint32 SecondaryPort = 2002u;
90 
91  /// setting for the IP and Port of the primary server to connect.
92  std::string PrimaryIP = "";
93  uint32 PrimaryPort = 2002u;
94 
95  /// In synchronous mode, CARLA waits every tick until the control from the
96  /// client is received.
97  UPROPERTY(Category = "CARLA Server", VisibleAnywhere, meta = (EditCondition = bUseNetworking))
98  bool bSynchronousMode = false;
99 
100  /// Enable or disable the viewport rendering of the world. Disabled by
101  /// default.
102  UPROPERTY(Category = "CARLA Server", VisibleAnywhere)
103  bool bDisableRendering = false;
104 
105  // ===========================================================================
106  /// @name Quality Settings
107  // ===========================================================================
108  /// @{
109 
110 private:
111 
112  /// Quality Settings level.
113  UPROPERTY(Category = "Quality Settings", VisibleAnywhere, meta = (AllowPrivateAccess = "true"))
115 
116 public:
117 
118  /// Low quality Road Materials. Uses slots name to set material for each part
119  /// of the road for low quality.
120  ///
121  /// @todo Move Low quality vars to a generic map of structs with the quality
122  /// level as key.
123  UPROPERTY(Category = "Quality Settings/Low",
124  BlueprintReadOnly,
125  EditAnywhere,
126  config,
127  DisplayName = "Road Materials List for Low Quality")
128  TArray<FStaticMaterial> LowRoadMaterials;
129 
130  /// Distance at which the light function should be completely faded to
131  /// DisabledBrightness. This is useful for hiding aliasing from light
132  /// functions applied in the distance.
133  UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config)
134  float LowLightFadeDistance = 1000.0f;
135 
136  /// Default low distance for all primitive components.
137  UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config,
138  meta = (ClampMin = "5000.0", ClampMax = "20000.0", UIMin = "5000.0", UIMax = "20000.0"))
139  float LowStaticMeshMaxDrawDistance = 10000.0f;
140 
141  /// Default low distance for roads meshes.
142  UPROPERTY(Category = "Quality Settings/Low", BlueprintReadOnly, EditAnywhere, config,
143  meta = (ClampMin = "5000.0", ClampMax = "20000.0", UIMin = "5000.0", UIMax = "20000.0"))
144  float LowRoadPieceMeshMaxDrawDistance = 15000.0f;
145 
146  /// EPIC quality Road Materials. Uses slots name to set material for each part
147  /// of the road for Epic quality.
148  UPROPERTY(Category = "Quality Settings/Epic",
149  BlueprintReadOnly,
150  EditAnywhere,
151  config,
152  DisplayName = "Road Materials List for EPIC Quality")
153  TArray<FStaticMaterial> EpicRoadMaterials;
154 
155  /// Enable ROS2
156  UPROPERTY(Category = "Quality Settings/ROS2",
157  BlueprintReadOnly,
158  EditAnywhere,
159  config,
160  DisplayName = "Enable ROS2")
161  bool ROS2 = false;
162 
163  /// @}
164 };
EQualityLevel
Global settings for CARLA.
Definition: CarlaSettings.h:21
static const FName CARLA_ROAD_TAG
CARLA_ROAD name to tag road mesh actors.
Definition: CarlaSettings.h:60
static const FName CARLA_SKY_TAG
CARLA_SKY name to tag the sky sphere (BPS) actors in the scenes.
Definition: CarlaSettings.h:63