Enable Radar and RayCastSemanticLidar code.
This commit is contained in:
parent
036b8a64f7
commit
b37aa6f031
|
@ -10,8 +10,8 @@
|
|||
#include "Kismet/KismetMathLibrary.h"
|
||||
#include "Runtime/Core/Public/Async/ParallelFor.h"
|
||||
#include <compiler/disable-ue4-macros.h>
|
||||
#include "carla/geom/Math.h"
|
||||
#include "carla/ros2/ROS2.h"
|
||||
#include <carla/geom/Math.h>
|
||||
#include <carla/ros2/ROS2.h>
|
||||
#include <compiler/enable-ue4-macros.h>
|
||||
|
||||
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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue