Remove arguments from Preprocess to allow for optimization
This commit is contained in:
parent
20df95d202
commit
d1889fed85
|
@ -94,7 +94,7 @@ ARayCastLidar::FDetection ARayCastLidar::ComputeDetection(const FHitResult& HitI
|
||||||
return Detection;
|
return Detection;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ARayCastLidar::PreprocessRay(const float& VerticalAngle, float &HorizontalAngle) const {
|
bool ARayCastLidar::PreprocessRay() const {
|
||||||
if(DropOffGenActive && RandomEngine->GetUniformFloat() < Description.DropOffGenRate)
|
if(DropOffGenActive && RandomEngine->GetUniformFloat() < Description.DropOffGenRate)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
|
|
|
@ -40,7 +40,7 @@ private:
|
||||||
float ComputeIntensity(const FRawDetection& RawDetection) const;
|
float ComputeIntensity(const FRawDetection& RawDetection) const;
|
||||||
FDetection ComputeDetection(const FHitResult& HitInfo, const FTransform& SensorTransf) const;
|
FDetection ComputeDetection(const FHitResult& HitInfo, const FTransform& SensorTransf) const;
|
||||||
|
|
||||||
bool PreprocessRay(const float& VerticalAngle, float &HorizontalAngle) const override;
|
bool PreprocessRay() const override;
|
||||||
|
|
||||||
void ComputeAndSaveDetections(const FTransform& SensorTransform) override;
|
void ComputeAndSaveDetections(const FTransform& SensorTransform) override;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include <PxScene.h>
|
#include <PxScene.h>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "Carla.h"
|
#include "Carla.h"
|
||||||
#include "Carla/Sensor/RayCastRawLidar.h"
|
|
||||||
#include "Carla/Actor/ActorBlueprintFunctionLibrary.h"
|
#include "Carla/Actor/ActorBlueprintFunctionLibrary.h"
|
||||||
|
#include "Carla/Sensor/RayCastRawLidar.h"
|
||||||
|
|
||||||
#include <compiler/disable-ue4-macros.h>
|
#include <compiler/disable-ue4-macros.h>
|
||||||
#include "carla/geom/Math.h"
|
#include "carla/geom/Math.h"
|
||||||
|
@ -103,10 +103,9 @@ void ARayCastRawLidar::SimulateLidar(const float DeltaTime)
|
||||||
FCriticalSection Mutex;
|
FCriticalSection Mutex;
|
||||||
ParallelFor(PointsToScanWithOneLaser, [&](int32 idxPtsOneLaser) {
|
ParallelFor(PointsToScanWithOneLaser, [&](int32 idxPtsOneLaser) {
|
||||||
FHitResult HitResult;
|
FHitResult HitResult;
|
||||||
float VertAngle = LaserAngles[idxChannel];
|
const float VertAngle = LaserAngles[idxChannel];
|
||||||
float HorizAngle = CurrentHorizontalAngle + AngleDistanceOfLaserMeasure * idxPtsOneLaser;
|
const float HorizAngle = CurrentHorizontalAngle + AngleDistanceOfLaserMeasure * idxPtsOneLaser;
|
||||||
|
const bool PreprocessResult = PreprocessRay();
|
||||||
bool PreprocessResult = PreprocessRay(VertAngle, HorizAngle);
|
|
||||||
|
|
||||||
if (PreprocessResult && ShootLaser(VertAngle, HorizAngle, HitResult)) {
|
if (PreprocessResult && ShootLaser(VertAngle, HorizAngle, HitResult)) {
|
||||||
Mutex.Lock();
|
Mutex.Lock();
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
// This work is licensed under the terms of the MIT license.
|
// This work is licensed under the terms of the MIT license.
|
||||||
// For a copy, see <https://opensource.org/licenses/MIT>.
|
// For a copy, see <https://opensource.org/licenses/MIT>.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Carla/Sensor/Sensor.h"
|
#include "Carla/Sensor/Sensor.h"
|
||||||
|
@ -50,7 +52,7 @@ protected:
|
||||||
bool ShootLaser(const float VerticalAngle, float HorizontalAngle, FHitResult &RawData) const;
|
bool ShootLaser(const float VerticalAngle, float HorizontalAngle, FHitResult &RawData) const;
|
||||||
|
|
||||||
/// Method that allow to preprocess the ray before shoot it
|
/// Method that allow to preprocess the ray before shoot it
|
||||||
virtual bool PreprocessRay(const float& VerticalAngle, float &HorizontalAngle) const {
|
virtual bool PreprocessRay() const {
|
||||||
// This method allows to introduce noise or drop points if needed
|
// This method allows to introduce noise or drop points if needed
|
||||||
// A true return value will make the proposed ray to be actually computed.
|
// A true return value will make the proposed ray to be actually computed.
|
||||||
return true;
|
return true;
|
||||||
|
@ -65,7 +67,8 @@ protected:
|
||||||
/// Clear the recorded data structure
|
/// Clear the recorded data structure
|
||||||
void ResetRecordedHits(uint32_t Channels, uint32_t MaxPointsPerChannel);
|
void ResetRecordedHits(uint32_t Channels, uint32_t MaxPointsPerChannel);
|
||||||
|
|
||||||
/// Clear the recorded data structure
|
/// This method uses all the saved FHitResults, compute the
|
||||||
|
/// RawDetections and then send it to the LidarData structure.
|
||||||
virtual void ComputeAndSaveDetections(const FTransform &SensorTransform);
|
virtual void ComputeAndSaveDetections(const FTransform &SensorTransform);
|
||||||
|
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
|
|
Loading…
Reference in New Issue