Close #497 add option to config file to disable bikes and motorbikes

This commit is contained in:
nsubiron 2018-06-13 18:58:12 +02:00
parent f9094d4c52
commit e67295e4af
4 changed files with 14 additions and 2 deletions

View File

@ -45,6 +45,10 @@ WeatherId=1
SeedVehicles=123456789
SeedPedestrians=123456789
; Disable bikes and motorbikes, if true only four-wheeled vehicles will be
; spawned.
DisableTwoWheeledVehicles=false
[CARLA/Sensor]
; Names of the sensors to be attached to the player, comma-separated, each of
; them should be defined in its own subsection.

View File

@ -45,6 +45,7 @@ class CarlaSettings(object):
self.WeatherId = 1
self.SeedVehicles = None
self.SeedPedestrians = None
self.DisableTwoWheeledVehicles = False
self.set(**kwargs)
self._sensors = []
@ -101,7 +102,8 @@ class CarlaSettings(object):
'NumberOfPedestrians',
'WeatherId',
'SeedVehicles',
'SeedPedestrians'])
'SeedPedestrians',
'DisableTwoWheeledVehicles'])
ini.add_section(S_SENSOR)
ini.set(S_SENSOR, 'Sensors', ','.join(s.SensorName for s in self._sensors))

View File

@ -118,6 +118,7 @@ static void LoadSettingsFromConfig(
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("WeatherId"), Settings.WeatherId);
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("SeedVehicles"), Settings.SeedVehicles);
ConfigFile.GetInt(S_CARLA_LEVELSETTINGS, TEXT("SeedPedestrians"), Settings.SeedPedestrians);
ConfigFile.GetBool(S_CARLA_LEVELSETTINGS, TEXT("DisableTwoWheeledVehicles"), Settings.bDisableTwoWheeledVehicles);
// QualitySettings.
FString sQualityLevel;
@ -251,6 +252,7 @@ void UCarlaSettings::LogSettings() const
UE_LOG(LogCarla, Log, TEXT("Weather Id = %d"), WeatherId);
UE_LOG(LogCarla, Log, TEXT("Seed Vehicle Spawner = %d"), SeedVehicles);
UE_LOG(LogCarla, Log, TEXT("Seed Pedestrian Spawner = %d"), SeedPedestrians);
UE_LOG(LogCarla, Log, TEXT("Two-Wheeled Vehicles = %s"), EnabledDisabled(!bDisableTwoWheeledVehicles));
UE_LOG(LogCarla, Log, TEXT("Found %d available weather settings."), WeatherDescriptions.Num());
for (auto i = 0; i < WeatherDescriptions.Num(); ++i)
{

View File

@ -188,6 +188,10 @@ public:
UPROPERTY(Category = "Level Settings", VisibleAnywhere)
int32 SeedVehicles = 123456789;
/** Disable bikes and motorbikes. */
UPROPERTY(Category = "Level Settings", BlueprintReadOnly, VisibleAnywhere)
bool bDisableTwoWheeledVehicles = false;
/// @}
// ===========================================================================
@ -253,7 +257,7 @@ public:
* semantic segmentation impose some performance penalties even if it is not
* used, we only enable it if necessary.
*/
UPROPERTY(Category = "Sensors", BlueprintReadOnly,VisibleAnywhere)
UPROPERTY(Category = "Sensors", BlueprintReadOnly, VisibleAnywhere)
bool bSemanticSegmentationEnabled = false;
/// @}