Skip to content

Commit

Permalink
Merge branch 'dev' into glopez/bp_library_types
Browse files Browse the repository at this point in the history
  • Loading branch information
Axel1092 committed Apr 12, 2022
2 parents 8b87227 + 7fe20be commit 5b57c1a
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 38 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* Added support for N wheeled vehicles
* Added support for new batch commands ConsoleCommand, ApplyLocation (to actor), SetTrafficLightState
* Switch to boost::variant2 for rpc::Command as that allows more than 20 RPC commands
* Added post process effects for rainy and dusty weathers.

## CARLA 0.9.13

Expand Down
47 changes: 24 additions & 23 deletions LibCarla/source/carla/rpc/WeatherParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,30 @@ namespace rpc {

using WP = WeatherParameters;

// cloudiness precip. prec.dep. wind azimuth altitude fog dens fog dist fog fall wetness scat.i mie.scat.s rayleigh.scat.scale
WP WP::Default = { -1.0f, -1.0f, -1.0f, -1.00f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 0.03f, 0.0331f};
WP WP::ClearNoon = { 5.0f, 0.0f, 0.0f, 10.0f, -1.0f, 45.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::CloudyNoon = { 60.0f, 0.0f, 0.0f, 10.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::WetNoon = { 5.0f, 0.0f, 50.0f, 10.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::WetCloudyNoon = { 60.0f, 0.0f, 50.0f, 10.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::MidRainyNoon = { 60.0f, 60.0f, 60.0f, 60.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::HardRainNoon = { 100.0f, 100.0f, 90.0f, 100.0f, -1.0f, 45.0f, 7.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::SoftRainNoon = { 20.0f, 30.0f, 50.0f, 30.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::ClearSunset = { 5.0f, 0.0f, 0.0f, 10.0f, -1.0f, 15.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::CloudySunset = { 60.0f, 0.0f, 0.0f, 10.0f, -1.0f, 15.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::WetSunset = { 5.0f, 0.0f, 50.0f, 10.0f, -1.0f, 15.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::WetCloudySunset = { 60.0f, 0.0f, 50.0f, 10.0f, -1.0f, 15.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::MidRainSunset = { 60.0f, 60.0f, 60.0f, 60.0f, -1.0f, 15.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::HardRainSunset = { 100.0f, 100.0f, 90.0f, 100.0f, -1.0f, 15.0f, 7.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::SoftRainSunset = { 20.0f, 30.0f, 50.0f, 30.0f, -1.0f, 15.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::ClearNight = { 5.0f, 0.0f, 0.0f, 10.0f, -1.0f, -90.0f, 60.0f, 75.0f, 1.0f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::CloudyNight = { 60.0f, 0.0f, 0.0f, 10.0f, -1.0f, -90.0f, 60.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f};
WP WP::WetNight = { 5.0f, 0.0f, 50.0f, 10.0f, -1.0f, -90.0f, 60.0f, 75.0f, 1.0f, 60.0f, 1.0f, 0.03f, 0.0331f};
WP WP::WetCloudyNight = { 60.0f, 0.0f, 50.0f, 10.0f, -1.0f, -90.0f, 60.0f, 0.75f, 0.1f, 60.0f, 1.0f, 0.03f, 0.0331f};
WP WP::SoftRainNight = { 60.0f, 30.0f, 50.0f, 30.0f, -1.0f, -90.0f, 60.0f, 0.75f, 0.1f, 60.0f, 1.0f, 0.03f, 0.0331f};
WP WP::MidRainyNight = { 80.0f, 60.0f, 60.0f, 60.0f, -1.0f, -90.0f, 60.0f, 0.75f, 0.1f, 80.0f, 1.0f, 0.03f, 0.0331f};
WP WP::HardRainNight = { 100.0f, 100.0f, 90.0f, 100.0f, -1.0f, -90.0f, 100.0f, 0.75f, 0.1f, 100.0f, 1.0f, 0.03f, 0.0331f};
// cloudiness precip. prec.dep. wind azimuth altitude fog dens fog dist fog fall wetness scat.i mie.scat.s rayleigh.scat.scale dust storm
WP WP::Default = { -1.0f, -1.0f, -1.0f, -1.00f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::ClearNoon = { 5.0f, 0.0f, 0.0f, 10.0f, -1.0f, 45.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::CloudyNoon = { 60.0f, 0.0f, 0.0f, 10.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::WetNoon = { 5.0f, 0.0f, 50.0f, 10.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::WetCloudyNoon = { 60.0f, 0.0f, 50.0f, 10.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::MidRainyNoon = { 60.0f, 60.0f, 60.0f, 60.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::HardRainNoon = { 100.0f, 100.0f, 90.0f, 100.0f, -1.0f, 45.0f, 7.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::SoftRainNoon = { 20.0f, 30.0f, 50.0f, 30.0f, -1.0f, 45.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::ClearSunset = { 5.0f, 0.0f, 0.0f, 10.0f, -1.0f, 15.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::CloudySunset = { 60.0f, 0.0f, 0.0f, 10.0f, -1.0f, 15.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::WetSunset = { 5.0f, 0.0f, 50.0f, 10.0f, -1.0f, 15.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::WetCloudySunset = { 60.0f, 0.0f, 50.0f, 10.0f, -1.0f, 15.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::MidRainSunset = { 60.0f, 60.0f, 60.0f, 60.0f, -1.0f, 15.0f, 3.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::HardRainSunset = { 100.0f, 100.0f, 90.0f, 100.0f, -1.0f, 15.0f, 7.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::SoftRainSunset = { 20.0f, 30.0f, 50.0f, 30.0f, -1.0f, 15.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::ClearNight = { 5.0f, 0.0f, 0.0f, 10.0f, -1.0f, -90.0f, 60.0f, 75.0f, 1.0f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::CloudyNight = { 60.0f, 0.0f, 0.0f, 10.0f, -1.0f, -90.0f, 60.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::WetNight = { 5.0f, 0.0f, 50.0f, 10.0f, -1.0f, -90.0f, 60.0f, 75.0f, 1.0f, 60.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::WetCloudyNight = { 60.0f, 0.0f, 50.0f, 10.0f, -1.0f, -90.0f, 60.0f, 0.75f, 0.1f, 60.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::SoftRainNight = { 60.0f, 30.0f, 50.0f, 30.0f, -1.0f, -90.0f, 60.0f, 0.75f, 0.1f, 60.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::MidRainyNight = { 80.0f, 60.0f, 60.0f, 60.0f, -1.0f, -90.0f, 60.0f, 0.75f, 0.1f, 80.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::HardRainNight = { 100.0f, 100.0f, 90.0f, 100.0f, -1.0f, -90.0f, 100.0f, 0.75f, 0.1f, 100.0f, 1.0f, 0.03f, 0.0331f, false };
WP WP::DustStorm = { 100.0f, 0.0f, 0.0f, 100.0f, -1.0f, 45.0f, 2.0f, 0.75f, 0.1f, 0.0f, 1.0f, 0.03f, 0.0331f, true };

} // namespace rpc
} // namespace carla
19 changes: 13 additions & 6 deletions LibCarla/source/carla/rpc/WeatherParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace rpc {
static WeatherParameters SoftRainNight;
static WeatherParameters MidRainyNight;
static WeatherParameters HardRainNight;
static WeatherParameters DustStorm;

/// @}

Expand All @@ -61,7 +62,8 @@ namespace rpc {
float in_wetness,
float in_scattering_intensity,
float in_mie_scattering_scale,
float in_rayleigh_scattering_scale)
float in_rayleigh_scattering_scale,
bool in_dust_storm)
: cloudiness(in_cloudiness),
precipitation(in_precipitation),
precipitation_deposits(in_precipitation_deposits),
Expand All @@ -74,7 +76,8 @@ namespace rpc {
wetness(in_wetness),
scattering_intensity(in_scattering_intensity),
mie_scattering_scale(in_mie_scattering_scale),
rayleigh_scattering_scale(in_rayleigh_scattering_scale) {}
rayleigh_scattering_scale(in_rayleigh_scattering_scale),
dust_storm(in_dust_storm) {}

float cloudiness = 0.0f;
float precipitation = 0.0f;
Expand All @@ -89,6 +92,7 @@ namespace rpc {
float scattering_intensity = 0.0f;
float mie_scattering_scale = 0.0f;
float rayleigh_scattering_scale = 0.0331f;
bool dust_storm = false;

#ifdef LIBCARLA_INCLUDED_FROM_UE4

Expand All @@ -105,7 +109,8 @@ namespace rpc {
wetness(Weather.Wetness),
scattering_intensity(Weather.ScatteringIntensity),
mie_scattering_scale(Weather.MieScatteringScale),
rayleigh_scattering_scale(Weather.RayleighScatteringScale) {}
rayleigh_scattering_scale(Weather.RayleighScatteringScale),
dust_storm(Weather.DustStorm) {}

operator FWeatherParameters() const {
FWeatherParameters Weather;
Expand All @@ -122,7 +127,7 @@ namespace rpc {
Weather.ScatteringIntensity = scattering_intensity;
Weather.MieScatteringScale = mie_scattering_scale;
Weather.RayleighScatteringScale = rayleigh_scattering_scale;

Weather.DustStorm = dust_storm;
return Weather;
}

Expand All @@ -142,7 +147,8 @@ namespace rpc {
wetness != rhs.wetness ||
scattering_intensity != rhs.scattering_intensity ||
mie_scattering_scale != rhs.mie_scattering_scale ||
rayleigh_scattering_scale != rhs.rayleigh_scattering_scale;
rayleigh_scattering_scale != rhs.rayleigh_scattering_scale ||
dust_storm != rhs.dust_storm;
}

bool operator==(const WeatherParameters &rhs) const {
Expand All @@ -162,7 +168,8 @@ namespace rpc {
wetness,
scattering_intensity,
mie_scattering_scale,
rayleigh_scattering_scale);
rayleigh_scattering_scale,
dust_storm);
};

} // namespace rpc
Expand Down
10 changes: 7 additions & 3 deletions PythonAPI/carla/source/libcarla/Weather.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ namespace rpc {
<< ", wetness=" << std::to_string(weather.wetness)
<< ", scattering_intensity=" << std::to_string(weather.scattering_intensity)
<< ", mie_scattering_scale=" << std::to_string(weather.mie_scattering_scale)
<< ", rayleigh_scattering_scale=" << std::to_string(weather.rayleigh_scattering_scale) << ')';
<< ", rayleigh_scattering_scale=" << std::to_string(weather.rayleigh_scattering_scale)
<< ", dust_storm=" << std::to_string(weather.dust_storm) << ')';
return out;
}

Expand All @@ -37,7 +38,7 @@ void export_weather() {
namespace cr = carla::rpc;

auto cls = class_<cr::WeatherParameters>("WeatherParameters")
.def(init<float, float, float, float, float, float, float, float, float, float, float, float, float>(
.def(init<float, float, float, float, float, float, float, float, float, float, float, float, float, bool>(
(arg("cloudiness")=0.0f,
arg("precipitation")=0.0f,
arg("precipitation_deposits")=0.0f,
Expand All @@ -50,7 +51,8 @@ void export_weather() {
arg("wetness")=0.0f,
arg("scattering_intensity")=0.0f,
arg("mie_scattering_scale")=0.0f,
arg("rayleigh_scattering_scale")=0.0331f)))
arg("rayleigh_scattering_scale")=0.0331f,
arg("dust_storm")=false)))
.def_readwrite("cloudiness", &cr::WeatherParameters::cloudiness)
.def_readwrite("precipitation", &cr::WeatherParameters::precipitation)
.def_readwrite("precipitation_deposits", &cr::WeatherParameters::precipitation_deposits)
Expand All @@ -64,6 +66,7 @@ void export_weather() {
.def_readwrite("scattering_intensity", &cr::WeatherParameters::scattering_intensity)
.def_readwrite("mie_scattering_scale", &cr::WeatherParameters::mie_scattering_scale)
.def_readwrite("rayleigh_scattering_scale", &cr::WeatherParameters::rayleigh_scattering_scale)
.def_readwrite("dust_storm", &cr::WeatherParameters::dust_storm)
.def("__eq__", &cr::WeatherParameters::operator==)
.def("__ne__", &cr::WeatherParameters::operator!=)
.def(self_ns::str(self_ns::self))
Expand Down Expand Up @@ -91,4 +94,5 @@ void export_weather() {
cls.attr("SoftRainNight") = cr::WeatherParameters::SoftRainNight;
cls.attr("MidRainyNight") = cr::WeatherParameters::MidRainyNight;
cls.attr("HardRainNight") = cr::WeatherParameters::HardRainNight;
cls.attr("DustStorm") = cr::WeatherParameters::DustStorm;
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ void FCarlaEngine::NotifyBeginEpisode(UCarlaEpisode &Episode)
Episode.EpisodeSettings.FixedDeltaSeconds = FCarlaEngine_GetFixedDeltaSeconds();
CurrentEpisode = &Episode;

// Reset map settings
UWorld* World = CurrentEpisode->GetWorld();
ALargeMapManager* LargeMapManager = UCarlaStatics::GetLargeMapManager(World);
if (LargeMapManager)
{
CurrentSettings.TileStreamingDistance = LargeMapManager->GetLayerStreamingDistance();
CurrentSettings.ActorActiveDistance = LargeMapManager->GetActorStreamingDistance();
}
CurrentEpisode->ApplySettings(CurrentSettings);

ResetFrameCounter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@ struct CARLA_API FWeatherParameters

UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(ClampMin = "0.0", ClampMax = "2.0", UIMin = "0.0", UIMax = "2.0"))
float RayleighScatteringScale = 0.0331f;

UPROPERTY(EditAnywhere, BlueprintReadWrite)
bool DustStorm = false;
};
1 change: 0 additions & 1 deletion Unreal/CarlaUE4/Source/CarlaUE4.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ public CarlaUE4Target(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.Add("CarlaUE4");
bUseLoggingInShipping = true;
}
}
27 changes: 23 additions & 4 deletions Util/BuildTools/Package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,29 @@ for PACKAGE_NAME in "${PACKAGES[@]}" ; do if [[ ${PACKAGE_NAME} != "Carla" ]] ;
PACKAGE_FILE=$(<${PACKAGE_PATH_FILE})
MAPS_TO_COOK=$(<${MAP_LIST_FILE})

# Cook maps
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" \
-run=cook -map="${MAPS_TO_COOK}" -cooksinglepackage -targetplatform="LinuxNoEditor" \
-OutputDir="${BUILD_FOLDER}"

# Cook maps in batches
MAX_STRINGLENGTH=1000
IFS="+" read -ra MAP_LIST <<< $MAPS_TO_COOK
TOTAL=0
MAP_STRING=""
for MAP in "${MAP_LIST[@]}"; do
if (($(($TOTAL+${#MAP})) > $MAX_STRINGLENGTH)); then
echo "Cooking $MAP_STRING"
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" \
-run=cook -map="${MAP_STRING}" -cooksinglepackage -targetplatform="LinuxNoEditor" \
-OutputDir="${BUILD_FOLDER}" -iterate
MAP_STRING=""
TOTAL=0
fi
MAP_STRING=$MAP_STRING+$MAP
TOTAL=$(($TOTAL+${#MAP}))
done
if (($TOTAL > 0)); then
${UE4_ROOT}/Engine/Binaries/Linux/UE4Editor "${CARLAUE4_ROOT_FOLDER}/CarlaUE4.uproject" \
-run=cook -map="${MAP_STRING}" -cooksinglepackage -targetplatform="LinuxNoEditor" \
-OutputDir="${BUILD_FOLDER}" -iterate
fi

PROP_MAP_FOLDER="${PACKAGE_PATH}/Maps/${PROPS_MAP_NAME}"

Expand Down
2 changes: 1 addition & 1 deletion Util/ContentVersions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@
0.9.11: 20201222_232b876
0.9.12: 20210730_564bcdc
0.9.13: 20211112_d5cfa12
Latest: 20220315_5cb69de
Latest: 20220404_1730439

0 comments on commit 5b57c1a

Please sign in to comment.