Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add switch to change the method of assigning timestamps in raw packets #377

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Assets/RGLUnityPlugin/Scripts/LidarUdpPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public class LidarUdpPublisher : MonoBehaviour

public bool emitRawPackets = true;

[Header("General UDP Flags")]

[Tooltip("If enabled the timestamp for all packets will be the same (current scene time).\n" +
"If disabled the time progression (based on LiDAR manuals) will be simulated and different timestamps for each packet will be assigned.")]
public bool useTheSameTimestampForAllPackets = true;

[Header("Hesai LiDARs Flags")]

[Tooltip("Enable labeling the sequence number of Point Cloud UDP packets. It increases the packet size by an additional field.")]
Expand Down Expand Up @@ -304,6 +310,7 @@ private RGLUdpOptions GetUdpOptions(LidarModel currentLidarModel)
udpOptions += enableHesaiUdpSequence ? (UInt32)RGLUdpOptions.RGL_UDP_ENABLE_HESAI_UDP_SEQUENCE : 0;
udpOptions += enableHesaiUpCloseBlockageDetection ? (UInt32)RGLUdpOptions.RGL_UDP_UP_CLOSE_BLOCKAGE_DETECTION : 0;
udpOptions += enableHesaiPandarDriverCompatibilityForQt ? (UInt32)RGLUdpOptions.RGL_UDP_FIT_QT64_TO_HESAI_PANDAR_DRIVER : 0;
udpOptions += useTheSameTimestampForAllPackets ? (UInt32)RGLUdpOptions.RGL_UDP_SAME_TIMESTAMP_FOR_PACKETS : 0;

// Check if high resolution mode is enabled (available only on Hesai Pandar128E4X)
if (currentLidarModel == LidarModel.HesaiPandar128E4X)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ public enum RGLUdpOptions : UInt32
RGL_UDP_HIGH_RESOLUTION_MODE = 1 << 1,
RGL_UDP_UP_CLOSE_BLOCKAGE_DETECTION = 1 << 2,
RGL_UDP_FIT_QT64_TO_HESAI_PANDAR_DRIVER = 1 << 3,
RGL_UDP_SAME_TIMESTAMP_FOR_PACKETS = 1 << 4
};

public enum RGLQosPolicyReliability
Expand Down
Loading