From 27b1490990b75d12cb311ea4bb89031d3bccd92f Mon Sep 17 00:00:00 2001 From: Blyron Date: Mon, 6 May 2024 16:29:17 +0200 Subject: [PATCH 1/2] Fix OSM2ODR build --- Util/BuildTools/BuildOSM2ODR.bat | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/Util/BuildTools/BuildOSM2ODR.bat b/Util/BuildTools/BuildOSM2ODR.bat index 5a4fb36e0..77a4eff2b 100644 --- a/Util/BuildTools/BuildOSM2ODR.bat +++ b/Util/BuildTools/BuildOSM2ODR.bat @@ -71,7 +71,7 @@ rem ============================================================================ rem Set the visual studio solution directory rem set OSM2ODR_VSPROJECT_PATH=%INSTALLATION_DIR:/=\%osm2odr-visualstudio\ -set OSM2ODR_SOURCE_PATH=%INSTALLATION_DIR:/=\%om2odr-source\ +set OSM2ODR_SOURCE_PATH=%INSTALLATION_DIR:/=\%osm2odr-source\ set OSM2ODR_INSTALL_PATH=%ROOT_PATH:/=\%PythonAPI\carla\dependencies\ set OSM2ODR__SERVER_INSTALL_PATH=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies set CARLA_DEPENDENCIES_FOLDER=%ROOT_PATH:/=\%Unreal\CarlaUE4\Plugins\Carla\CarlaDependencies\ @@ -92,24 +92,19 @@ if %REMOVE_INTERMEDIATE% == true ( rem Build OSM2ODR if %BUILD_OSM2ODR% == true ( - cd "%OSM2ODR_SOURCE_PATH%" + cd "%INSTALLATION_DIR%" if not exist "%OSM2ODR_SOURCE_PATH%" ( curl --retry 5 --retry-max-time 120 -L -o OSM2ODR.zip https://github.com/carla-simulator/sumo/archive/%CURRENT_OSM2ODR_COMMIT%.zip tar -xf OSM2ODR.zip del OSM2ODR.zip - ren sumo-%CURRENT_OSM2ODR_COMMIT% %OSM2ODR_SOURCE_PATH% + ren sumo-%CURRENT_OSM2ODR_COMMIT% osm2odr-source ) - + + cd .. if not exist "%OSM2ODR_VSPROJECT_PATH%" mkdir "%OSM2ODR_VSPROJECT_PATH%" cd "%OSM2ODR_VSPROJECT_PATH%" - echo.%GENERATOR% | findstr /C:"Visual Studio" >nul && ( - set PLATFORM=-A x64 - ) || ( - set PLATFORM= - ) - - cmake -G %GENERATOR% %PLATFORM%^ + cmake -G %GENERATOR% -A x64^ -DCMAKE_CXX_FLAGS_RELEASE="/MD /MP"^ -DCMAKE_INSTALL_PREFIX="%OSM2ODR_INSTALL_PATH:\=/%"^ -DPROJ_INCLUDE_DIR=%INSTALLATION_DIR:/=\%\proj-install\include^ From 9037124f594daa09f745f00d7125a513cac8aaaf Mon Sep 17 00:00:00 2001 From: Blyron Date: Tue, 7 May 2024 10:33:20 +0200 Subject: [PATCH 2/2] Fix compilation issue --- .../Carla/Source/Carla/Sensor/V2X/PathLossModel.cpp | 12 +++++++----- .../Carla/Source/Carla/Sensor/V2X/PathLossModel.h | 2 +- .../Carla/Vehicle/CustomTerrainPhysicsComponent.cpp | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/V2X/PathLossModel.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/V2X/PathLossModel.cpp index a6b404b80..bd80f114e 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/V2X/PathLossModel.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/V2X/PathLossModel.cpp @@ -6,6 +6,8 @@ #include "Carla.h" #include "Carla/Game/CarlaEpisode.h" +#include "Math/UnrealMathUtility.h" + #include "PathLossModel.h" #include #include @@ -332,7 +334,7 @@ float PathLossModel::ComputeLoss(AActor *OtherActor, FVector Source, FVector Des EPathState state; float PathLoss = 0.0; - double VehicleBlockageLoss; + double VehicleBlockageLoss = 0.0; float ShadowFadingLoss = 0.0; // state and vehicle obstacles are call-by-reference @@ -365,7 +367,7 @@ float PathLossModel::ComputeLoss(AActor *OtherActor, FVector Source, FVector Des { // fspl + knife edge // fspl - double free_space_loss = 20.0 * log10(Distance3d) + 20.0 * log10(4.0 * M_PI / lambda); + double free_space_loss = 20.0 * log10(Distance3d) + 20.0 * log10(4.0 * PI / lambda); // add the knife edge vehicle blockage loss PathLoss = free_space_loss + CalculateNLOSvLoss(Source, Destination, TxHeight, RxHeight, Distance3d, vehicle_obstacles); } @@ -446,7 +448,7 @@ bool PathLossModel::GetLocationIfVehicle(const FVector CurrentActorLocation, con void PathLossModel::CalculateFSPL_d0() { - m_fspl_d0 = 20.0 * log10(reference_distance_fspl) + 20.0 * log10(Frequency) + 20.0 * log10(4.0 * M_PI / c_speedoflight); + m_fspl_d0 = 20.0 * log10(reference_distance_fspl) + 20.0 * log10(Frequency) + 20.0 * log10(4.0 * PI / c_speedoflight); } // Following ETSI TR 103 257-1 V1.1.1 (2019-05: from WINNER Project Board: "D5.3 - WINNER+ Final Channel Models", 30 06 2010. @@ -563,7 +565,7 @@ double PathLossModel::CalculateTwoRayPathLoss(double Distance3d, double TxHeight double gamma = (sin_theta - sqrt(epsilon_r - std::pow(cos_theta, 2))) / (sin_theta + sqrt(epsilon_r - std::pow(cos_theta, 2))); - double phi = (2.0 * M_PI / lambda * (Distance3d - d_refl)); + double phi = (2.0 * PI / lambda * (Distance3d - d_refl)); - return 20 * log10(4.0 * M_PI * d_ground / lambda * 1.0 / sqrt(std::pow(1 + gamma * cos(phi), 2) + std::pow(gamma, 2) * std::pow(sin(phi), 2))); + return 20 * log10(4.0 * PI * d_ground / lambda * 1.0 / sqrt(std::pow(1 + gamma * cos(phi), 2) + std::pow(gamma, 2) * std::pow(sin(phi), 2))); } diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/V2X/PathLossModel.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/V2X/PathLossModel.h index 2d798995f..2e9fd6071 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/V2X/PathLossModel.h +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/V2X/PathLossModel.h @@ -7,7 +7,7 @@ #pragma once #include -#include + using ActorPowerMap = std::map; using ActorPowerPair = std::pair; diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/CustomTerrainPhysicsComponent.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/CustomTerrainPhysicsComponent.cpp index 62a994b51..e199f46bf 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/CustomTerrainPhysicsComponent.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Vehicle/CustomTerrainPhysicsComponent.cpp @@ -1310,13 +1310,13 @@ void UCustomTerrainPhysicsComponent::BeginPlay() SparseMap.SavePath = SavePath; // Creating the FileManager IPlatformFile& FileManager = FPlatformFileManager::Get().GetPlatformFile(); - if( FileManager.CreateDirectory(*SavePath)){ + /*if( FileManager.CreateDirectory(*SavePath)){ UE_LOG(LogCarla, Warning, TEXT("Folder was created at %s"), *SavePath); }else{ UE_LOG(LogCarla, Error, TEXT("Folder was not created at %s"), *SavePath); - } + }*/ if(bUseDeformationPlane){ DeformationPlaneActor = GetWorld()->SpawnActor();