diff --git a/Docs/ref_sensors.md b/Docs/ref_sensors.md
index c8143bbe1..efb0494c5 100644
--- a/Docs/ref_sensors.md
+++ b/Docs/ref_sensors.md
@@ -537,7 +537,7 @@ The rotation of the LIDAR can be tuned to cover a specific angle on every simula
atmosphere_attenuation_rate |
float |
0.004 |
-Coefficient that measures the lidar instensity loss per meter. Check the intensity computation above. |
+Coefficient that measures the lidar instensity loss per meter. Check the intensity computation above. |
dropoff_general_rate |
float |
diff --git a/LibCarla/source/carla/sensor/s11n/LidarMeasurement.h b/LibCarla/source/carla/sensor/s11n/LidarMeasurement.h
index 09abfcda1..d5354a9a2 100644
--- a/LibCarla/source/carla/sensor/s11n/LidarMeasurement.h
+++ b/LibCarla/source/carla/sensor/s11n/LidarMeasurement.h
@@ -111,11 +111,11 @@ namespace s11n {
for (auto idxChannel = 0u; idxChannel < GetChannelCount(); ++idxChannel) {
_header[Index::SIZE + idxChannel] = static_cast(_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);
}
}
diff --git a/PythonAPI/examples/automatic_control.py b/PythonAPI/examples/automatic_control.py
index ac3ea6c91..8bba8395e 100755
--- a/PythonAPI/examples/automatic_control.py
+++ b/PythonAPI/examples/automatic_control.py
@@ -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])
diff --git a/PythonAPI/examples/manual_control_rss.py b/PythonAPI/examples/manual_control_rss.py
index 3c8b2632d..ce0f0c68c 100755
--- a/PythonAPI/examples/manual_control_rss.py
+++ b/PythonAPI/examples/manual_control_rss.py
@@ -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])
diff --git a/PythonAPI/examples/manual_control_steeringwheel.py b/PythonAPI/examples/manual_control_steeringwheel.py
index 8ac241728..7c98d3bb2 100755
--- a/PythonAPI/examples/manual_control_steeringwheel.py
+++ b/PythonAPI/examples/manual_control_steeringwheel.py
@@ -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])
diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/LidarDescription.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/LidarDescription.h
index 0fd0e5422..10ff9d849 100644
--- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/LidarDescription.h
+++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/LidarDescription.h
@@ -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;
diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastLidar.cpp b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastLidar.cpp
index 2dc82fe03..fdaf161e4 100644
--- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastLidar.cpp
+++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastLidar.cpp
@@ -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
diff --git a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastLidar.h b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastLidar.h
index 3819f002d..7a3a81c96 100644
--- a/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastLidar.h
+++ b/Unreal/CarlaUE4/Plugins/Carla/Source/Carla/Sensor/RayCastLidar.h
@@ -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;
};