Format changes to answer review
This commit is contained in:
parent
c2cf1e9c95
commit
1d9bb78a8d
|
@ -111,11 +111,11 @@ namespace s11n {
|
||||||
|
|
||||||
for (auto idxChannel = 0u; idxChannel < GetChannelCount(); ++idxChannel) {
|
for (auto idxChannel = 0u; idxChannel < GetChannelCount(); ++idxChannel) {
|
||||||
_header[Index::SIZE + idxChannel] = static_cast<uint32_t>(_aux_points.size());
|
_header[Index::SIZE + idxChannel] = static_cast<uint32_t>(_aux_points.size());
|
||||||
for (auto& Pt : _aux_points[idxChannel]) {
|
for (auto& pt : _aux_points[idxChannel]) {
|
||||||
_points.emplace_back(Pt.x);
|
_points.emplace_back(pt.x);
|
||||||
_points.emplace_back(Pt.y);
|
_points.emplace_back(pt.y);
|
||||||
_points.emplace_back(Pt.z);
|
_points.emplace_back(pt.z);
|
||||||
_points.emplace_back(Pt.intensity);
|
_points.emplace_back(pt.intensity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -640,7 +640,7 @@ class CameraManager(object):
|
||||||
return
|
return
|
||||||
if self.sensors[self.index][0].startswith('sensor.lidar'):
|
if self.sensors[self.index][0].startswith('sensor.lidar'):
|
||||||
points = np.frombuffer(image.raw_data, dtype=np.dtype('f4'))
|
points = np.frombuffer(image.raw_data, dtype=np.dtype('f4'))
|
||||||
points = np.reshape(points, (int(points.shape[0] / 3), 3))
|
points = np.reshape(points, (int(points.shape[0] / 4), 4))
|
||||||
lidar_data = np.array(points[:, :2])
|
lidar_data = np.array(points[:, :2])
|
||||||
lidar_data *= min(self.hud.dim) / 100.0
|
lidar_data *= min(self.hud.dim) / 100.0
|
||||||
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])
|
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])
|
||||||
|
|
|
@ -960,7 +960,7 @@ class CameraManager(object):
|
||||||
return
|
return
|
||||||
if self.sensors[self.index][0].startswith('sensor.lidar'):
|
if self.sensors[self.index][0].startswith('sensor.lidar'):
|
||||||
points = np.frombuffer(image.raw_data, dtype=np.dtype('f4'))
|
points = np.frombuffer(image.raw_data, dtype=np.dtype('f4'))
|
||||||
points = np.reshape(points, (int(points.shape[0] / 3), 3))
|
points = np.reshape(points, (int(points.shape[0] / 4), 4))
|
||||||
lidar_data = np.array(points[:, :2])
|
lidar_data = np.array(points[:, :2])
|
||||||
lidar_data *= min(self.hud.dim) / 100.0
|
lidar_data *= min(self.hud.dim) / 100.0
|
||||||
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])
|
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])
|
||||||
|
|
|
@ -741,7 +741,7 @@ class CameraManager(object):
|
||||||
return
|
return
|
||||||
if self.sensors[self.index][0].startswith('sensor.lidar'):
|
if self.sensors[self.index][0].startswith('sensor.lidar'):
|
||||||
points = np.frombuffer(image.raw_data, dtype=np.dtype('f4'))
|
points = np.frombuffer(image.raw_data, dtype=np.dtype('f4'))
|
||||||
points = np.reshape(points, (int(points.shape[0] / 3), 3))
|
points = np.reshape(points, (int(points.shape[0] / 4), 4))
|
||||||
lidar_data = np.array(points[:, :2])
|
lidar_data = np.array(points[:, :2])
|
||||||
lidar_data *= min(self.hud.dim) / 100.0
|
lidar_data *= min(self.hud.dim) / 100.0
|
||||||
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])
|
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])
|
||||||
|
|
|
@ -55,8 +55,6 @@ struct CARLA_API FLidarDescription
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
float DropOffAtZeroIntensity = 0.4f;
|
float DropOffAtZeroIntensity = 0.4f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// Wether to show debug points of laser hits in simulator.
|
/// Wether to show debug points of laser hits in simulator.
|
||||||
UPROPERTY(EditAnywhere)
|
UPROPERTY(EditAnywhere)
|
||||||
bool ShowDebugPoints = false;
|
bool ShowDebugPoints = false;
|
||||||
|
|
|
@ -134,7 +134,8 @@ void ARayCastLidar::ReadPoints(const float DeltaTime)
|
||||||
float ARayCastLidar::ComputeIntensity(const FVector &LidarBodyLoc, const FHitResult& HitInfo) const
|
float ARayCastLidar::ComputeIntensity(const FVector &LidarBodyLoc, const FHitResult& HitInfo) const
|
||||||
{
|
{
|
||||||
const FVector HitPoint = HitInfo.ImpactPoint - LidarBodyLoc;
|
const FVector HitPoint = HitInfo.ImpactPoint - LidarBodyLoc;
|
||||||
const float Distance = 0.01f * HitPoint.Size();
|
constexpr float TO_METERS = 1e-2;
|
||||||
|
const float Distance = TO_METERS * HitPoint.Size();
|
||||||
|
|
||||||
const float AttenAtm = Description.AtmospAttenRate;
|
const float AttenAtm = Description.AtmospAttenRate;
|
||||||
const float AbsAtm = exp(-AttenAtm * Distance);
|
const float AbsAtm = exp(-AttenAtm * Distance);
|
||||||
|
@ -146,7 +147,6 @@ float ARayCastLidar::ComputeIntensity(const FVector &LidarBodyLoc, const FHitRes
|
||||||
|
|
||||||
bool ARayCastLidar::ShootLaser(const uint32 Channel, const float HorizontalAngle, FVector &XYZ, float &Intensity) const
|
bool ARayCastLidar::ShootLaser(const uint32 Channel, const float HorizontalAngle, FVector &XYZ, float &Intensity) const
|
||||||
{
|
{
|
||||||
|
|
||||||
if(DropOffGenActive && RandomEngine->GetUniformFloat() < Description.DropOffGenRate)
|
if(DropOffGenActive && RandomEngine->GetUniformFloat() < Description.DropOffGenRate)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -178,7 +178,6 @@ bool ARayCastLidar::ShootLaser(const uint32 Channel, const float HorizontalAngle
|
||||||
FCollisionResponseParams::DefaultResponseParam
|
FCollisionResponseParams::DefaultResponseParam
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
if (HitInfo.bBlockingHit)
|
if (HitInfo.bBlockingHit)
|
||||||
{
|
{
|
||||||
if (Description.ShowDebugPoints)
|
if (Description.ShowDebugPoints)
|
||||||
|
@ -198,8 +197,6 @@ bool ARayCastLidar::ShootLaser(const uint32 Channel, const float HorizontalAngle
|
||||||
|
|
||||||
Intensity = ComputeIntensity(LidarBodyLoc, HitInfo);
|
Intensity = ComputeIntensity(LidarBodyLoc, HitInfo);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(Intensity > Description.DropOffIntensityLimit)
|
if(Intensity > Description.DropOffIntensityLimit)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
|
|
|
@ -60,14 +60,14 @@ private:
|
||||||
|
|
||||||
FLidarMeasurement LidarMeasurement;
|
FLidarMeasurement LidarMeasurement;
|
||||||
|
|
||||||
// Enable/Disable general dropoff of lidar points
|
/// Enable/Disable general dropoff of lidar points
|
||||||
bool DropOffGenActive;
|
bool DropOffGenActive;
|
||||||
|
|
||||||
// Slope for the intensity dropoff of lidar points, it is calculated
|
/// Slope for the intensity dropoff of lidar points, it is calculated
|
||||||
// throught the dropoff limit and the dropoff at zero intensity
|
/// throught the dropoff limit and the dropoff at zero intensity
|
||||||
// The points is kept with a probality alpha*Intensity + beta where
|
/// The points is kept with a probality alpha*Intensity + beta where
|
||||||
// alpha = (1 - dropoff_zero_intensity) / droppoff_limit
|
/// alpha = (1 - dropoff_zero_intensity) / droppoff_limit
|
||||||
// beta = (1 - dropoff_zero_intensity)
|
/// beta = (1 - dropoff_zero_intensity)
|
||||||
float DropOffAlpha;
|
float DropOffAlpha;
|
||||||
float DropOffBeta;
|
float DropOffBeta;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue