From 61552ad6ca8314c06e133b7e62ca34489465831a Mon Sep 17 00:00:00 2001 From: Lucien Morey Date: Thu, 21 Nov 2024 15:43:33 +1100 Subject: [PATCH] Tidy up of python autogenerated messages (#1594) This fixes mostly formatting issues so there is no longer any diff with things after rerunning the generation script. Yes, most of this can be fixed by running wpiformat but that doesn't exist as a pre-commit hook atm, so I think this is nicer. It also removes any reference to the java encode/decode within the python message gen --- .styleguide | 2 + .../generated/PhotonPipelineResultSerde.py | 4 +- photon-serde/message_data_types.yaml | 12 ++++++ photon-serde/messages.yaml | 2 +- photon-serde/templates/Message.java.jinja | 38 +++++++++---------- photon-serde/templates/ThingSerde.cpp.jinja | 24 ++++++------ photon-serde/templates/ThingSerde.h.jinja | 2 +- photon-serde/templates/ThingSerde.py.jinja | 13 +++---- photon-serde/templates/ThingStruct.h.jinja | 2 +- .../struct/MultiTargetPNPResultSerde.java | 2 + .../struct/PhotonPipelineMetadataSerde.java | 3 ++ .../struct/PhotonPipelineResultSerde.java | 4 +- .../struct/PhotonTrackedTargetSerde.java | 1 + .../photonvision/struct/PnpResultSerde.java | 2 + .../struct/TargetCornerSerde.java | 3 ++ .../serde/MultiTargetPNPResultSerde.cpp | 11 +++--- .../serde/PhotonPipelineMetadataSerde.cpp | 15 ++++---- .../serde/PhotonPipelineResultSerde.cpp | 17 ++++----- .../photon/serde/PhotonTrackedTargetSerde.cpp | 31 ++++++++------- .../cpp/photon/serde/PnpResultSerde.cpp | 17 ++++----- .../cpp/photon/serde/TargetCornerSerde.cpp | 11 +++--- .../photon/serde/MultiTargetPNPResultSerde.h | 12 +++--- .../serde/PhotonPipelineMetadataSerde.h | 12 +++--- .../photon/serde/PhotonPipelineResultSerde.h | 15 +++----- .../photon/serde/PhotonTrackedTargetSerde.h | 16 +++----- .../include/photon/serde/PnpResultSerde.h | 9 ++--- .../include/photon/serde/TargetCornerSerde.h | 6 +-- .../struct/MultiTargetPNPResultStruct.h | 11 ++---- .../struct/PhotonPipelineMetadataStruct.h | 9 ++--- .../struct/PhotonPipelineResultStruct.h | 17 ++++----- .../photon/struct/PhotonTrackedTargetStruct.h | 14 +++---- .../include/photon/struct/PnpResultStruct.h | 10 ++--- .../photon/struct/TargetCornerStruct.h | 9 ++--- 33 files changed, 171 insertions(+), 185 deletions(-) diff --git a/.styleguide b/.styleguide index 376e3b22cc..1acec9bb54 100644 --- a/.styleguide +++ b/.styleguide @@ -20,6 +20,8 @@ modifiableFileExclude { \.ico$ \.rknn$ gradlew + photon-lib/py/photonlibpy/generated/ + photon-targeting/src/generated/ } includeProject { diff --git a/photon-lib/py/photonlibpy/generated/PhotonPipelineResultSerde.py b/photon-lib/py/photonlibpy/generated/PhotonPipelineResultSerde.py index 5023bfe2a4..cd46d787f5 100644 --- a/photon-lib/py/photonlibpy/generated/PhotonPipelineResultSerde.py +++ b/photon-lib/py/photonlibpy/generated/PhotonPipelineResultSerde.py @@ -42,9 +42,7 @@ def pack(value: "PhotonPipelineResult") -> "Packet": ret = Packet() # metadata is of non-intrinsic type PhotonPipelineMetadata - ret.encodeBytes( - PhotonPipelineMetadata.photonStruct.pack(value.metadata).getData() - ) + ret.encodeBytes(PhotonPipelineMetadata.photonStruct.pack(value.metadata).getData()) # targets is a custom VLA! ret.encodeList(value.targets, PhotonTrackedTarget.photonStruct) diff --git a/photon-serde/message_data_types.yaml b/photon-serde/message_data_types.yaml index 7970dd80ac..834822e7f5 100644 --- a/photon-serde/message_data_types.yaml +++ b/photon-serde/message_data_types.yaml @@ -6,6 +6,8 @@ bool: cpp_type: bool java_decode_method: decodeBoolean java_encode_shim: encodeBoolean + python_decode_shim: decodeBoolean + python_encode_shim: encodeBoolean int16: len: 2 java_type: short @@ -13,27 +15,37 @@ int16: java_decode_method: decodeShort java_list_decode_method: decodeShortList java_encode_shim: encodeShort + python_decode_shim: decodeShort + python_encode_shim: encodeShort int32: len: 4 java_type: int cpp_type: int32_t java_decode_method: decodeInt java_encode_shim: encodeInt + python_decode_shim: decodeInt + python_encode_shim: encodeInt int64: len: 8 java_type: long cpp_type: int64_t java_decode_method: decodeLong java_encode_shim: encodeLong + python_decode_shim: decodeLong + python_encode_shim: encodeLong float32: len: 4 java_type: float cpp_type: float java_decode_method: decodeFloat java_encode_shim: encodeFloat + python_decode_shim: decodeFloat + python_encode_shim: encodeFloat float64: len: 8 java_type: double cpp_type: double java_decode_method: decodeDouble java_encode_shim: encodeDouble + python_decode_shim: decodeDouble + python_encode_shim: encodeDouble diff --git a/photon-serde/messages.yaml b/photon-serde/messages.yaml index 6c4e461a3a..340e771807 100644 --- a/photon-serde/messages.yaml +++ b/photon-serde/messages.yaml @@ -16,7 +16,7 @@ java_encode_shim: PacketUtils.packTransform3d cpp_type: frc::Transform3d cpp_include: "" - python_decode_shim: packet.decodeTransform + python_decode_shim: decodeTransform python_encode_shim: encodeTransform java_import: edu.wpi.first.math.geometry.Transform3d # shim since we expect fields to at least exist diff --git a/photon-serde/templates/Message.java.jinja b/photon-serde/templates/Message.java.jinja index a7975295d5..dc10ddef20 100644 --- a/photon-serde/templates/Message.java.jinja +++ b/photon-serde/templates/Message.java.jinja @@ -54,26 +54,26 @@ public class {{ name }}Serde implements PacketSerde<{{name}}> { @Override public void pack(Packet packet, {{ name }} value) { {%- for field in fields -%} - {%- if field.type | is_shimmed %} +{%- if field.type | is_shimmed %} {{ get_message_by_name(field.type).java_encode_shim }}(packet, value.{{ field.name }}); - {%- elif field.optional == True %} +{%- elif field.optional == True %} // {{ field.name }} is optional! it better not be a VLA too packet.encodeOptional(value.{{ field.name }}); - {%- elif field.vla == True and field.type | is_intrinsic %} +{%- elif field.vla == True and field.type | is_intrinsic %} // {{ field.name }} is a intrinsic VLA! packet.encode(value.{{ field.name }}); - {%- elif field.vla == True %} +{%- elif field.vla == True %} // {{ field.name }} is a custom VLA! packet.encodeList(value.{{ field.name }}); - {%- elif field.type | is_intrinsic %} +{%- elif field.type | is_intrinsic %} // field {{ field.name }} is of intrinsic type {{ field.type }} packet.encode(({{ type_map[field.type].java_type }}) value.{{ field.name }}); - {%- else %} +{%- else %} // field {{ field.name }} is of non-intrinsic type {{ field.type }} {{ field.type }}.photonStruct.pack(packet, value.{{ field.name }}); - {%- endif %} - {%- if not loop.last %} - {% endif -%} +{%- endif %} +{%- if not loop.last %} +{% endif -%} {% endfor%} } @@ -81,26 +81,26 @@ public class {{ name }}Serde implements PacketSerde<{{name}}> { public {{ name }} unpack(Packet packet) { var ret = new {{ name }}(); {% for field in fields -%} - {%- if field.type | is_shimmed %} +{%- if field.type | is_shimmed %} ret.{{ field.name }} = {{ get_message_by_name(field.type).java_decode_shim }}(packet); - {%- elif field.optional == True %} +{%- elif field.optional == True %} // {{ field.name }} is optional! it better not be a VLA too ret.{{ field.name }} = packet.decodeOptional({{ field.type }}.photonStruct); - {%- elif field.vla == True and not field.type | is_intrinsic %} +{%- elif field.vla == True and not field.type | is_intrinsic %} // {{ field.name }} is a custom VLA! ret.{{ field.name }} = packet.decodeList({{ field.type }}.photonStruct); - {%- elif field.vla == True and field.type | is_intrinsic %} +{%- elif field.vla == True and field.type | is_intrinsic %} // {{ field.name }} is a custom VLA! ret.{{ field.name }} = packet.decode{{ type_map[field.type].java_type.title() }}List(); - {%- elif field.type | is_intrinsic %} +{%- elif field.type | is_intrinsic %} // {{ field.name }} is of intrinsic type {{ field.type }} ret.{{field.name}} = packet.{{ type_map[field.type].java_decode_method }}(); - {%- else %} +{%- else %} // {{ field.name }} is of non-intrinsic type {{ field.type }} ret.{{field.name}} = {{ field.type }}.photonStruct.unpack(packet); - {%- endif %} - {%- if not loop.last %} - {% endif -%} +{%- endif %} +{%- if not loop.last %} +{% endif -%} {% endfor%} return ret; @@ -125,4 +125,4 @@ public class {{ name }}Serde implements PacketSerde<{{name}}> { {%- endfor%} }; } -} +}{{'\n'}} diff --git a/photon-serde/templates/ThingSerde.cpp.jinja b/photon-serde/templates/ThingSerde.cpp.jinja index b5f4826f0c..28616ddc16 100644 --- a/photon-serde/templates/ThingSerde.cpp.jinja +++ b/photon-serde/templates/ThingSerde.cpp.jinja @@ -24,21 +24,21 @@ namespace photon { using StructType = SerdeType<{{ name }}>; void StructType::Pack(Packet& packet, const {{ name }}& value) { + {% for field in fields -%} + packet.Pack<{{ field | get_qualified_name }}>(value.{{ field.name }}); + {%- if not loop.last %} + {% endif -%} + {% endfor %} +} + +{{ name }} StructType::Unpack(Packet& packet) { + return {{ name }}{ {{ name }}_PhotonStruct{ {% for field in fields -%} - packet.Pack<{{ field | get_qualified_name }}>(value.{{ field.name }}); + .{{ field.name}} = packet.Unpack<{{ field | get_qualified_name }}>(), {%- if not loop.last %} {% endif -%} {% endfor %} + }}; } -{{ name }} StructType::Unpack(Packet& packet) { - return {{ name }}{ {{ name }}_PhotonStruct{ - {% for field in fields -%} - .{{ field.name}} = packet.Unpack<{{ field | get_qualified_name }}>(), - {%- if not loop.last %} - {% endif -%} - {% endfor %} - }}; -} - -} // namespace photon +} // namespace photon{{'\n'}} diff --git a/photon-serde/templates/ThingSerde.h.jinja b/photon-serde/templates/ThingSerde.h.jinja index c6d655b830..9325e59067 100644 --- a/photon-serde/templates/ThingSerde.h.jinja +++ b/photon-serde/templates/ThingSerde.h.jinja @@ -48,4 +48,4 @@ struct WPILIB_DLLEXPORT SerdeType<{{ name }}> { static_assert(photon::PhotonStructSerializable); -} // namespace photon +} // namespace photon{{'\n'}} diff --git a/photon-serde/templates/ThingSerde.py.jinja b/photon-serde/templates/ThingSerde.py.jinja index 82cedc4354..2ee9c9aaff 100644 --- a/photon-serde/templates/ThingSerde.py.jinja +++ b/photon-serde/templates/ThingSerde.py.jinja @@ -44,7 +44,7 @@ class {{ name }}Serde: MESSAGE_FORMAT = "{{ message_fmt }}" @staticmethod - def pack(value: '{{ name }}' ) -> 'Packet': + def pack(value: "{{ name }}") -> "Packet": ret = Packet() {% for field in fields -%} {%- if field.type | is_shimmed %} @@ -60,7 +60,7 @@ class {{ name }}Serde: ret.encode{{ type_map[field.type].java_type.title() }}List(value.{{ field.name }}) {%- elif field.type | is_intrinsic %} # {{ field.name }} is of intrinsic type {{ field.type }} - ret.{{ type_map[field.type].java_encode_shim }}(value.{{field.name}}) + ret.{{ type_map[field.type].python_encode_shim }}(value.{{field.name}}) {%- else %} # {{ field.name }} is of non-intrinsic type {{ field.type }} ret.encodeBytes({{ field.type }}.photonStruct.pack(value.{{field.name}}).getData()) @@ -70,13 +70,12 @@ class {{ name }}Serde: {% endfor%} return ret - @staticmethod - def unpack(packet: 'Packet') -> '{{ name }}': + def unpack(packet: "Packet") -> "{{ name }}": ret = {{ name }}() {% for field in fields -%} {%- if field.type | is_shimmed %} - ret.{{ field.name }} = {{ get_message_by_name(field.type).python_decode_shim }}() + ret.{{ field.name }} = packet.{{ get_message_by_name(field.type).python_decode_shim }}() {%- elif field.optional == True %} # {{ field.name }} is optional! it better not be a VLA too ret.{{ field.name }} = packet.decodeOptional({{ field.type }}.photonStruct) @@ -88,7 +87,7 @@ class {{ name }}Serde: ret.{{ field.name }} = packet.decode{{ type_map[field.type].java_type.title() }}List() {%- elif field.type | is_intrinsic %} # {{ field.name }} is of intrinsic type {{ field.type }} - ret.{{field.name}} = packet.{{ type_map[field.type].java_decode_method }}() + ret.{{field.name}} = packet.{{ type_map[field.type].python_decode_shim }}() {%- else %} # {{ field.name }} is of non-intrinsic type {{ field.type }} ret.{{field.name}} = {{ field.type }}.photonStruct.unpack(packet) @@ -101,4 +100,4 @@ class {{ name }}Serde: # Hack ourselves into the base class -{{ name }}.photonStruct = {{ name }}Serde() +{{ name }}.photonStruct = {{ name }}Serde(){{'\n'}} diff --git a/photon-serde/templates/ThingStruct.h.jinja b/photon-serde/templates/ThingStruct.h.jinja index 545eb1a138..89ff2cf9ee 100644 --- a/photon-serde/templates/ThingStruct.h.jinja +++ b/photon-serde/templates/ThingStruct.h.jinja @@ -36,4 +36,4 @@ struct {{ name }}_PhotonStruct { friend bool operator==({{ name }}_PhotonStruct const&, {{ name }}_PhotonStruct const&) = default; }; -} // namespace photon +} // namespace photon{{'\n'}} diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/MultiTargetPNPResultSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/MultiTargetPNPResultSerde.java index 1be3cf633d..253a70c50d 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/MultiTargetPNPResultSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/MultiTargetPNPResultSerde.java @@ -34,6 +34,7 @@ * Auto-generated serialization/deserialization helper for MultiTargetPNPResult */ public class MultiTargetPNPResultSerde implements PacketSerde { + @Override public final String getInterfaceUUID() { return "541096947e9f3ca2d3f425ff7b04aa7b"; } @Override @@ -79,6 +80,7 @@ public PacketSerde[] getNestedPhotonMessages() { @Override public Struct[] getNestedWpilibMessages() { return new Struct[] { + }; } } diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineMetadataSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineMetadataSerde.java index df28ed9060..0832084de8 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineMetadataSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineMetadataSerde.java @@ -34,6 +34,7 @@ * Auto-generated serialization/deserialization helper for PhotonPipelineMetadata */ public class PhotonPipelineMetadataSerde implements PacketSerde { + @Override public final String getInterfaceUUID() { return "ac0a45f686457856fb30af77699ea356"; } @Override @@ -84,12 +85,14 @@ public PhotonPipelineMetadata unpack(Packet packet) { @Override public PacketSerde[] getNestedPhotonMessages() { return new PacketSerde[] { + }; } @Override public Struct[] getNestedWpilibMessages() { return new Struct[] { + }; } } diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineResultSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineResultSerde.java index 9bac6213c8..aefd35c56b 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineResultSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonPipelineResultSerde.java @@ -34,6 +34,7 @@ * Auto-generated serialization/deserialization helper for PhotonPipelineResult */ public class PhotonPipelineResultSerde implements PacketSerde { + @Override public final String getInterfaceUUID() { return "4b2ff16a964b5e2bf04be0c1454d91c4"; } @Override @@ -78,13 +79,14 @@ public PhotonPipelineResult unpack(Packet packet) { @Override public PacketSerde[] getNestedPhotonMessages() { return new PacketSerde[] { - MultiTargetPNPResult.photonStruct,PhotonPipelineMetadata.photonStruct,PhotonTrackedTarget.photonStruct + PhotonPipelineMetadata.photonStruct,MultiTargetPNPResult.photonStruct,PhotonTrackedTarget.photonStruct }; } @Override public Struct[] getNestedWpilibMessages() { return new Struct[] { + }; } } diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonTrackedTargetSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonTrackedTargetSerde.java index 0c2beef2c3..fc45f054fc 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonTrackedTargetSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/PhotonTrackedTargetSerde.java @@ -34,6 +34,7 @@ * Auto-generated serialization/deserialization helper for PhotonTrackedTarget */ public class PhotonTrackedTargetSerde implements PacketSerde { + @Override public final String getInterfaceUUID() { return "cc6dbb5c5c1e0fa808108019b20863f1"; } @Override diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/PnpResultSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/PnpResultSerde.java index b9c7e695b3..eec6b06254 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/PnpResultSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/PnpResultSerde.java @@ -34,6 +34,7 @@ * Auto-generated serialization/deserialization helper for PnpResult */ public class PnpResultSerde implements PacketSerde { + @Override public final String getInterfaceUUID() { return "ae4d655c0a3104d88df4f5db144c1e86"; } @Override @@ -86,6 +87,7 @@ public PnpResult unpack(Packet packet) { @Override public PacketSerde[] getNestedPhotonMessages() { return new PacketSerde[] { + }; } diff --git a/photon-targeting/src/generated/main/java/org/photonvision/struct/TargetCornerSerde.java b/photon-targeting/src/generated/main/java/org/photonvision/struct/TargetCornerSerde.java index 64f190bf76..5cf1e12b82 100644 --- a/photon-targeting/src/generated/main/java/org/photonvision/struct/TargetCornerSerde.java +++ b/photon-targeting/src/generated/main/java/org/photonvision/struct/TargetCornerSerde.java @@ -34,6 +34,7 @@ * Auto-generated serialization/deserialization helper for TargetCorner */ public class TargetCornerSerde implements PacketSerde { + @Override public final String getInterfaceUUID() { return "16f6ac0dedc8eaccb951f4895d9e18b6"; } @Override @@ -72,12 +73,14 @@ public TargetCorner unpack(Packet packet) { @Override public PacketSerde[] getNestedPhotonMessages() { return new PacketSerde[] { + }; } @Override public Struct[] getNestedWpilibMessages() { return new Struct[] { + }; } } diff --git a/photon-targeting/src/generated/main/native/cpp/photon/serde/MultiTargetPNPResultSerde.cpp b/photon-targeting/src/generated/main/native/cpp/photon/serde/MultiTargetPNPResultSerde.cpp index d4b1e77a46..a03ecd93a6 100644 --- a/photon-targeting/src/generated/main/native/cpp/photon/serde/MultiTargetPNPResultSerde.cpp +++ b/photon-targeting/src/generated/main/native/cpp/photon/serde/MultiTargetPNPResultSerde.cpp @@ -15,8 +15,7 @@ * along with this program. If not, see . */ -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include "photon/serde/MultiTargetPNPResultSerde.h" @@ -30,10 +29,10 @@ void StructType::Pack(Packet& packet, const MultiTargetPNPResult& value) { } MultiTargetPNPResult StructType::Unpack(Packet& packet) { - return MultiTargetPNPResult{MultiTargetPNPResult_PhotonStruct{ - .estimatedPose = packet.Unpack(), - .fiducialIDsUsed = packet.Unpack>(), + return MultiTargetPNPResult{ MultiTargetPNPResult_PhotonStruct{ + .estimatedPose = packet.Unpack(), + .fiducialIDsUsed = packet.Unpack>(), }}; } -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonPipelineMetadataSerde.cpp b/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonPipelineMetadataSerde.cpp index 2aece0916d..2f4652a44a 100644 --- a/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonPipelineMetadataSerde.cpp +++ b/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonPipelineMetadataSerde.cpp @@ -15,8 +15,7 @@ * along with this program. If not, see . */ -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include "photon/serde/PhotonPipelineMetadataSerde.h" @@ -32,12 +31,12 @@ void StructType::Pack(Packet& packet, const PhotonPipelineMetadata& value) { } PhotonPipelineMetadata StructType::Unpack(Packet& packet) { - return PhotonPipelineMetadata{PhotonPipelineMetadata_PhotonStruct{ - .sequenceID = packet.Unpack(), - .captureTimestampMicros = packet.Unpack(), - .publishTimestampMicros = packet.Unpack(), - .timeSinceLastPong = packet.Unpack(), + return PhotonPipelineMetadata{ PhotonPipelineMetadata_PhotonStruct{ + .sequenceID = packet.Unpack(), + .captureTimestampMicros = packet.Unpack(), + .publishTimestampMicros = packet.Unpack(), + .timeSinceLastPong = packet.Unpack(), }}; } -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonPipelineResultSerde.cpp b/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonPipelineResultSerde.cpp index a1f7d5071d..b582a06d92 100644 --- a/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonPipelineResultSerde.cpp +++ b/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonPipelineResultSerde.cpp @@ -15,8 +15,7 @@ * along with this program. If not, see . */ -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include "photon/serde/PhotonPipelineResultSerde.h" @@ -27,17 +26,15 @@ using StructType = SerdeType; void StructType::Pack(Packet& packet, const PhotonPipelineResult& value) { packet.Pack(value.metadata); packet.Pack>(value.targets); - packet.Pack>( - value.multitagResult); + packet.Pack>(value.multitagResult); } PhotonPipelineResult StructType::Unpack(Packet& packet) { - return PhotonPipelineResult{PhotonPipelineResult_PhotonStruct{ - .metadata = packet.Unpack(), - .targets = packet.Unpack>(), - .multitagResult = - packet.Unpack>(), + return PhotonPipelineResult{ PhotonPipelineResult_PhotonStruct{ + .metadata = packet.Unpack(), + .targets = packet.Unpack>(), + .multitagResult = packet.Unpack>(), }}; } -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonTrackedTargetSerde.cpp b/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonTrackedTargetSerde.cpp index 6b6b400198..2e190538f9 100644 --- a/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonTrackedTargetSerde.cpp +++ b/photon-targeting/src/generated/main/native/cpp/photon/serde/PhotonTrackedTargetSerde.cpp @@ -15,8 +15,7 @@ * along with this program. If not, see . */ -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include "photon/serde/PhotonTrackedTargetSerde.h" @@ -40,20 +39,20 @@ void StructType::Pack(Packet& packet, const PhotonTrackedTarget& value) { } PhotonTrackedTarget StructType::Unpack(Packet& packet) { - return PhotonTrackedTarget{PhotonTrackedTarget_PhotonStruct{ - .yaw = packet.Unpack(), - .pitch = packet.Unpack(), - .area = packet.Unpack(), - .skew = packet.Unpack(), - .fiducialId = packet.Unpack(), - .objDetectId = packet.Unpack(), - .objDetectConf = packet.Unpack(), - .bestCameraToTarget = packet.Unpack(), - .altCameraToTarget = packet.Unpack(), - .poseAmbiguity = packet.Unpack(), - .minAreaRectCorners = packet.Unpack>(), - .detectedCorners = packet.Unpack>(), + return PhotonTrackedTarget{ PhotonTrackedTarget_PhotonStruct{ + .yaw = packet.Unpack(), + .pitch = packet.Unpack(), + .area = packet.Unpack(), + .skew = packet.Unpack(), + .fiducialId = packet.Unpack(), + .objDetectId = packet.Unpack(), + .objDetectConf = packet.Unpack(), + .bestCameraToTarget = packet.Unpack(), + .altCameraToTarget = packet.Unpack(), + .poseAmbiguity = packet.Unpack(), + .minAreaRectCorners = packet.Unpack>(), + .detectedCorners = packet.Unpack>(), }}; } -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/cpp/photon/serde/PnpResultSerde.cpp b/photon-targeting/src/generated/main/native/cpp/photon/serde/PnpResultSerde.cpp index 521da3ed32..d0d810fec2 100644 --- a/photon-targeting/src/generated/main/native/cpp/photon/serde/PnpResultSerde.cpp +++ b/photon-targeting/src/generated/main/native/cpp/photon/serde/PnpResultSerde.cpp @@ -15,8 +15,7 @@ * along with this program. If not, see . */ -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include "photon/serde/PnpResultSerde.h" @@ -33,13 +32,13 @@ void StructType::Pack(Packet& packet, const PnpResult& value) { } PnpResult StructType::Unpack(Packet& packet) { - return PnpResult{PnpResult_PhotonStruct{ - .best = packet.Unpack(), - .alt = packet.Unpack(), - .bestReprojErr = packet.Unpack(), - .altReprojErr = packet.Unpack(), - .ambiguity = packet.Unpack(), + return PnpResult{ PnpResult_PhotonStruct{ + .best = packet.Unpack(), + .alt = packet.Unpack(), + .bestReprojErr = packet.Unpack(), + .altReprojErr = packet.Unpack(), + .ambiguity = packet.Unpack(), }}; } -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/cpp/photon/serde/TargetCornerSerde.cpp b/photon-targeting/src/generated/main/native/cpp/photon/serde/TargetCornerSerde.cpp index f492bdb8bf..cf814d05db 100644 --- a/photon-targeting/src/generated/main/native/cpp/photon/serde/TargetCornerSerde.cpp +++ b/photon-targeting/src/generated/main/native/cpp/photon/serde/TargetCornerSerde.cpp @@ -15,8 +15,7 @@ * along with this program. If not, see . */ -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include "photon/serde/TargetCornerSerde.h" @@ -30,10 +29,10 @@ void StructType::Pack(Packet& packet, const TargetCorner& value) { } TargetCorner StructType::Unpack(Packet& packet) { - return TargetCorner{TargetCorner_PhotonStruct{ - .x = packet.Unpack(), - .y = packet.Unpack(), + return TargetCorner{ TargetCorner_PhotonStruct{ + .x = packet.Unpack(), + .y = packet.Unpack(), }}; } -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/serde/MultiTargetPNPResultSerde.h b/photon-targeting/src/generated/main/native/include/photon/serde/MultiTargetPNPResultSerde.h index 2fc1a5f0c7..2f018bd8d5 100644 --- a/photon-targeting/src/generated/main/native/include/photon/serde/MultiTargetPNPResultSerde.h +++ b/photon-targeting/src/generated/main/native/include/photon/serde/MultiTargetPNPResultSerde.h @@ -17,8 +17,7 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include @@ -31,6 +30,7 @@ #include #include + namespace photon { template <> @@ -40,15 +40,13 @@ struct WPILIB_DLLEXPORT SerdeType { } static constexpr std::string_view GetSchema() { - return "PnpResult:ae4d655c0a3104d88df4f5db144c1e86 estimatedPose;int16 " - "fiducialIDsUsed[?];"; + return "PnpResult:ae4d655c0a3104d88df4f5db144c1e86 estimatedPose;int16 fiducialIDsUsed[?];"; } static photon::MultiTargetPNPResult Unpack(photon::Packet& packet); - static void Pack(photon::Packet& packet, - const photon::MultiTargetPNPResult& value); + static void Pack(photon::Packet& packet, const photon::MultiTargetPNPResult& value); }; static_assert(photon::PhotonStructSerializable); -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/serde/PhotonPipelineMetadataSerde.h b/photon-targeting/src/generated/main/native/include/photon/serde/PhotonPipelineMetadataSerde.h index d35454126c..3b4fd1cffe 100644 --- a/photon-targeting/src/generated/main/native/include/photon/serde/PhotonPipelineMetadataSerde.h +++ b/photon-targeting/src/generated/main/native/include/photon/serde/PhotonPipelineMetadataSerde.h @@ -17,8 +17,7 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include @@ -29,6 +28,7 @@ // Includes for dependant types #include + namespace photon { template <> @@ -38,15 +38,13 @@ struct WPILIB_DLLEXPORT SerdeType { } static constexpr std::string_view GetSchema() { - return "int64 sequenceID;int64 captureTimestampMicros;int64 " - "publishTimestampMicros;int64 timeSinceLastPong;"; + return "int64 sequenceID;int64 captureTimestampMicros;int64 publishTimestampMicros;int64 timeSinceLastPong;"; } static photon::PhotonPipelineMetadata Unpack(photon::Packet& packet); - static void Pack(photon::Packet& packet, - const photon::PhotonPipelineMetadata& value); + static void Pack(photon::Packet& packet, const photon::PhotonPipelineMetadata& value); }; static_assert(photon::PhotonStructSerializable); -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/serde/PhotonPipelineResultSerde.h b/photon-targeting/src/generated/main/native/include/photon/serde/PhotonPipelineResultSerde.h index dd0e97ecad..130c248abc 100644 --- a/photon-targeting/src/generated/main/native/include/photon/serde/PhotonPipelineResultSerde.h +++ b/photon-targeting/src/generated/main/native/include/photon/serde/PhotonPipelineResultSerde.h @@ -17,8 +17,7 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include @@ -34,6 +33,7 @@ #include #include + namespace photon { template <> @@ -43,18 +43,13 @@ struct WPILIB_DLLEXPORT SerdeType { } static constexpr std::string_view GetSchema() { - return "PhotonPipelineMetadata:ac0a45f686457856fb30af77699ea356 " - "metadata;PhotonTrackedTarget:cc6dbb5c5c1e0fa808108019b20863f1 " - "targets[?];optional " - "MultiTargetPNPResult:541096947e9f3ca2d3f425ff7b04aa7b " - "multitagResult;"; + return "PhotonPipelineMetadata:ac0a45f686457856fb30af77699ea356 metadata;PhotonTrackedTarget:cc6dbb5c5c1e0fa808108019b20863f1 targets[?];optional MultiTargetPNPResult:541096947e9f3ca2d3f425ff7b04aa7b multitagResult;"; } static photon::PhotonPipelineResult Unpack(photon::Packet& packet); - static void Pack(photon::Packet& packet, - const photon::PhotonPipelineResult& value); + static void Pack(photon::Packet& packet, const photon::PhotonPipelineResult& value); }; static_assert(photon::PhotonStructSerializable); -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/serde/PhotonTrackedTargetSerde.h b/photon-targeting/src/generated/main/native/include/photon/serde/PhotonTrackedTargetSerde.h index b1c026a782..4e95087d1b 100644 --- a/photon-targeting/src/generated/main/native/include/photon/serde/PhotonTrackedTargetSerde.h +++ b/photon-targeting/src/generated/main/native/include/photon/serde/PhotonTrackedTargetSerde.h @@ -17,8 +17,7 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include @@ -32,6 +31,7 @@ #include #include + namespace photon { template <> @@ -41,19 +41,13 @@ struct WPILIB_DLLEXPORT SerdeType { } static constexpr std::string_view GetSchema() { - return "float64 yaw;float64 pitch;float64 area;float64 skew;int32 " - "fiducialId;int32 objDetectId;float32 objDetectConf;Transform3d " - "bestCameraToTarget;Transform3d altCameraToTarget;float64 " - "poseAmbiguity;TargetCorner:16f6ac0dedc8eaccb951f4895d9e18b6 " - "minAreaRectCorners[?];TargetCorner:" - "16f6ac0dedc8eaccb951f4895d9e18b6 detectedCorners[?];"; + return "float64 yaw;float64 pitch;float64 area;float64 skew;int32 fiducialId;int32 objDetectId;float32 objDetectConf;Transform3d bestCameraToTarget;Transform3d altCameraToTarget;float64 poseAmbiguity;TargetCorner:16f6ac0dedc8eaccb951f4895d9e18b6 minAreaRectCorners[?];TargetCorner:16f6ac0dedc8eaccb951f4895d9e18b6 detectedCorners[?];"; } static photon::PhotonTrackedTarget Unpack(photon::Packet& packet); - static void Pack(photon::Packet& packet, - const photon::PhotonTrackedTarget& value); + static void Pack(photon::Packet& packet, const photon::PhotonTrackedTarget& value); }; static_assert(photon::PhotonStructSerializable); -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/serde/PnpResultSerde.h b/photon-targeting/src/generated/main/native/include/photon/serde/PnpResultSerde.h index f4359e4512..6acef1e57c 100644 --- a/photon-targeting/src/generated/main/native/include/photon/serde/PnpResultSerde.h +++ b/photon-targeting/src/generated/main/native/include/photon/serde/PnpResultSerde.h @@ -17,8 +17,7 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include @@ -30,6 +29,7 @@ #include #include + namespace photon { template <> @@ -39,8 +39,7 @@ struct WPILIB_DLLEXPORT SerdeType { } static constexpr std::string_view GetSchema() { - return "Transform3d best;Transform3d alt;float64 bestReprojErr;float64 " - "altReprojErr;float64 ambiguity;"; + return "Transform3d best;Transform3d alt;float64 bestReprojErr;float64 altReprojErr;float64 ambiguity;"; } static photon::PnpResult Unpack(photon::Packet& packet); @@ -49,4 +48,4 @@ struct WPILIB_DLLEXPORT SerdeType { static_assert(photon::PhotonStructSerializable); -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/serde/TargetCornerSerde.h b/photon-targeting/src/generated/main/native/include/photon/serde/TargetCornerSerde.h index 718d613a4b..ead8ce8177 100644 --- a/photon-targeting/src/generated/main/native/include/photon/serde/TargetCornerSerde.h +++ b/photon-targeting/src/generated/main/native/include/photon/serde/TargetCornerSerde.h @@ -17,8 +17,7 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY #include @@ -29,6 +28,7 @@ // Includes for dependant types #include + namespace photon { template <> @@ -47,4 +47,4 @@ struct WPILIB_DLLEXPORT SerdeType { static_assert(photon::PhotonStructSerializable); -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/struct/MultiTargetPNPResultStruct.h b/photon-targeting/src/generated/main/native/include/photon/struct/MultiTargetPNPResultStruct.h index a3c691f39b..2234a1437b 100644 --- a/photon-targeting/src/generated/main/native/include/photon/struct/MultiTargetPNPResultStruct.h +++ b/photon-targeting/src/generated/main/native/include/photon/struct/MultiTargetPNPResultStruct.h @@ -17,15 +17,13 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY // Includes for dependant types +#include "photon/targeting/PnpResult.h" #include - #include -#include "photon/targeting/PnpResult.h" namespace photon { @@ -33,8 +31,7 @@ struct MultiTargetPNPResult_PhotonStruct { photon::PnpResult estimatedPose; std::vector fiducialIDsUsed; - friend bool operator==(MultiTargetPNPResult_PhotonStruct const&, - MultiTargetPNPResult_PhotonStruct const&) = default; + friend bool operator==(MultiTargetPNPResult_PhotonStruct const&, MultiTargetPNPResult_PhotonStruct const&) = default; }; -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/struct/PhotonPipelineMetadataStruct.h b/photon-targeting/src/generated/main/native/include/photon/struct/PhotonPipelineMetadataStruct.h index de7e39767f..b351e248a9 100644 --- a/photon-targeting/src/generated/main/native/include/photon/struct/PhotonPipelineMetadataStruct.h +++ b/photon-targeting/src/generated/main/native/include/photon/struct/PhotonPipelineMetadataStruct.h @@ -17,12 +17,12 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY // Includes for dependant types #include + namespace photon { struct PhotonPipelineMetadata_PhotonStruct { @@ -31,8 +31,7 @@ struct PhotonPipelineMetadata_PhotonStruct { int64_t publishTimestampMicros; int64_t timeSinceLastPong; - friend bool operator==(PhotonPipelineMetadata_PhotonStruct const&, - PhotonPipelineMetadata_PhotonStruct const&) = default; + friend bool operator==(PhotonPipelineMetadata_PhotonStruct const&, PhotonPipelineMetadata_PhotonStruct const&) = default; }; -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/struct/PhotonPipelineResultStruct.h b/photon-targeting/src/generated/main/native/include/photon/struct/PhotonPipelineResultStruct.h index a6f65d97e4..14fa47caab 100644 --- a/photon-targeting/src/generated/main/native/include/photon/struct/PhotonPipelineResultStruct.h +++ b/photon-targeting/src/generated/main/native/include/photon/struct/PhotonPipelineResultStruct.h @@ -17,18 +17,16 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY // Includes for dependant types -#include - -#include -#include - #include "photon/targeting/MultiTargetPNPResult.h" #include "photon/targeting/PhotonPipelineMetadata.h" #include "photon/targeting/PhotonTrackedTarget.h" +#include +#include +#include + namespace photon { @@ -37,8 +35,7 @@ struct PhotonPipelineResult_PhotonStruct { std::vector targets; std::optional multitagResult; - friend bool operator==(PhotonPipelineResult_PhotonStruct const&, - PhotonPipelineResult_PhotonStruct const&) = default; + friend bool operator==(PhotonPipelineResult_PhotonStruct const&, PhotonPipelineResult_PhotonStruct const&) = default; }; -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/struct/PhotonTrackedTargetStruct.h b/photon-targeting/src/generated/main/native/include/photon/struct/PhotonTrackedTargetStruct.h index b6f480fb59..df55d22f1c 100644 --- a/photon-targeting/src/generated/main/native/include/photon/struct/PhotonTrackedTargetStruct.h +++ b/photon-targeting/src/generated/main/native/include/photon/struct/PhotonTrackedTargetStruct.h @@ -17,17 +17,14 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY // Includes for dependant types +#include "photon/targeting/TargetCorner.h" +#include #include - #include -#include - -#include "photon/targeting/TargetCorner.h" namespace photon { @@ -45,8 +42,7 @@ struct PhotonTrackedTarget_PhotonStruct { std::vector minAreaRectCorners; std::vector detectedCorners; - friend bool operator==(PhotonTrackedTarget_PhotonStruct const&, - PhotonTrackedTarget_PhotonStruct const&) = default; + friend bool operator==(PhotonTrackedTarget_PhotonStruct const&, PhotonTrackedTarget_PhotonStruct const&) = default; }; -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/struct/PnpResultStruct.h b/photon-targeting/src/generated/main/native/include/photon/struct/PnpResultStruct.h index 5afa65fda1..cdcf75e85e 100644 --- a/photon-targeting/src/generated/main/native/include/photon/struct/PnpResultStruct.h +++ b/photon-targeting/src/generated/main/native/include/photon/struct/PnpResultStruct.h @@ -17,13 +17,12 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY // Includes for dependant types +#include #include -#include namespace photon { @@ -34,8 +33,7 @@ struct PnpResult_PhotonStruct { double altReprojErr; double ambiguity; - friend bool operator==(PnpResult_PhotonStruct const&, - PnpResult_PhotonStruct const&) = default; + friend bool operator==(PnpResult_PhotonStruct const&, PnpResult_PhotonStruct const&) = default; }; -} // namespace photon +} // namespace photon diff --git a/photon-targeting/src/generated/main/native/include/photon/struct/TargetCornerStruct.h b/photon-targeting/src/generated/main/native/include/photon/struct/TargetCornerStruct.h index 2cb9b5029e..d4ee811fd6 100644 --- a/photon-targeting/src/generated/main/native/include/photon/struct/TargetCornerStruct.h +++ b/photon-targeting/src/generated/main/native/include/photon/struct/TargetCornerStruct.h @@ -17,20 +17,19 @@ #pragma once -// THIS std::FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO -// NOT MODIFY +// THIS FILE WAS AUTO-GENERATED BY ./photon-serde/generate_messages.py. DO NOT MODIFY // Includes for dependant types #include + namespace photon { struct TargetCorner_PhotonStruct { double x; double y; - friend bool operator==(TargetCorner_PhotonStruct const&, - TargetCorner_PhotonStruct const&) = default; + friend bool operator==(TargetCorner_PhotonStruct const&, TargetCorner_PhotonStruct const&) = default; }; -} // namespace photon +} // namespace photon