Add script to export NebulaPacket topics from ROS2 bags to PCAP#455
Draft
manato wants to merge 2 commits into
Draft
Add script to export NebulaPacket topics from ROS2 bags to PCAP#455manato wants to merge 2 commits into
manato wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a standalone CLI tool to export Nebula LiDAR packet topics from a ROS 2 bag into a classic Ethernet (DLT_EN10MB) .pcap, synthesizing Ethernet/IPv4/UDP headers around each NebulaPacket.data payload and timestamping packets with NebulaPacket.stamp.
Changes:
- Introduces
scripts/nebula_rosbag_to_pcap.pyto read a ROS 2 bag viarosbag2_py, deserializenebula_msgs/msg/NebulaPacket(s), and emit a classic PCAP file. - Implements packet/frame construction (UDP, IPv4 with header checksum, Ethernet) plus optional UDP checksum computation and basic conversion statistics reporting.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+169
to
+171
| self._fh = path.open("wb") | ||
| # Classic PCAP little-endian, microsecond resolution, DLT_EN10MB. | ||
| self._fh.write(struct.pack("<IHHIIII", 0xA1B2C3D4, 2, 4, 0, 0, 65535, 1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
nebula_msgs/msg/NebulaPacketandnebula_msgs/msg/NebulaPacketstopics from ROS 2 bags into classic.pcapfiles.Description
scripts/nebula_rosbag_to_pcap.py, a CLI script that opens a ROS 2 bag withrosbag2_py, deserializes target topic messages, and exports eachNebulaPacket.stampas the PCAP packet timestamp.DLT_EN10MBlink type via thePcapWriterclass.--list-topics,--src-ip,--dst-ip,--src-port,--dst-port,--src-mac,--dst-mac, and--udp-checksum(choiceszeroorcompute), with validation for ports and MAC parsing.Example usage
Testing
Codex Task