diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Radar.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Radar.cpp index 584582458..811eb7ab1 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Radar.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/Radar.cpp @@ -10,8 +10,8 @@ #include "Kismet/KismetMathLibrary.h" #include "Runtime/Core/Public/Async/ParallelFor.h" #include -#include "carla/geom/Math.h" -#include "carla/ros2/ROS2.h" +#include +#include #include FActorDefinition ARadar::GetSensorDefinition() @@ -135,9 +135,6 @@ void ARadar::SendLineTraces(float DeltaTime) Rays[i].Hitted = false; } -#if 0 // @CARLAUE5 - FCriticalSection Mutex; - GetWorld()->GetPhysicsScene()->GetPxScene()->lockRead(); { TRACE_CPUPROFILER_EVENT_SCOPE(ParallelFor); ParallelFor(NumPoints, [&](int32 idx) { @@ -155,7 +152,8 @@ void ARadar::SendLineTraces(float DeltaTime) MaxRy * Radius * Sin }); - const bool Hitted = GetWorld()->ParallelLineTraceSingleByChannel( + // @CARLAUE5: WE CAN PROBABLY IMPROVE THE PERFORMANCE OF THIS: + const bool Hitted = GetWorld()->LineTraceSingleByChannel( OutHit, RadarLocation, EndLocation, @@ -181,20 +179,21 @@ void ARadar::SendLineTraces(float DeltaTime) } }); } - GetWorld()->GetPhysicsScene()->GetPxScene()->unlockRead(); // Write the detections in the output structure - for (auto& ray : Rays) { - if (ray.Hitted) { - RadarData.WriteDetection({ - ray.RelativeVelocity, - ray.AzimuthAndElevation.X, - ray.AzimuthAndElevation.Y, - ray.Distance + for (auto& ray : Rays) + { + if (ray.Hitted) + { + RadarData.WriteDetection( + { + (float)ray.RelativeVelocity, + (float)ray.AzimuthAndElevation.X, + (float)ray.AzimuthAndElevation.Y, + (float)ray.Distance }); } } -#endif } float ARadar::CalculateRelativeVelocity(const FHitResult& OutHit, const FVector& RadarLocation) diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastSemanticLidar.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastSemanticLidar.cpp index 71d8e0092..1d02113e5 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastSemanticLidar.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastSemanticLidar.cpp @@ -125,8 +125,6 @@ void ARayCastSemanticLidar::SimulateLidar(const float DeltaTime) ResetRecordedHits(ChannelCount, PointsToScanWithOneLaser); PreprocessRays(ChannelCount, PointsToScanWithOneLaser); -#if 0 // @CARLAUE5 - GetWorld()->GetPhysicsScene()->GetPxScene()->lockRead(); { TRACE_CPUPROFILER_EVENT_SCOPE(ParallelFor); ParallelFor(ChannelCount, [&](int32 idxChannel) { @@ -149,8 +147,6 @@ void ARayCastSemanticLidar::SimulateLidar(const float DeltaTime) }; }); } - GetWorld()->GetPhysicsScene()->GetPxScene()->unlockRead(); -#endif FTransform ActorTransf = GetTransform(); ComputeAndSaveDetections(ActorTransf); @@ -248,8 +244,8 @@ bool ARayCastSemanticLidar::ShootLaser(const float VerticalAngle, const float Ho const auto Range = Description.Range; FVector EndTrace = Range * UKismetMathLibrary::GetForwardVector(ResultRot) + LidarBodyLoc; -#if 0 // @CARLAUE5 - GetWorld()->ParallelLineTraceSingleByChannel( + // @CARLAUE5: WE CAN PROBABLY IMPROVE THIS + GetWorld()->LineTraceSingleByChannel( HitInfo, LidarBodyLoc, EndTrace, @@ -257,7 +253,6 @@ bool ARayCastSemanticLidar::ShootLaser(const float VerticalAngle, const float Ho TraceParams, FCollisionResponseParams::DefaultResponseParam ); -#endif if (HitInfo.bBlockingHit) { HitResult = HitInfo; diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Settings/CarlaSettingsDelegate.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Settings/CarlaSettingsDelegate.cpp index 510c91f95..040e623b0 100644 --- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Settings/CarlaSettingsDelegate.cpp +++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Settings/CarlaSettingsDelegate.cpp @@ -16,6 +16,7 @@ #include "Engine/LocalPlayer.h" #include "Engine/PostProcessVolume.h" #include "Engine/StaticMesh.h" +#include "Engine/GameViewportClient.h" #include "GameFramework/HUD.h" #include "InstancedFoliageActor.h" #include "Kismet/GameplayStatics.h" @@ -135,10 +136,7 @@ void UCarlaSettingsDelegate::ApplyQualityLevelPreRestart() { ULocalPlayer *player = playercontroller->GetLocalPlayer(); if (player) - { - // @CARLAUE5 - // player->ViewportClient->bDisableWorldRendering = CarlaSettings->bDisableRendering; - } + player->ViewportClient->bDisableWorldRendering = CarlaSettings->bDisableRendering; // if we already have a hud class: AHUD *hud = playercontroller->GetHUD(); if (hud)