diff --git a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiAT128E2X.prefab b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiAT128E2X.prefab
index dbf1b4a3f..2070b9e8e 100644
--- a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiAT128E2X.prefab
+++ b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiAT128E2X.prefab
@@ -240,7 +240,7 @@ MonoBehaviour:
- topic: lidar/pointcloud_ex
publish: 1
fieldsPreset: 2
- fields: 01000000030000000c0000000b0000000a00000009000000080000000e000000
+ fields: 01000000030000000c0000000b000000090000000a000000080000000e000000
radarScanPublishers: []
--- !u!114 &9115279251508973176
MonoBehaviour:
@@ -1215,3 +1215,7 @@ MonoBehaviour:
distanceNoiseStDevBase: 0.02
distanceNoiseStDevRisePerMeter: 0
distanceNoiseMean: 0
+ rangeOverride:
+ enable: 0
+ minRange: 0
+ maxRange: 0
diff --git a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandar128E4X.prefab b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandar128E4X.prefab
index 4dedd677f..85b147ab4 100644
--- a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandar128E4X.prefab
+++ b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandar128E4X.prefab
@@ -143,7 +143,7 @@ MonoBehaviour:
- topic: lidar/pointcloud_ex
publish: 1
fieldsPreset: 2
- fields: 01000000030000000c0000000b0000000a00000009000000080000000e000000
+ fields: 01000000030000000c0000000b000000090000000a000000080000000e000000
radarScanPublishers: []
--- !u!114 &2398431948632788025
MonoBehaviour:
@@ -1118,6 +1118,10 @@ MonoBehaviour:
distanceNoiseStDevBase: 0.02
distanceNoiseStDevRisePerMeter: 0
distanceNoiseMean: 0
+ rangeOverride:
+ enable: 0
+ minRange: 0
+ maxRange: 0
highResolutionModeEnabled: 0
--- !u!1 &8835314765314878244
GameObject:
diff --git a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandar40P.prefab b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandar40P.prefab
index d1a4da892..8344efb35 100644
--- a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandar40P.prefab
+++ b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandar40P.prefab
@@ -469,7 +469,7 @@ MonoBehaviour:
- topic: lidar/pointcloud_ex
publish: 1
fieldsPreset: 2
- fields: 01000000030000000c0000000b0000000a00000009000000080000000e000000
+ fields: 01000000030000000c0000000b000000090000000a000000080000000e000000
radarScanPublishers: []
--- !u!114 &7675420128049466981
MonoBehaviour:
diff --git a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandarQT64.prefab b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandarQT64.prefab
index ebe2715ef..5ca5721a3 100644
--- a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandarQT64.prefab
+++ b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiPandarQT64.prefab
@@ -372,7 +372,7 @@ MonoBehaviour:
- topic: lidar/pointcloud_ex
publish: 1
fieldsPreset: 2
- fields: 01000000030000000c0000000b0000000a00000009000000080000000e000000
+ fields: 01000000030000000c0000000b000000090000000a000000080000000e000000
radarScanPublishers: []
--- !u!114 &1430391258634731476
MonoBehaviour:
diff --git a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiQT128C2X.prefab b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiQT128C2X.prefab
index 389423f5d..22e4386f1 100644
--- a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiQT128C2X.prefab
+++ b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/HesaiQT128C2X.prefab
@@ -61,7 +61,7 @@ MonoBehaviour:
- topic: lidar/pointcloud_ex
publish: 1
fieldsPreset: 2
- fields: 01000000030000000c0000000b0000000a00000009000000080000000e000000
+ fields: 01000000030000000c0000000b000000090000000a000000080000000e000000
radarScanPublishers: []
--- !u!114 &1429064023790827067
MonoBehaviour:
@@ -1484,6 +1484,10 @@ MonoBehaviour:
distanceNoiseStDevBase: 0.02
distanceNoiseStDevRisePerMeter: 0
distanceNoiseMean: 0
+ rangeOverride:
+ enable: 0
+ minRange: 0
+ maxRange: 0
--- !u!1 &6990615171978804803
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/VelodyneVLP16.prefab b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/VelodyneVLP16.prefab
index 40ca77d5b..7b5e90799 100644
--- a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/VelodyneVLP16.prefab
+++ b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/VelodyneVLP16.prefab
@@ -61,7 +61,7 @@ MonoBehaviour:
- topic: lidar/pointcloud_ex
publish: 1
fieldsPreset: 2
- fields: 01000000030000000c0000000b0000000a00000009000000080000000e000000
+ fields: 01000000030000000c0000000b000000090000000a000000080000000e000000
radarScanPublishers: []
--- !u!114 &4572956135196922574
MonoBehaviour:
diff --git a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/VelodyneVLP32C.prefab b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/VelodyneVLP32C.prefab
index f1441aa36..c0e4ef785 100644
--- a/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/VelodyneVLP32C.prefab
+++ b/Assets/AWSIM/Prefabs/Sensors/RobotecGPULidars/VelodyneVLP32C.prefab
@@ -61,7 +61,7 @@ MonoBehaviour:
- topic: lidar/pointcloud_ex
publish: 1
fieldsPreset: 2
- fields: 01000000030000000c0000000b0000000a00000009000000080000000e000000
+ fields: 01000000030000000c0000000b000000090000000a000000080000000e000000
radarScanPublishers: []
--- !u!114 &6422033487030486066
MonoBehaviour:
diff --git a/Assets/RGLUnityPlugin/Scripts/LidarModels/LidarConfiguration.cs b/Assets/RGLUnityPlugin/Scripts/LidarModels/LidarConfiguration.cs
index e70ccf1bf..04015d1ec 100644
--- a/Assets/RGLUnityPlugin/Scripts/LidarModels/LidarConfiguration.cs
+++ b/Assets/RGLUnityPlugin/Scripts/LidarModels/LidarConfiguration.cs
@@ -14,7 +14,6 @@
using System;
using UnityEngine;
-using UnityEngine.Serialization;
namespace RGLUnityPlugin
{
@@ -81,19 +80,9 @@ public virtual Matrix4x4[] GetRayPoses()
}
///
- /// Returns ranges for the generated rays.
- /// Ranges are retrieved from lasers description. May be overridden.
+ /// Returns ranges for the generated rays. Must be overridden.
///
- public virtual Vector2[] GetRayRanges()
- {
- Vector2[] rayRanges = new Vector2[PointCloudSize];
- Vector2[] laserRanges = laserArray.GetLaserRanges();
- for (int i = 0; i < HorizontalSteps; i++)
- {
- Array.Copy(laserRanges, 0, rayRanges, i * laserRanges.Length, laserRanges.Length);
- }
- return rayRanges;
- }
+ public abstract Vector2[] GetRayRanges();
///
/// Returns time offsets for the generated rays.
@@ -160,7 +149,51 @@ protected bool ValidateWithModel(BaseLidarConfiguration gold)
/// It allows the definition of the lidar with different ranges for each laser (channel).
///
[Serializable]
- public class LaserBasedRangeLidarConfiguration : BaseLidarConfiguration { }
+ public class LaserBasedRangeLidarConfiguration : BaseLidarConfiguration
+ {
+ [Serializable]
+ public class RangeOverride
+ {
+ [Tooltip("Flag to enable range overriding (single range (min, max) value for all LiDAR rays will be set)")]
+ public bool enable = false;
+
+ [Tooltip("Minimum range of the sensor")]
+ [Min(0)] public float minRange = 0.0f;
+
+ [Tooltip("Maximum range of the sensor")]
+ [Min(0)] public float maxRange = 0.0f;
+ }
+
+ public RangeOverride rangeOverride = new RangeOverride();
+
+ ///
+ /// Final form of GetRayRanges that handles range override (single range (min, max) value for all LiDAR rays).
+ /// If range override is disabled, GetRayLaserBasedRanges is called.
+ ///
+ public sealed override Vector2[] GetRayRanges()
+ {
+ if (rangeOverride.enable)
+ {
+ return new Vector2[1] {new Vector2(rangeOverride.minRange, rangeOverride.maxRange)};
+ }
+
+ return GetRayLaserBasedRanges();
+ }
+
+ ///
+ /// Ranges are retrieved from lasers description. May be overridden.
+ ///
+ public virtual Vector2[] GetRayLaserBasedRanges()
+ {
+ Vector2[] rayRanges = new Vector2[PointCloudSize];
+ Vector2[] laserRanges = laserArray.GetLaserRanges();
+ for (int i = 0; i < HorizontalSteps; i++)
+ {
+ Array.Copy(laserRanges, 0, rayRanges, i * laserRanges.Length, laserRanges.Length);
+ }
+ return rayRanges;
+ }
+ }
///
/// Lidar configuration for uniformly distributed rays along the horizontal axis with a uniform range for all the rays.
@@ -175,7 +208,7 @@ public class UniformRangeLidarConfiguration : BaseLidarConfiguration
[Tooltip("Maximum range of the sensor")]
[Min(0)] public float maxRange;
- public override Vector2[] GetRayRanges()
+ public sealed override Vector2[] GetRayRanges()
{
return new Vector2[1] {new Vector2(minRange, maxRange)};
}
@@ -195,9 +228,9 @@ gold is UniformRangeLidarConfiguration goldTyped &&
/// It contains properties and ray-generating methods specific to this lidar.
///
[Serializable]
- public class HesaiAT128LidarConfiguration : BaseLidarConfiguration
+ public class HesaiAT128LidarConfiguration : LaserBasedRangeLidarConfiguration
{
- public override Vector2[] GetRayRanges()
+ public override Vector2[] GetRayLaserBasedRanges()
{
// All channels fire laser pulses that measure the far field (> 7.2 m)
// Additionally, the NF-enabled channels also fire laser pulses that measure only the near field (0.5 to 7.2 m), at a time other
@@ -234,7 +267,7 @@ public override bool ValidateWithModel(LidarModel model)
/// It contains properties and ray-generating methods specific to this lidar.
///
[Serializable]
- public class HesaiQT128C2XLidarConfiguration : BaseLidarConfiguration
+ public class HesaiQT128C2XLidarConfiguration : LaserBasedRangeLidarConfiguration
{
private static int hesaiQT128LasersBankLength = 32;
@@ -280,7 +313,7 @@ public override bool ValidateWithModel(LidarModel model)
/// It contains properties and ray-generating methods specific to this lidar.
///
[Serializable]
- public class HesaiPandar128E4XLidarConfiguration : BaseLidarConfiguration
+ public class HesaiPandar128E4XLidarConfiguration : LaserBasedRangeLidarConfiguration
{
// High resolution mode changes laser array
public override LaserArray laserArray
diff --git a/docs/Components/Sensors/LiDARSensor/LiDARSensor/index.md b/docs/Components/Sensors/LiDARSensor/LiDARSensor/index.md
index 3eb548ade..92f27b223 100644
--- a/docs/Components/Sensors/LiDARSensor/LiDARSensor/index.md
+++ b/docs/Components/Sensors/LiDARSensor/LiDARSensor/index.md
@@ -139,9 +139,16 @@ horizontal and vertical beam divergence values (as they would be set to 0). Note
- `Max Random Period` - upper bound of time period in seconds used in random mode
- *Additional options (available for some Lidar Model Preset)*
- - `Min Range` - minimum range of the sensor (if not avaiable, the range is different for each laser in `Laser Array`)
- - `Max Range` - maximum range of the sensor (if not avaiable, the range is different for each laser in `Laser Array`)
- - `High Resolution Mode Enabled` - whether to activate high resolution mode (available for `Hesai Pandar 128E4X` LiDAR model)
+ - Uniform range LiDARs
+ - `Min Range` - minimum range of the sensor
+ - `Max Range` - maximum range of the sensor
+ - Non-uniform range LiDARs
+ - *Range Override Params*:
+ - `Enable` - enable/disable range overriding (if disabled, ranges are determined based on the laser ranges described in `Laser Array`)
+ - `Min Range` - minimum range of the sensor
+ - `Max Range` - maximum range of the sensor
+ - Hesai Pandar 128E4X
+ - `High Resolution Mode Enabled` - whether to activate high resolution mode
#### Output Data
`LidarSensor` provides public methods to extend this pipeline with additional `RGL` nodes.