Small optimization

This commit is contained in:
Daniel Santos-Olivan 2020-07-29 15:08:44 +02:00 committed by DSantosO
parent 64183b025a
commit c8ee455b05
3 changed files with 3 additions and 4 deletions

View File

@ -46,6 +46,7 @@ void ARayCastLidar::Set(const FLidarDescription &LidarDescription)
Description = LidarDescription;
LidarData = FLidarData(Description.Channels);
CreateLasers();
PointsPerChannel.resize(Description.Channels);
// Compute drop off model parameters
DropOffBeta = 1.0f - Description.DropOffAtZeroIntensity;
@ -117,8 +118,6 @@ ARayCastLidar::FDetection ARayCastLidar::ComputeDetection(const FHitResult& HitI
}
void ARayCastLidar::ComputeAndSaveDetections(const FTransform& SensorTransform) {
std::vector<uint32_t> PointsPerChannel(Description.Channels);
for (auto idxChannel = 0u; idxChannel < Description.Channels; ++idxChannel)
PointsPerChannel[idxChannel] = RecordedHits[idxChannel].size();
LidarData.ResetSerPoints(PointsPerChannel);

View File

@ -43,6 +43,7 @@ void ARayCastRawLidar::Set(const FLidarDescription &LidarDescription)
Description = LidarDescription;
LidarRawData = FLidarRawData(Description.Channels);
CreateLasers();
PointsPerChannel.resize(Description.Channels);
}
void ARayCastRawLidar::CreateLasers()
@ -138,8 +139,6 @@ void ARayCastRawLidar::SimulateLidar(const float DeltaTime)
}
void ARayCastRawLidar::ComputeAndSaveDetections(const FTransform& SensorTransform) {
std::vector<uint32_t> PointsPerChannel(Description.Channels);
for (auto idxChannel = 0u; idxChannel < Description.Channels; ++idxChannel)
PointsPerChannel[idxChannel] = RecordedHits[idxChannel].size();
LidarRawData.ResetSerPoints(PointsPerChannel);

View File

@ -77,6 +77,7 @@ protected:
TArray<float> LaserAngles;
std::vector<std::vector<FHitResult>> RecordedHits;
std::vector<uint32_t> PointsPerChannel;
private:
FLidarRawData LidarRawData;