Skip to content

Commit

Permalink
Log warning if any DualReturn mode is set without simulateBeamDiverge…
Browse files Browse the repository at this point in the history
…nce enabled
  • Loading branch information
kielczykowski-rai committed Dec 12, 2024
1 parent c8683e0 commit 77ee395
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Assets/RGLUnityPlugin/Scripts/LidarSensor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;
Expand Down Expand Up @@ -229,6 +230,13 @@ private void ApplyConfiguration(BaseLidarConfiguration newConfig)
{
rglGraphLidar.ConfigureNodeRaytraceBeamDivergence(lidarRaytraceNodeId, 0.0f, 0.0f);
}

if (!simulateBeamDivergence && IsDualReturnMode(returnMode))
{
Debug.LogWarning(
$"Dual return mode without {nameof(simulateBeamDivergence)} enabled will not take effect." +
"Please refer to documentation if the return mode is desired.");
}

rglGraphLidar.ConfigureNodeRaytraceReturnMode(lidarRaytraceNodeId, returnMode);

Expand Down Expand Up @@ -472,5 +480,10 @@ private void SetVelocityToRaytrace()

rglGraphLidar.ConfigureNodeRaytraceVelocity(lidarRaytraceNodeId, localLinearVelocity, localAngularVelocity);
}

private bool IsDualReturnMode(RGLReturnMode mode)
{
return ((Convert.ToInt32(mode) & (int)RGLReturnCount.DualReturn) == (int)RGLReturnCount.DualReturn);
}
}
}

0 comments on commit 77ee395

Please sign in to comment.