Feature/packetized data#1580
Conversation
| void setPacketSize(int packetSize); | ||
|
|
||
| void setPacketFrequency(int packetFrequency); | ||
|
|
There was a problem hiding this comment.
We should add comments here;
- I assume packetSize is in bytes?
- What does packetFrequency do? Is this the "max" frequency?
There was a problem hiding this comment.
Yes bytes.
I have changed frequencyLimit to BytesPerSecondLimit
moratom
left a comment
There was a problem hiding this comment.
Thanks, looks good!
We should bump RVC4 and RVC2 FW so it compiles and at add a warning on RVC4 that these are not implement at least (or implement the functionality on RVC4)
There was a problem hiding this comment.
We should make this be internal (ideally at least)
There was a problem hiding this comment.
Done here: e8c24dd Make PacketizedData struct private
| /** | ||
| * Maximal frequency beteen of packets (-1 = unlimited) | ||
| */ | ||
| int packetFrequency = -1; // |
There was a problem hiding this comment.
Worth considering a max bandiwidth setting instead may be better (easier to grasp and can also be applied in case the messages are not packatized).
There was a problem hiding this comment.
Changed here: c359769 Change frequencyLimit to BytesPerSecondLimit
There was a problem hiding this comment.
Pull request overview
This PR adds support for packetized data transfer, currently available only for RVC2 devices. The implementation allows data to be split into smaller packets and sent incrementally over XLink connections, with configurable packet size and frequency.
Key Changes
- Introduced
PacketizedDatadatatype to provide context for subsequent packet transfers - Added packet size and frequency configuration parameters to
XLinkOut - Implemented parsing logic to reconstruct original payloads from packetized data streams
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
include/depthai/pipeline/datatype/PacketizedData.hpp |
New datatype for representing packetized frame metadata |
include/depthai/pipeline/datatype/DatatypeEnum.hpp |
Added PacketizedData enum value |
src/pipeline/datatype/DatatypeEnum.cpp |
Registered PacketizedData in datatype hierarchy |
src/pipeline/datatype/StreamMessageParser.cpp |
Added parsing logic for PacketizedData messages |
include/depthai/properties/internal/XLinkOutProperties.hpp |
Added packetSize and packetFrequency properties |
include/depthai/pipeline/node/internal/XLinkOut.hpp |
Added getter/setter declarations for packet configuration |
src/pipeline/node/internal/XLinkOut.cpp |
Implemented packet configuration getters/setters |
include/depthai/pipeline/node/internal/XLinkInHost.hpp |
Added private helper methods for reading and parsing packetized data |
src/pipeline/node/internal/XLinkInHost.cpp |
Refactored data reading to support packetized transfers |
include/depthai/xlink/XLinkStream.hpp |
Made stream read/write methods const |
src/xlink/XLinkStream.cpp |
Updated implementations to match const signatures |
bindings/python/src/pipeline/node/NodeBindings.cpp |
Exposed packet configuration methods to Python API |
tests/src/ondevice_tests/xlink_test.cpp |
Added tests verifying packet timing and data integrity |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aljazkonec1
left a comment
There was a problem hiding this comment.
Thanks! Left some comments but looks good otherwise.
There is also a compiler warning that needs to be handled:
/home/aljaz/work-luxonis/depthai-core/src/utility/ProtoSerialize.cpp:138:11: warning: enumeration value ‘PacketizedData’ not handled in switch [-Wswitch]
138 | switch(datatype) {
| ^
/home/aljaz/work-luxonis/depthai-core/src/pipeline/node/host/Replay.cpp: In function ‘std::shared_ptr<dai::Buffer> dai::node::getMessage(std::shared_ptr<google::protobuf::Message>, dai::DatatypeEnum)’:
/home/aljaz/work-luxonis/depthai-core/src/pipeline/node/host/Replay.cpp:45:11: warning: enumeration value ‘PacketizedData’ not handled in switch [-Wswitch]
45 | switch(datatype) {
| ^
/home/aljaz/work-luxonis/depthai-core/src/pipeline/node/host/Replay.cpp: In function ‘std::shared_ptr<google::protobuf::Message> dai::node::getProtoMessage(dai::utility::BytePlayer&, dai::DatatypeEnum)’:
/home/aljaz/work-luxonis/depthai-core/src/pipeline/node/host/Replay.cpp:107:11: warning: enumeration value ‘PacketizedData’ not handled in switch [-Wswitch]
107 | switch(datatype) {
c59ebad to
bdd0bbe
Compare
|
#1580 (review) |
7222d40 to
1af49e9
Compare
1af49e9 to
53fb5c0
Compare
moratom
left a comment
There was a problem hiding this comment.
Looks good to me, let's add the RVC4 implementation as well before merging (should be faster now than later) and we have to do it anyhow.
| dai_add_test(calibration_handler_test src/onhost_tests/calibration_handler_test.cpp) | ||
| dai_set_test_labels(calibration_handler_test onhost ci) | ||
|
|
||
| # XLInkInHost test |
There was a problem hiding this comment.
I have added the RVC4 implementation here: https://gitlab.luxonis.com/luxonis/depthai/depthai-device-kb/-/merge_requests/246
53fb5c0 to
e8e09bc
Compare
a95d001 to
fa446a8
Compare
003c917 to
3385417
Compare
5a4c53a to
60208a3
Compare
a40f868 to
0c4f317
Compare
0c4f317 to
722e32d
Compare
Summary
This commit adds support for reading packetized data.
Currently, this functionality is available only for RVC2 devices.
New Structure
PacketizedData : Buffer— sent before the actual packetized data to provide context for subsequent packets.New Functions
XLinkInHoststd::shared_ptr<ADatatype> readData(const XLinkStream& stream) const;Reads incoming data from the specified stream.
std::shared_ptr<ADatatype> parsePacketizedData(const std::shared_ptr<PacketizedData>& packetizedData, const XLinkStream& stream) const;Parses packetized data and reconstructs the original payload.
void parseMessageGroup(const std::shared_ptr<MessageGroup>& messageGroup, const XLinkStream& stream) const;Handles message groups and their contained data packets.
New Parameters
XLinkOutPropertiesint packetSize— defines the packet size.int packetFrequency— defines how frequently packets are sent.Tests
tests/src/ondevice_tests/xlink_test.cpp.