Format changes to answer review

This commit is contained in:
Daniel Santos-Olivan 2020-07-07 13:36:42 +02:00 committed by Marc Garcia Puig
parent c2cf1e9c95
commit 1d9bb78a8d
8 changed files with 17 additions and 22 deletions

View File

@ -537,7 +537,7 @@ The rotation of the LIDAR can be tuned to cover a specific angle on every simula
<td><code>atmosphere_attenuation_rate</code></td>
<td>float</td>
<td>0.004</td>
<td>Coefficient that measures the lidar instensity loss per meter. Check the intensity computation above.</td>
<td>Coefficient that measures the lidar instensity loss per meter. Check the intensity computation above.</td>
<tr>
<td><code>dropoff_general_rate</code></td>
<td>float</td>

View File

@ -111,11 +111,11 @@ namespace s11n {
for (auto idxChannel = 0u; idxChannel < GetChannelCount(); ++idxChannel) {
_header[Index::SIZE + idxChannel] = static_cast<uint32_t>(_aux_points.size());
for (auto& Pt : _aux_points[idxChannel]) {
_points.emplace_back(Pt.x);
_points.emplace_back(Pt.y);
_points.emplace_back(Pt.z);
_points.emplace_back(Pt.intensity);
for (auto& pt : _aux_points[idxChannel]) {
_points.emplace_back(pt.x);
_points.emplace_back(pt.y);
_points.emplace_back(pt.z);
_points.emplace_back(pt.intensity);
}
}

View File

@ -640,7 +640,7 @@ class CameraManager(object):
return
if self.sensors[self.index][0].startswith('sensor.lidar'):
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 *= min(self.hud.dim) / 100.0
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])

View File

@ -960,7 +960,7 @@ class CameraManager(object):
return
if self.sensors[self.index][0].startswith('sensor.lidar'):
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 *= min(self.hud.dim) / 100.0
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])

View File

@ -741,7 +741,7 @@ class CameraManager(object):
return
if self.sensors[self.index][0].startswith('sensor.lidar'):
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 *= min(self.hud.dim) / 100.0
lidar_data += (0.5 * self.hud.dim[0], 0.5 * self.hud.dim[1])

View File

@ -55,8 +55,6 @@ struct CARLA_API FLidarDescription
UPROPERTY(EditAnywhere)
float DropOffAtZeroIntensity = 0.4f;
/// Wether to show debug points of laser hits in simulator.
UPROPERTY(EditAnywhere)
bool ShowDebugPoints = false;

View File

@ -134,7 +134,8 @@ void ARayCastLidar::ReadPoints(const float DeltaTime)
float ARayCastLidar::ComputeIntensity(const FVector &LidarBodyLoc, const FHitResult& HitInfo) const
{
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 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
{
if(DropOffGenActive && RandomEngine->GetUniformFloat() < Description.DropOffGenRate)
return false;
@ -178,7 +178,6 @@ bool ARayCastLidar::ShootLaser(const uint32 Channel, const float HorizontalAngle
FCollisionResponseParams::DefaultResponseParam
);
if (HitInfo.bBlockingHit)
{
if (Description.ShowDebugPoints)
@ -198,8 +197,6 @@ bool ARayCastLidar::ShootLaser(const uint32 Channel, const float HorizontalAngle
Intensity = ComputeIntensity(LidarBodyLoc, HitInfo);
if(Intensity > Description.DropOffIntensityLimit)
return true;
else

View File

@ -60,14 +60,14 @@ private:
FLidarMeasurement LidarMeasurement;
// Enable/Disable general dropoff of lidar points
/// Enable/Disable general dropoff of lidar points
bool DropOffGenActive;
// Slope for the intensity dropoff of lidar points, it is calculated
// throught the dropoff limit and the dropoff at zero intensity
// The points is kept with a probality alpha*Intensity + beta where
// alpha = (1 - dropoff_zero_intensity) / droppoff_limit
// beta = (1 - dropoff_zero_intensity)
/// Slope for the intensity dropoff of lidar points, it is calculated
/// throught the dropoff limit and the dropoff at zero intensity
/// The points is kept with a probality alpha*Intensity + beta where
/// alpha = (1 - dropoff_zero_intensity) / droppoff_limit
/// beta = (1 - dropoff_zero_intensity)
float DropOffAlpha;
float DropOffBeta;
};