[wpiutil] Change C++ protobuf to nanopb (#7309)

The Google C++ protobuf implementation has issues with dynamic linkage across DLL boundaries because it uses global variables.  It also has a compile-time dependency because the protoc version must exactly match the libprotobuf version.  Using nanopb with a customized generator fixes both of these issues.

Co-authored-by: Gold856 <117957790+Gold856@users.noreply.github.com>
This commit is contained in:
Thad House
2024-11-07 22:42:50 -08:00
committed by GitHub
parent fd2e0c0427
commit 8b8b634f65
166 changed files with 17522 additions and 1571 deletions

View File

@@ -33,6 +33,13 @@ def main():
],
check=True,
)
subprocess.run(
[
sys.executable,
f"{REPO_ROOT}/wpimath/generate_nanopb.py",
],
check=True,
)
subprocess.run(
[sys.executable, f"{REPO_ROOT}/wpiunits/generate_units.py"], check=True
)
@@ -53,6 +60,13 @@ def main():
[sys.executable, f"{REPO_ROOT}/wpilibj/generate_pwm_motor_controllers.py"],
check=True,
)
subprocess.run(
[
sys.executable,
f"{REPO_ROOT}/wpiutil/generate_nanopb.py",
],
check=True,
)
subprocess.run(
[sys.executable, f"{REPO_ROOT}/thirdparty/imgui_suite/generate_gl3w.py"],
check=True,

View File

@@ -22,8 +22,8 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install jinja
run: python -m pip install jinja2
- name: Install jinja and protobuf
run: python -m pip install jinja2 protobuf grpcio-tools
- name: Install protobuf dependencies
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler && wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.3/protoc-gen-quickbuf-1.3.3-linux-x86_64.exe && chmod +x protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Regenerate all

2
.gitignore vendored
View File

@@ -15,6 +15,8 @@ networktables.json
ntcore/connectionlistenertest.json
ntcore/timesynctest.json
nanopb_pb2.py
# Created by the jenkins test script
test-reports

View File

@@ -155,6 +155,13 @@ protobuf {
}
generateProtoTasks {
all().configureEach { task ->
if (project.hasProperty('skipproto')) {
task.builtins {
cpp {}
remove java
}
return
}
task.inputs.file(rootProject.file("protoplugin/binary/wpiprotoplugin.jar"))
task.plugins {
wpilib {

76
upstream_utils/nanopb.py Executable file
View File

@@ -0,0 +1,76 @@
#!/usr/bin/env python3
import os
import shutil
from upstream_utils import Lib, copy_to, walk_if
nanopb_sources = set(
[
"pb_encode.c",
"pb_decode.c",
"pb_common.c",
]
)
nanopb_headers = set(
[
"pb.h",
"pb_encode.h",
"pb_decode.h",
"pb_common.h",
]
)
nanopb_generator = set(
[
"pb.h",
"pb_encode.h",
"pb_decode.h",
"pb_common.h",
]
)
def copy_upstream_src(wpilib_root):
wpiutil = os.path.join(wpilib_root, "wpiutil")
# Delete old install
for d in [
"src/main/native/thirdparty/nanopb/src",
"src/main/native/thirdparty/nanopb/include",
"src/main/native/thirdparty/nanopb/generator",
]:
shutil.rmtree(os.path.join(wpiutil, d), ignore_errors=True)
# Copy nanopb source files into allwpilib
copy_to(
nanopb_sources,
os.path.join(wpiutil, "src/main/native/thirdparty/nanopb/src"),
rename_c_to_cpp=True,
)
# Copy nanopb header files into allwpilib
copy_to(
nanopb_headers,
os.path.join(wpiutil, "src/main/native/thirdparty/nanopb/include"),
)
generator_files = walk_if("generator", lambda dp, f: True)
copy_to(
generator_files,
os.path.join(wpiutil, "src/main/native/thirdparty/nanopb"),
)
def main():
name = "nanopb"
url = "https://github.com/nanopb/nanopb"
tag = "0.4.9"
nanopb = Lib(name, url, tag, copy_upstream_src)
nanopb.main()
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,909 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thad House <thadhouse1@gmail.com>
Date: Mon, 28 Oct 2024 17:38:55 -0700
Subject: [PATCH 1/4] Marked imported files as modified by WPILib
---
generator/nanopb_generator.py | 2 +
pb.h | 2 +
pb_common.c | 3 +-
pb_common.h | 2 +
pb_decode.c | 144 +++++++++++++++++-----------------
pb_decode.h | 2 +
pb_encode.c | 80 ++++++++++---------
pb_encode.h | 2 +
8 files changed, 126 insertions(+), 111 deletions(-)
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 6068042b59da04842ff13d4d56dfc35366003a5f..735e4b7b31cdb66a1cdfbd2da6ae8fcde5986147 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python3
# kate: replace-tabs on; indent-width 4;
+# Modified for WPILib use
+
from __future__ import unicode_literals
'''Generate header file for nanopb from a ProtoBuf FileDescriptorSet.'''
diff --git a/pb.h b/pb.h
index 1bff70e4e6fbf029e3d6140f5ffd812b9bc7d12e..cec078fe40d526712eda771db077ebf31c95e076 100644
--- a/pb.h
+++ b/pb.h
@@ -1,5 +1,7 @@
/* Common parts of the nanopb library. Most of these are quite low-level
* stuff. For the high-level interface, see pb_encode.h and pb_decode.h.
+ *
+ * Modified for WPILib Use
*/
#ifndef PB_H_INCLUDED
diff --git a/pb_common.c b/pb_common.c
index 6aee76b1efa1e6f2f3fe7d43629da9b2114eea19..73698dd7c5b64f122f00a3a3dd8312b6d0e72557 100644
--- a/pb_common.c
+++ b/pb_common.c
@@ -1,4 +1,6 @@
/* pb_common.c: Common support functions for pb_encode.c and pb_decode.c.
+ *
+ * Modified for WPILib Use
*
* 2014 Petteri Aimonen <jpa@kapsi.fi>
*/
@@ -385,4 +387,3 @@ bool pb_validate_utf8(const char *str)
}
#endif
-
diff --git a/pb_common.h b/pb_common.h
index 58aa90f76d58596d3f45a120b65b4a0bff7fd688..d1d8bf55b13412887ab6d8fc6cfaf51348da9605 100644
--- a/pb_common.h
+++ b/pb_common.h
@@ -1,5 +1,7 @@
/* pb_common.h: Common support functions for pb_encode.c and pb_decode.c.
* These functions are rarely needed by applications directly.
+ *
+ * Modified for WPILib Use
*/
#ifndef PB_COMMON_H_INCLUDED
diff --git a/pb_decode.c b/pb_decode.c
index 068306a05339af05b3b3fb80894746ed9a077bf8..03143e02a596b2f03023437e5f18e5f118580d22 100644
--- a/pb_decode.c
+++ b/pb_decode.c
@@ -1,4 +1,6 @@
/* pb_decode.c -- decode a protobuf using minimal resources
+ *
+ * Modified for WPILib Use
*
* 2011 Petteri Aimonen <jpa@kapsi.fi>
*/
@@ -70,12 +72,12 @@ static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t co
{
const pb_byte_t *source = (const pb_byte_t*)stream->state;
stream->state = (pb_byte_t*)stream->state + count;
-
+
if (buf != NULL)
{
memcpy(buf, source, count * sizeof(pb_byte_t));
}
-
+
return true;
}
@@ -93,17 +95,17 @@ bool checkreturn pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count)
{
if (!pb_read(stream, tmp, 16))
return false;
-
+
count -= 16;
}
-
+
return pb_read(stream, tmp, count);
}
#endif
if (stream->bytes_left < count)
PB_RETURN_ERROR(stream, "end-of-stream");
-
+
#ifndef PB_BUFFER_ONLY
if (!stream->callback(stream, buf, count))
PB_RETURN_ERROR(stream, "io error");
@@ -111,7 +113,7 @@ bool checkreturn pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count)
if (!buf_read(stream, buf, count))
return false;
#endif
-
+
if (stream->bytes_left < count)
stream->bytes_left = 0;
else
@@ -136,8 +138,8 @@ static bool checkreturn pb_readbyte(pb_istream_t *stream, pb_byte_t *buf)
#endif
stream->bytes_left--;
-
- return true;
+
+ return true;
}
pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t msglen)
@@ -172,7 +174,7 @@ static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *d
{
pb_byte_t byte;
uint32_t result;
-
+
if (!pb_readbyte(stream, &byte))
{
if (stream->bytes_left == 0)
@@ -185,7 +187,7 @@ static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *d
return false;
}
-
+
if ((byte & 0x80) == 0)
{
/* Quick case, 1 byte value */
@@ -196,12 +198,12 @@ static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *d
/* Multibyte case */
uint_fast8_t bitpos = 7;
result = byte & 0x7F;
-
+
do
{
if (!pb_readbyte(stream, &byte))
return false;
-
+
if (bitpos >= 32)
{
/* Note: The varint could have trailing 0x80 bytes, or 0xFF for negative. */
@@ -229,7 +231,7 @@ static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *d
bitpos = (uint_fast8_t)(bitpos + 7);
} while (byte & 0x80);
}
-
+
*dest = result;
return true;
}
@@ -245,7 +247,7 @@ bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest)
pb_byte_t byte;
uint_fast8_t bitpos = 0;
uint64_t result = 0;
-
+
do
{
if (!pb_readbyte(stream, &byte))
@@ -257,7 +259,7 @@ bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest)
result |= (uint64_t)(byte & 0x7F) << bitpos;
bitpos = (uint_fast8_t)(bitpos + 7);
} while (byte & 0x80);
-
+
*dest = result;
return true;
}
@@ -279,7 +281,7 @@ bool checkreturn pb_skip_string(pb_istream_t *stream)
uint32_t length;
if (!pb_decode_varint32(stream, &length))
return false;
-
+
if ((size_t)length != length)
{
PB_RETURN_ERROR(stream, "size too large");
@@ -294,12 +296,12 @@ bool checkreturn pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type,
*eof = false;
*wire_type = (pb_wire_type_t) 0;
*tag = 0;
-
+
if (!pb_decode_varint32_eof(stream, &temp, eof))
{
return false;
}
-
+
*tag = temp >> 3;
*wire_type = (pb_wire_type_t)(temp & 7);
return true;
@@ -337,15 +339,15 @@ static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire
return false;
} while (*buf++ & 0x80);
return true;
-
+
case PB_WT_64BIT:
*size = 8;
return pb_read(stream, buf, 8);
-
+
case PB_WT_32BIT:
*size = 4;
return pb_read(stream, buf, 4);
-
+
case PB_WT_STRING:
/* Calling read_raw_value with a PB_WT_STRING is an error.
* Explicitly handle this case and fallthrough to default to avoid
@@ -364,11 +366,11 @@ bool checkreturn pb_make_string_substream(pb_istream_t *stream, pb_istream_t *su
uint32_t size;
if (!pb_decode_varint32(stream, &size))
return false;
-
+
*substream = *stream;
if (substream->bytes_left < size)
PB_RETURN_ERROR(stream, "parent stream too short");
-
+
substream->bytes_left = (size_t)size;
stream->bytes_left -= (size_t)size;
return true;
@@ -470,12 +472,12 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
{
case PB_HTYPE_REQUIRED:
return decode_basic_field(stream, wire_type, field);
-
+
case PB_HTYPE_OPTIONAL:
if (field->pSize != NULL)
*(bool*)field->pSize = true;
return decode_basic_field(stream, wire_type, field);
-
+
case PB_HTYPE_REPEATED:
if (wire_type == PB_WT_STRING
&& PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
@@ -560,12 +562,12 @@ static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t
* Zero size is not allowed, use pb_free() for releasing.
*/
static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size)
-{
+{
void *ptr = *(void**)pData;
-
+
if (data_size == 0 || array_size == 0)
PB_RETURN_ERROR(stream, "invalid size");
-
+
#ifdef __AVR__
/* Workaround for AVR libc bug 53284: http://savannah.nongnu.org/bugs/?53284
* Realloc to size of 1 byte can cause corruption of the malloc structures.
@@ -592,14 +594,14 @@ static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t
}
}
}
-
+
/* Allocate new or expand previous allocation */
/* Note: on failure the old pointer will remain in the structure,
* the message must be freed by caller also on error return. */
ptr = pb_realloc(ptr, array_size * data_size);
if (ptr == NULL)
PB_RETURN_ERROR(stream, "realloc failed");
-
+
*(void**)pData = ptr;
return true;
}
@@ -639,7 +641,7 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
/* FIXME: Does this work correctly for oneofs? */
pb_release_single_field(field);
}
-
+
if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
{
*(pb_size_t*)field->pSize = field->tag;
@@ -656,12 +658,12 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
{
if (!allocate_field(stream, field->pField, field->data_size, 1))
return false;
-
+
field->pData = *(void**)field->pField;
initialize_pointer_field(field->pData, field);
return decode_basic_field(stream, wire_type, field);
}
-
+
case PB_HTYPE_REPEATED:
if (wire_type == PB_WT_STRING
&& PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
@@ -671,10 +673,10 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
pb_size_t *size = (pb_size_t*)field->pSize;
size_t allocated_size = *size;
pb_istream_t substream;
-
+
if (!pb_make_string_substream(stream, &substream))
return false;
-
+
while (substream.bytes_left)
{
if (*size == PB_SIZE_MAX)
@@ -696,7 +698,7 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
allocated_size += remain;
else
allocated_size += 1;
-
+
if (!allocate_field(&substream, field->pField, field->data_size, allocated_size))
{
status = false;
@@ -718,12 +720,12 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
status = false;
break;
}
-
+
(*size)++;
}
if (!pb_close_string_substream(stream, &substream))
return false;
-
+
return status;
}
else
@@ -733,10 +735,10 @@ static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_
if (*size == PB_SIZE_MAX)
PB_RETURN_ERROR(stream, "too many array entries");
-
+
if (!allocate_field(stream, field->pField, field->data_size, (size_t)(*size + 1)))
return false;
-
+
field->pData = *(char**)field->pField + field->data_size * (*size);
(*size)++;
initialize_pointer_field(field->pData, field);
@@ -758,10 +760,10 @@ static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type
{
pb_istream_t substream;
size_t prev_bytes_left;
-
+
if (!pb_make_string_substream(stream, &substream))
return false;
-
+
do
{
prev_bytes_left = substream.bytes_left;
@@ -771,7 +773,7 @@ static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type
return false;
}
} while (substream.bytes_left > 0 && substream.bytes_left < prev_bytes_left);
-
+
if (!pb_close_string_substream(stream, &substream))
return false;
@@ -786,11 +788,11 @@ static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type
pb_istream_t substream;
pb_byte_t buffer[10];
size_t size = sizeof(buffer);
-
+
if (!read_raw_value(stream, wire_type, buffer, &size))
return false;
substream = pb_istream_from_buffer(buffer, size);
-
+
return field->descriptor->field_callback(&substream, NULL, field);
}
}
@@ -811,13 +813,13 @@ static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_t
{
case PB_ATYPE_STATIC:
return decode_static_field(stream, wire_type, field);
-
+
case PB_ATYPE_POINTER:
return decode_pointer_field(stream, wire_type, field);
-
+
case PB_ATYPE_CALLBACK:
return decode_callback_field(stream, wire_type, field);
-
+
default:
PB_RETURN_ERROR(stream, "invalid field type");
}
@@ -847,7 +849,7 @@ static bool checkreturn decode_extension(pb_istream_t *stream,
uint32_t tag, pb_wire_type_t wire_type, pb_extension_t *extension)
{
size_t pos = stream->bytes_left;
-
+
while (extension != NULL && pos == stream->bytes_left)
{
bool status;
@@ -858,10 +860,10 @@ static bool checkreturn decode_extension(pb_istream_t *stream,
if (!status)
return false;
-
+
extension = extension->next;
}
-
+
return true;
}
@@ -1170,12 +1172,12 @@ bool checkreturn pb_decode_ex(pb_istream_t *stream, const pb_msgdesc_t *fields,
if (!pb_close_string_substream(stream, &substream))
return false;
}
-
+
#ifdef PB_ENABLE_MALLOC
if (!status)
pb_release(fields, dest_struct);
#endif
-
+
return status;
}
@@ -1258,7 +1260,7 @@ static void pb_release_single_field(pb_field_iter_t *field)
{
/* Release fields in submessage or submsg array */
pb_size_t count = 1;
-
+
if (PB_ATYPE(type) == PB_ATYPE_POINTER)
{
field->pData = *(void**)field->pField;
@@ -1267,7 +1269,7 @@ static void pb_release_single_field(pb_field_iter_t *field)
{
field->pData = field->pField;
}
-
+
if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
{
count = *(pb_size_t*)field->pSize;
@@ -1278,7 +1280,7 @@ static void pb_release_single_field(pb_field_iter_t *field)
count = field->array_size;
}
}
-
+
if (field->pData)
{
for (; count > 0; count--)
@@ -1288,7 +1290,7 @@ static void pb_release_single_field(pb_field_iter_t *field)
}
}
}
-
+
if (PB_ATYPE(type) == PB_ATYPE_POINTER)
{
if (PB_HTYPE(type) == PB_HTYPE_REPEATED &&
@@ -1304,13 +1306,13 @@ static void pb_release_single_field(pb_field_iter_t *field)
*pItem++ = NULL;
}
}
-
+
if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
{
/* We are going to release the array, so set the size to 0 */
*(pb_size_t*)field->pSize = 0;
}
-
+
/* Release main pointer */
pb_free(*(void**)field->pField);
*(void**)field->pField = NULL;
@@ -1320,13 +1322,13 @@ static void pb_release_single_field(pb_field_iter_t *field)
void pb_release(const pb_msgdesc_t *fields, void *dest_struct)
{
pb_field_iter_t iter;
-
+
if (!dest_struct)
return; /* Ignore NULL pointers, similar to free() */
if (!pb_field_iter_begin(&iter, fields, dest_struct))
return; /* Empty message type */
-
+
do
{
pb_release_single_field(&iter);
@@ -1358,12 +1360,12 @@ bool pb_decode_svarint(pb_istream_t *stream, pb_int64_t *dest)
pb_uint64_t value;
if (!pb_decode_varint(stream, &value))
return false;
-
+
if (value & 1)
*dest = (pb_int64_t)(~(value >> 1));
else
*dest = (pb_int64_t)(value >> 1);
-
+
return true;
}
@@ -1499,17 +1501,17 @@ static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_iter_t
uint32_t size;
size_t alloc_size;
pb_bytes_array_t *dest;
-
+
if (!pb_decode_varint32(stream, &size))
return false;
-
+
if (size > PB_SIZE_MAX)
PB_RETURN_ERROR(stream, "bytes overflow");
-
+
alloc_size = PB_BYTES_ARRAY_T_ALLOCSIZE(size);
if (size > alloc_size)
PB_RETURN_ERROR(stream, "size too large");
-
+
if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
{
#ifndef PB_ENABLE_MALLOC
@@ -1570,7 +1572,7 @@ static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_iter_
if (alloc_size > field->data_size)
PB_RETURN_ERROR(stream, "string overflow");
}
-
+
dest[size] = 0;
if (!pb_read(stream, dest, (size_t)size))
@@ -1592,10 +1594,10 @@ static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_i
if (!pb_make_string_substream(stream, &substream))
return false;
-
+
if (field->submsg_desc == NULL)
PB_RETURN_ERROR(stream, "invalid field descriptor");
-
+
/* Submessages can have a separate message-level callback that is called
* before decoding the message. Typically it is used to set callback fields
* inside oneofs. */
@@ -1629,7 +1631,7 @@ static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_i
status = pb_decode_inner(&substream, field->submsg_desc, field->pData, flags);
}
-
+
if (!pb_close_string_substream(stream, &substream))
return false;
diff --git a/pb_decode.h b/pb_decode.h
index 3f392b29386e3dbbc69337316eb98029d239690a..c65d8ec716ea7282f68fdc2077a6a11130dd93fc 100644
--- a/pb_decode.h
+++ b/pb_decode.h
@@ -1,6 +1,8 @@
/* pb_decode.h: Functions to decode protocol buffers. Depends on pb_decode.c.
* The main function is pb_decode. You also need an input stream, and the
* field descriptions created by nanopb_generator.py.
+ *
+ * Modified for WPILib Use
*/
#ifndef PB_DECODE_H_INCLUDED
diff --git a/pb_encode.c b/pb_encode.c
index f9034a542848f0be0656e2e9eb2b467b2a83cf41..270a721863fd0a218a9667d5f4cadb6fb943c0b9 100644
--- a/pb_encode.c
+++ b/pb_encode.c
@@ -1,4 +1,6 @@
/* pb_encode.c -- encode a protobuf using minimal resources
+ *
+ * Modified for WPILib Use
*
* 2011 Petteri Aimonen <jpa@kapsi.fi>
*/
@@ -54,9 +56,9 @@ static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, si
{
pb_byte_t *dest = (pb_byte_t*)stream->state;
stream->state = dest + count;
-
+
memcpy(dest, buf, count * sizeof(pb_byte_t));
-
+
return true;
}
@@ -94,12 +96,12 @@ bool checkreturn pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t cou
#ifdef PB_BUFFER_ONLY
if (!buf_write(stream, buf, count))
PB_RETURN_ERROR(stream, "io error");
-#else
+#else
if (!stream->callback(stream, buf, count))
PB_RETURN_ERROR(stream, "io error");
#endif
}
-
+
stream->bytes_written += count;
return true;
}
@@ -140,14 +142,14 @@ static bool checkreturn encode_array(pb_ostream_t *stream, pb_field_iter_t *fiel
if (PB_ATYPE(field->type) != PB_ATYPE_POINTER && count > field->array_size)
PB_RETURN_ERROR(stream, "array max size exceeded");
-
+
#ifndef PB_ENCODE_ARRAYS_UNPACKED
/* We always pack arrays if the datatype allows it. */
if (PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
{
if (!pb_encode_tag(stream, PB_WT_STRING, field->tag))
return false;
-
+
/* Determine the total size of packed array. */
if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32)
{
@@ -158,7 +160,7 @@ static bool checkreturn encode_array(pb_ostream_t *stream, pb_field_iter_t *fiel
size = 8 * (size_t)count;
}
else
- {
+ {
pb_ostream_t sizestream = PB_OSTREAM_SIZING;
void *pData_orig = field->pData;
for (i = 0; i < count; i++)
@@ -170,13 +172,13 @@ static bool checkreturn encode_array(pb_ostream_t *stream, pb_field_iter_t *fiel
field->pData = pData_orig;
size = sizestream.bytes_written;
}
-
+
if (!pb_encode_varint(stream, (pb_uint64_t)size))
return false;
-
+
if (stream->callback == NULL)
return pb_write(stream, NULL, size); /* Just sizing.. */
-
+
/* Write the data */
for (i = 0; i < count; i++)
{
@@ -235,7 +237,7 @@ static bool checkreturn encode_array(pb_ostream_t *stream, pb_field_iter_t *fiel
field->pData = (char*)field->pData + field->data_size;
}
}
-
+
return true;
}
@@ -498,10 +500,10 @@ static bool checkreturn encode_extension_field(pb_ostream_t *stream, const pb_fi
if (!status)
return false;
-
+
extension = extension->next;
}
-
+
return true;
}
@@ -514,7 +516,7 @@ bool checkreturn pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, con
pb_field_iter_t iter;
if (!pb_field_iter_begin_const(&iter, fields, src_struct))
return true; /* Empty message type */
-
+
do {
if (PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION)
{
@@ -529,7 +531,7 @@ bool checkreturn pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, con
return false;
}
} while (pb_field_iter_next(&iter));
-
+
return true;
}
@@ -557,10 +559,10 @@ bool checkreturn pb_encode_ex(pb_ostream_t *stream, const pb_msgdesc_t *fields,
bool pb_get_encoded_size(size_t *size, const pb_msgdesc_t *fields, const void *src_struct)
{
pb_ostream_t stream = PB_OSTREAM_SIZING;
-
+
if (!pb_encode(&stream, fields, src_struct))
return false;
-
+
*size = stream.bytes_written;
return true;
}
@@ -630,7 +632,7 @@ bool checkreturn pb_encode_svarint(pb_ostream_t *stream, pb_int64_t value)
zigzagged = ~(((pb_uint64_t)value & mask) << 1);
else
zigzagged = (pb_uint64_t)value << 1;
-
+
return pb_encode_varint(stream, zigzagged);
}
@@ -689,15 +691,15 @@ bool pb_encode_tag_for_field ( pb_ostream_t* stream, const pb_field_iter_t* fiel
case PB_LTYPE_SVARINT:
wiretype = PB_WT_VARINT;
break;
-
+
case PB_LTYPE_FIXED32:
wiretype = PB_WT_32BIT;
break;
-
+
case PB_LTYPE_FIXED64:
wiretype = PB_WT_64BIT;
break;
-
+
case PB_LTYPE_BYTES:
case PB_LTYPE_STRING:
case PB_LTYPE_SUBMESSAGE:
@@ -705,11 +707,11 @@ bool pb_encode_tag_for_field ( pb_ostream_t* stream, const pb_field_iter_t* fiel
case PB_LTYPE_FIXED_LENGTH_BYTES:
wiretype = PB_WT_STRING;
break;
-
+
default:
PB_RETURN_ERROR(stream, "invalid field type");
}
-
+
return pb_encode_tag(stream, wiretype, field->tag);
}
@@ -717,7 +719,7 @@ bool checkreturn pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer,
{
if (!pb_encode_varint(stream, (pb_uint64_t)size))
return false;
-
+
return pb_write(stream, buffer, size);
}
@@ -727,7 +729,7 @@ bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_msgdesc_t *
pb_ostream_t substream = PB_OSTREAM_SIZING;
size_t size;
bool status;
-
+
if (!pb_encode(&substream, fields, src_struct))
{
#ifndef PB_NO_ERRMSG
@@ -735,18 +737,18 @@ bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_msgdesc_t *
#endif
return false;
}
-
+
size = substream.bytes_written;
-
+
if (!pb_encode_varint(stream, (pb_uint64_t)size))
return false;
-
+
if (stream->callback == NULL)
return pb_write(stream, NULL, size); /* Just sizing */
-
+
if (stream->bytes_written + size > stream->max_size)
PB_RETURN_ERROR(stream, "stream full");
-
+
/* Use a substream to verify that a callback doesn't write more than
* what it did the first time. */
substream.callback = stream->callback;
@@ -756,18 +758,18 @@ bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_msgdesc_t *
#ifndef PB_NO_ERRMSG
substream.errmsg = NULL;
#endif
-
+
status = pb_encode(&substream, fields, src_struct);
-
+
stream->bytes_written += substream.bytes_written;
stream->state = substream.state;
#ifndef PB_NO_ERRMSG
stream->errmsg = substream.errmsg;
#endif
-
+
if (substream.bytes_written != size)
PB_RETURN_ERROR(stream, "submsg size changed");
-
+
return status;
}
@@ -858,19 +860,19 @@ static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_iter_t
const pb_bytes_array_t *bytes = NULL;
bytes = (const pb_bytes_array_t*)field->pData;
-
+
if (bytes == NULL)
{
/* Treat null pointer as an empty bytes field */
return pb_encode_string(stream, NULL, 0);
}
-
+
if (PB_ATYPE(field->type) == PB_ATYPE_STATIC &&
bytes->size > field->data_size - offsetof(pb_bytes_array_t, bytes))
{
PB_RETURN_ERROR(stream, "bytes size exceeded");
}
-
+
return pb_encode_string(stream, bytes->bytes, (size_t)bytes->size);
}
@@ -879,7 +881,7 @@ static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_iter_
size_t size = 0;
size_t max_size = (size_t)field->data_size;
const char *str = (const char*)field->pData;
-
+
if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
{
max_size = (size_t)-1;
@@ -942,7 +944,7 @@ static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_i
return false;
}
}
-
+
return pb_encode_submessage(stream, field->submsg_desc, field->pData);
}
diff --git a/pb_encode.h b/pb_encode.h
index 6dc089da307a10a6d440e70acb2775ed6e7fb07c..22491a7f5e0d787e3c62b0a45dbae31a3c191f58 100644
--- a/pb_encode.h
+++ b/pb_encode.h
@@ -1,6 +1,8 @@
/* pb_encode.h: Functions to encode protocol buffers. Depends on pb_encode.c.
* The main function is pb_encode. You also need an output stream, and the
* field descriptions created by nanopb_generator.py.
+ *
+ * Modified for WPILib Use
*/
#ifndef PB_ENCODE_H_INCLUDED

View File

@@ -0,0 +1,188 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thad House <thadhouse1@gmail.com>
Date: Mon, 28 Oct 2024 16:58:15 -0700
Subject: [PATCH 2/4] Remove extern C
---
generator/nanopb_generator.py | 8 --------
pb.h | 8 --------
pb_common.h | 9 ---------
pb_decode.h | 16 ++++------------
pb_encode.h | 12 ++----------
5 files changed, 6 insertions(+), 47 deletions(-)
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 735e4b7b31cdb66a1cdfbd2da6ae8fcde5986147..239aed4f379b5d454e3b65c48ca11e9f92b6bc4d 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -2086,10 +2086,6 @@ class ProtoFile:
yield extension.extension_decl()
yield '\n'
- yield '#ifdef __cplusplus\n'
- yield 'extern "C" {\n'
- yield '#endif\n\n'
-
if self.enums:
yield '/* Helper constants for enums */\n'
for enum in self.enums:
@@ -2224,10 +2220,6 @@ class ProtoFile:
yield '#define %s %s\n' % (longname, shortname)
yield '\n'
- yield '#ifdef __cplusplus\n'
- yield '} /* extern "C" */\n'
- yield '#endif\n'
-
if options.cpp_descriptors:
yield '\n'
yield '#ifdef __cplusplus\n'
diff --git a/pb.h b/pb.h
index cec078fe40d526712eda771db077ebf31c95e076..a7fd771f05d7182e73ab346b46294c6fc5ac44c7 100644
--- a/pb.h
+++ b/pb.h
@@ -94,10 +94,6 @@
#endif
#endif
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Macro for defining packed structures (compiler dependent).
* This just reduces memory requirements, but is not required.
*/
@@ -895,10 +891,6 @@ struct pb_extension_s {
#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
#ifdef __cplusplus
#if __cplusplus >= 201103L
#define PB_CONSTEXPR constexpr
diff --git a/pb_common.h b/pb_common.h
index d1d8bf55b13412887ab6d8fc6cfaf51348da9605..f08a87389b89e6d73468fd0d8e58af7f998cbbf3 100644
--- a/pb_common.h
+++ b/pb_common.h
@@ -9,10 +9,6 @@
#include "pb.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Initialize the field iterator structure to beginning.
* Returns false if the message type is empty. */
bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message);
@@ -43,9 +39,4 @@ bool pb_field_iter_find_extension(pb_field_iter_t *iter);
bool pb_validate_utf8(const char *s);
#endif
-#ifdef __cplusplus
-} /* extern "C" */
#endif
-
-#endif
-
diff --git a/pb_decode.h b/pb_decode.h
index c65d8ec716ea7282f68fdc2077a6a11130dd93fc..a96f18169127c3d2cd80ba89138421f2340b1fe2 100644
--- a/pb_decode.h
+++ b/pb_decode.h
@@ -10,14 +10,10 @@
#include "pb.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Structure for defining custom input streams. You will need to provide
* a callback function to read the bytes from your storage, which can be
* for example a file or a network socket.
- *
+ *
* The callback must conform to these rules:
*
* 1) Return false on IO errors. This will cause decoding to abort.
@@ -51,7 +47,7 @@ struct pb_istream_s
* denial-of-service by excessively long messages.
*/
size_t bytes_left;
-
+
#ifndef PB_NO_ERRMSG
/* Pointer to constant (ROM) string when decoding function returns error */
const char *errmsg;
@@ -67,7 +63,7 @@ struct pb_istream_s
/***************************
* Main decoding functions *
***************************/
-
+
/* Decode a single protocol buffers message from input stream into a C structure.
* Returns true on success, false on any failure.
* The actual struct pointed to by dest must match the description in fields.
@@ -78,7 +74,7 @@ struct pb_istream_s
* MyMessage msg = {};
* uint8_t buffer[64];
* pb_istream_t stream;
- *
+ *
* // ... read some data into buffer ...
*
* stream = pb_istream_from_buffer(buffer, count);
@@ -199,8 +195,4 @@ bool pb_decode_double_as_float(pb_istream_t *stream, float *dest);
bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream);
bool pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream);
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
#endif
diff --git a/pb_encode.h b/pb_encode.h
index 22491a7f5e0d787e3c62b0a45dbae31a3c191f58..961bde1e3542392c1da6ea64cd15904af6289d22 100644
--- a/pb_encode.h
+++ b/pb_encode.h
@@ -10,10 +10,6 @@
#include "pb.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Structure for defining custom output streams. You will need to provide
* a callback function to write the bytes to your storage, which can be
* for example a file or a network socket.
@@ -51,7 +47,7 @@ struct pb_ostream_s
/* Number of bytes written so far. */
size_t bytes_written;
-
+
#ifndef PB_NO_ERRMSG
/* Pointer to constant (ROM) string when decoding function returns error */
const char *errmsg;
@@ -117,7 +113,7 @@ pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize);
/* Pseudo-stream for measuring the size of a message without actually storing
* the encoded data.
- *
+ *
* Example usage:
* MyMessage msg = {};
* pb_ostream_t stream = PB_OSTREAM_SIZING;
@@ -190,8 +186,4 @@ bool pb_encode_float_as_double(pb_ostream_t *stream, float value);
*/
bool pb_encode_submessage(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct);
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
#endif

View File

@@ -0,0 +1,28 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thad House <thadhouse1@gmail.com>
Date: Tue, 29 Oct 2024 20:23:48 -0700
Subject: [PATCH 3/4] Generate messages or anything non static as callback
---
generator/nanopb_generator.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 239aed4f379b5d454e3b65c48ca11e9f92b6bc4d..3b59ba59e6fc997350b1368a2faebc051cd6176a 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -683,10 +683,12 @@ class Field(ProtoElement):
# Decide how the field data will be allocated
if field_options.type == nanopb_pb2.FT_DEFAULT:
- if can_be_static:
+ if desc.type == FieldD.TYPE_MESSAGE:
+ field_options.type = nanopb_pb2.FT_CALLBACK
+ elif can_be_static:
field_options.type = nanopb_pb2.FT_STATIC
else:
- field_options.type = field_options.fallback_type
+ field_options.type = nanopb_pb2.FT_CALLBACK
if field_options.type == nanopb_pb2.FT_STATIC and not can_be_static:
raise Exception("Field '%s' is defined as static, but max_size or "

View File

@@ -0,0 +1,170 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Thad House <thadhouse1@gmail.com>
Date: Sat, 2 Nov 2024 20:25:45 -0700
Subject: [PATCH 4/4] Generate as cpp and add wpilib requirements
---
generator/nanopb_generator.py | 43 +++++++++++++++++++++++++++--------
pb.h | 23 +++++++++++++++----
2 files changed, 52 insertions(+), 14 deletions(-)
diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
index 3b59ba59e6fc997350b1368a2faebc051cd6176a..01fc349538aec0c67ec3fd9bfaf3a356adc08e96 100755
--- a/generator/nanopb_generator.py
+++ b/generator/nanopb_generator.py
@@ -1406,6 +1406,12 @@ class Message(ProtoElement):
result += '\n'
+ result += ' static const pb_msgdesc_t* msg_descriptor(void) noexcept;\n'
+ result += ' static std::string_view msg_name(void) noexcept;\n'
+ result += ' static pb_filedesc_t file_descriptor(void) noexcept;\n'
+
+ result += '\n'
+
if not self.fields:
# Empty structs are not allowed in C standard.
# Therefore add a dummy field if an empty message occurs.
@@ -2046,6 +2052,8 @@ class ProtoFile:
# no %s specified - use whatever was passed in as options.libformat
yield options.libformat
yield '\n'
+ yield "#include <span>\n"
+ yield "#include <string_view>\n"
for incfile in self.file_options.include:
# allow including system headers
@@ -2126,16 +2134,6 @@ class ProtoFile:
yield '/* Struct field encoding specification for nanopb */\n'
for msg in self.messages:
yield msg.fields_declaration(self.dependencies) + '\n'
- for msg in self.messages:
- yield 'extern const pb_msgdesc_t %s_msg;\n' % Globals.naming_style.type_name(msg.name)
- yield '\n'
-
- yield '/* Defines for backwards compatibility with code written before nanopb-0.4.0 */\n'
- for msg in self.messages:
- yield '#define %s &%s_msg\n' % (
- Globals.naming_style.define_name('%s_fields' % msg.name),
- Globals.naming_style.type_name(msg.name))
- yield '\n'
yield '/* Maximum encoded size of messages (where known) */\n'
messagesizes = []
@@ -2259,6 +2257,24 @@ class ProtoFile:
yield '#endif\n'
yield '\n'
+ yield "#include <span>\n"
+ yield "#include <string_view>\n"
+
+ yield "static const uint8_t file_descriptor[] {\n"
+
+ line_count = 0
+
+ for b in self.fdesc.SerializeToString():
+ yield '0x' + format(b, '02x') + ','
+ line_count += 1
+ if line_count == 10:
+ yield '\n'
+ line_count = 0
+ yield '\n'
+
+ yield "};\n"
+ yield 'static const char file_name[] = "%s";\n' % self.fdesc.name
+
# Check if any messages exceed the 64 kB limit of 16-bit pb_size_t
exceeds_64kB = []
for msg in self.messages:
@@ -2275,6 +2291,13 @@ class ProtoFile:
# Generate the message field definitions (PB_BIND() call)
for msg in self.messages:
+ if self.fdesc.package:
+ full_name = self.fdesc.package + '.' + msg.desc.name
+ else:
+ full_name = msg.desc.name
+ yield 'static const char %s_name[] = "%s";\n' % (msg.name, full_name)
+ yield 'std::string_view %s::msg_name(void) noexcept { return %s_name; }\n' % (msg.name, msg.name)
+ yield 'pb_filedesc_t %s::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }\n' % msg.name
yield msg.fields_definition(self.dependencies) + '\n\n'
# Generate pb_extension_type_t definitions if extensions are used in proto file
diff --git a/pb.h b/pb.h
index a7fd771f05d7182e73ab346b46294c6fc5ac44c7..832364a60900cbcb9134b6e122576436a6df6a00 100644
--- a/pb.h
+++ b/pb.h
@@ -89,6 +89,9 @@
#include <string.h>
#include <limits.h>
+#include <span>
+#include <string_view>
+
#ifdef PB_ENABLE_MALLOC
#include <stdlib.h>
#endif
@@ -315,6 +318,12 @@ typedef struct pb_istream_s pb_istream_t;
typedef struct pb_ostream_s pb_ostream_t;
typedef struct pb_field_iter_s pb_field_iter_t;
+typedef struct pb_filedesc_s pb_filedesc_t;
+struct pb_filedesc_s {
+ std::string_view file_name;
+ std::span<const uint8_t> file_descriptor;
+};
+
/* This structure is used in auto-generated constants
* to specify struct fields.
*/
@@ -329,6 +338,9 @@ struct pb_msgdesc_s {
pb_size_t field_count;
pb_size_t required_field_count;
pb_size_t largest_tag;
+
+ pb_filedesc_t file_descriptor;
+ std::string_view proto_name;
};
/* Iterator for message descriptor */
@@ -501,17 +513,17 @@ struct pb_extension_s {
/* Binding of a message field set into a specific structure */
#define PB_BIND(msgname, structname, width) \
- const uint32_t structname ## _field_info[] PB_PROGMEM = \
+ static const uint32_t structname ## _field_info[] PB_PROGMEM = \
{ \
msgname ## _FIELDLIST(PB_GEN_FIELD_INFO_ ## width, structname) \
0 \
}; \
- const pb_msgdesc_t* const structname ## _submsg_info[] = \
+ static const pb_msgdesc_t* const structname ## _submsg_info[] = \
{ \
msgname ## _FIELDLIST(PB_GEN_SUBMSG_INFO, structname) \
NULL \
}; \
- const pb_msgdesc_t structname ## _msg = \
+ static const pb_msgdesc_t structname ## _msg = \
{ \
structname ## _field_info, \
structname ## _submsg_info, \
@@ -520,7 +532,10 @@ struct pb_extension_s {
0 msgname ## _FIELDLIST(PB_GEN_FIELD_COUNT, structname), \
0 msgname ## _FIELDLIST(PB_GEN_REQ_FIELD_COUNT, structname), \
0 msgname ## _FIELDLIST(PB_GEN_LARGEST_TAG, structname), \
+ structname::file_descriptor(), \
+ structname::msg_name(), \
}; \
+ const pb_msgdesc_t* structname::msg_descriptor(void) noexcept { return &(structname ## _msg); } \
msgname ## _FIELDLIST(PB_GEN_FIELD_INFO_ASSERT_ ## width, structname)
#define PB_GEN_FIELD_COUNT(structname, atype, htype, ltype, fieldname, tag) +1
@@ -726,7 +741,7 @@ struct pb_extension_s {
#define PB_SI_PB_LTYPE_UINT64(t)
#define PB_SI_PB_LTYPE_EXTENSION(t)
#define PB_SI_PB_LTYPE_FIXED_LENGTH_BYTES(t)
-#define PB_SUBMSG_DESCRIPTOR(t) &(t ## _msg),
+#define PB_SUBMSG_DESCRIPTOR(t) (t::msg_descriptor()),
/* The field descriptors use a variable width format, with width of either
* 1, 2, 4 or 8 of 32-bit words. The two lowest bytes of the first byte always

View File

@@ -22,6 +22,7 @@ generatedFileExclude {
src/test/native/cpp/drake/
src/test/native/include/drake/
src/generated/main/java/edu/wpi/first/math/proto
src/generated/main/native/cpp
}
repoRootNameOverride {

View File

@@ -4,13 +4,6 @@ include(SubDirList)
include(CompileWarnings)
include(AddTest)
include(DownloadAndCheck)
include(WpiProtobuf)
if(WITH_PROTOBUF)
# workaround for makefiles - for some reason parent directories aren't created.
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/protobuf")
file(GLOB wpimath_proto_src src/main/proto/*.proto)
endif()
file(
GLOB wpimath_jni_src
@@ -122,49 +115,36 @@ file(
src/main/native/thirdparty/sleipnir/src/*.cpp
)
list(REMOVE_ITEM wpimath_native_src ${wpimath_jni_src})
if(NOT WITH_PROTOBUF)
list(FILTER wpimath_native_src EXCLUDE REGEX "/proto/")
endif()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS FALSE)
if(WITH_PROTOBUF)
add_library(protobuf OBJECT)
target_link_libraries(protobuf wpiutil)
file(GLOB_RECURSE wpimath_protobuf_native_src src/generated/main/native/cpp/wpimath/protobuf/*.cpp)
add_library(wpimath ${wpimath_native_src} $<TARGET_OBJECTS:protobuf>)
add_library(protobuf OBJECT ${wpimath_protobuf_native_src})
target_link_libraries(protobuf wpiutil)
wpi_protobuf_generate(
TARGET
protobuf
PROTOS ${wpimath_proto_src}
PLUGIN ${PROTOC_WPILIB_PLUGIN}
PROTOC_OUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/protobuf"
add_library(wpimath ${wpimath_native_src} $<TARGET_OBJECTS:protobuf>)
if(MSVC)
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
set(CONFIG_SUFFIX "$<$<BOOL:${IS_MULTI_CONFIG}>:_$<CONFIG>>")
file(
GENERATE OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/protobuf_objects${CONFIG_SUFFIX}.txt
CONTENT $<LIST:JOIN,$<TARGET_OBJECTS:protobuf>,\n>
)
if(MSVC)
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
set(CONFIG_SUFFIX "$<$<BOOL:${IS_MULTI_CONFIG}>:_$<CONFIG>>")
file(
GENERATE OUTPUT
add_custom_command(
TARGET wpimath
PRE_LINK
COMMAND
cmake -E __create_def ${CMAKE_CURRENT_BINARY_DIR}/protobuf_exports${CONFIG_SUFFIX}.def
${CMAKE_CURRENT_BINARY_DIR}/protobuf_objects${CONFIG_SUFFIX}.txt
CONTENT $<LIST:JOIN,$<TARGET_OBJECTS:protobuf>,\n>
)
add_custom_command(
TARGET wpimath
PRE_LINK
COMMAND
cmake -E __create_def
${CMAKE_CURRENT_BINARY_DIR}/protobuf_exports${CONFIG_SUFFIX}.def
${CMAKE_CURRENT_BINARY_DIR}/protobuf_objects${CONFIG_SUFFIX}.txt
)
target_link_options(
wpimath
PRIVATE
/DEF:$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/protobuf_exports${CONFIG_SUFFIX}.def>
)
endif()
else()
add_library(wpimath ${wpimath_native_src})
)
target_link_options(
wpimath
PRIVATE
/DEF:$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/protobuf_exports${CONFIG_SUFFIX}.def>
)
endif()
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
@@ -177,14 +157,6 @@ target_compile_features(wpimath PUBLIC cxx_std_20)
if(MSVC)
target_compile_options(wpimath PUBLIC /utf-8 /bigobj)
endif()
if(WITH_PROTOBUF)
target_compile_features(protobuf PUBLIC cxx_std_20)
if(MSVC)
target_compile_options(protobuf PUBLIC /utf-8 /bigobj)
endif()
endif()
wpilib_target_warnings(wpimath)
target_link_libraries(wpimath wpiutil)
@@ -222,7 +194,7 @@ target_include_directories(
wpimath
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/main/native/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/protobuf>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src/generated/main/native/cpp>
$<INSTALL_INTERFACE:${include_dest}/wpimath>
)

View File

@@ -21,6 +21,15 @@ ext {
'src/main/native/thirdparty/sleipnir/src'
}
}
nanopbCpp(CppSourceSet) {
source {
srcDirs 'src/generated/main/native/cpp'
include '**/*.cpp'
}
exportedHeaders {
srcDirs 'src/generated/main/native/cpp'
}
}
}
}
}
@@ -38,6 +47,10 @@ cppHeadersZip {
into '/wpimath/protobuf'
include '*.h'
}
from("src/generated/main/native/cpp/wpimath/protobuf") {
into '/wpimath/protobuf'
include '**/*.h'
}
from('src/main/native/thirdparty/sleipnir/include') {
into '/'
}
@@ -53,7 +66,8 @@ model {
srcDirs 'src/main/native/include',
'src/main/native/thirdparty/eigen/include',
'src/main/native/thirdparty/gcem/include',
'src/main/native/thirdparty/sleipnir/include'
'src/main/native/thirdparty/sleipnir/include',
'src/generated/main/native/cpp'
}
}
}
@@ -68,7 +82,7 @@ model {
nativeUtils.exportsConfigs {
wpimath {
objectFilterClosure = { file ->
return file.name.endsWith('.pb.obj')
return file.name.endsWith('.pb.obj') || file.name.endsWith('.npb.obj')
}
}
}

88
wpimath/generate_nanopb.py Executable file
View File

@@ -0,0 +1,88 @@
#!/usr/bin/env python3
# Copyright (c) FIRST and other WPILib contributors.
# Open Source Software; you can modify and/or share it under the terms of
# the WPILib BSD license file in the root directory of this project.
import argparse
import os
import shutil
import subprocess
import sys
from pathlib import Path
def generate_nanopb(nanopb: Path, output_directory: Path, proto_dir: Path):
shutil.rmtree(output_directory.absolute(), ignore_errors=True)
os.makedirs(output_directory.absolute())
proto_files = proto_dir.glob("*.proto")
for path in proto_files:
absolute_filename = path.absolute()
subprocess.run(
[
sys.executable,
nanopb,
f"-I{absolute_filename.parent}",
f"-D{output_directory.absolute()}",
"-S.cpp",
"-e.npb",
absolute_filename,
],
check=True,
)
java_files = (output_directory).glob("*")
for java_file in java_files:
with (java_file).open(encoding="utf-8") as f:
content = f.read()
java_file.write_text(
"// Copyright (c) FIRST and other WPILib contributors.\n// Open Source Software; you can modify and/or share it under the terms of\n// the WPILib BSD license file in the root directory of this project.\n"
+ content,
encoding="utf-8",
newline="\n",
)
def main():
script_path = Path(__file__).resolve()
dirname = script_path.parent
root_path = dirname.parent
nanopb_path = os.path.join(
root_path,
"wpiutil",
"src",
"main",
"native",
"thirdparty",
"nanopb",
"generator",
"nanopb_generator.py",
)
parser = argparse.ArgumentParser()
parser.add_argument(
"--nanopb",
help="Nanopb generator command",
default=nanopb_path,
)
parser.add_argument(
"--output_directory",
help="Optional. If set, will output the generated files to this directory, otherwise it will use a path relative to the script",
default=dirname / "src/generated/main/native/cpp/wpimath/protobuf",
type=Path,
)
parser.add_argument(
"--proto_directory",
help="Optional. If set, will use this directory to glob for protobuf files",
default=dirname / "src/main/proto",
type=Path,
)
args = parser.parse_args()
generate_nanopb(args.nanopb, args.output_directory, args.proto_directory)
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,245 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "controller.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x10,0x63,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x6c,
0x65,0x72,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,
0x68,0x0a,0x16,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,
0x66,0x41,0x72,0x6d,0x46,0x65,0x65,0x64,0x66,0x6f,
0x72,0x77,0x61,0x72,0x64,0x12,0x0e,0x0a,0x02,0x6b,
0x73,0x18,0x01,0x20,0x01,0x28,0x01,0x52,0x02,0x6b,
0x73,0x12,0x0e,0x0a,0x02,0x6b,0x67,0x18,0x02,0x20,
0x01,0x28,0x01,0x52,0x02,0x6b,0x67,0x12,0x0e,0x0a,
0x02,0x6b,0x76,0x18,0x03,0x20,0x01,0x28,0x01,0x52,
0x02,0x6b,0x76,0x12,0x0e,0x0a,0x02,0x6b,0x61,0x18,
0x04,0x20,0x01,0x28,0x01,0x52,0x02,0x6b,0x61,0x12,
0x0e,0x0a,0x02,0x64,0x74,0x18,0x05,0x20,0x01,0x28,
0x01,0x52,0x02,0x64,0x74,0x22,0x9e,0x01,0x0a,0x24,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x44,0x69,
0x66,0x66,0x65,0x72,0x65,0x6e,0x74,0x69,0x61,0x6c,
0x44,0x72,0x69,0x76,0x65,0x46,0x65,0x65,0x64,0x66,
0x6f,0x72,0x77,0x61,0x72,0x64,0x12,0x1b,0x0a,0x09,
0x6b,0x76,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x18,
0x01,0x20,0x01,0x28,0x01,0x52,0x08,0x6b,0x76,0x4c,
0x69,0x6e,0x65,0x61,0x72,0x12,0x1b,0x0a,0x09,0x6b,
0x61,0x5f,0x6c,0x69,0x6e,0x65,0x61,0x72,0x18,0x02,
0x20,0x01,0x28,0x01,0x52,0x08,0x6b,0x61,0x4c,0x69,
0x6e,0x65,0x61,0x72,0x12,0x1d,0x0a,0x0a,0x6b,0x76,
0x5f,0x61,0x6e,0x67,0x75,0x6c,0x61,0x72,0x18,0x03,
0x20,0x01,0x28,0x01,0x52,0x09,0x6b,0x76,0x41,0x6e,
0x67,0x75,0x6c,0x61,0x72,0x12,0x1d,0x0a,0x0a,0x6b,
0x61,0x5f,0x61,0x6e,0x67,0x75,0x6c,0x61,0x72,0x18,
0x04,0x20,0x01,0x28,0x01,0x52,0x09,0x6b,0x61,0x41,
0x6e,0x67,0x75,0x6c,0x61,0x72,0x22,0x6d,0x0a,0x1b,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x45,0x6c,
0x65,0x76,0x61,0x74,0x6f,0x72,0x46,0x65,0x65,0x64,
0x66,0x6f,0x72,0x77,0x61,0x72,0x64,0x12,0x0e,0x0a,
0x02,0x6b,0x73,0x18,0x01,0x20,0x01,0x28,0x01,0x52,
0x02,0x6b,0x73,0x12,0x0e,0x0a,0x02,0x6b,0x67,0x18,
0x02,0x20,0x01,0x28,0x01,0x52,0x02,0x6b,0x67,0x12,
0x0e,0x0a,0x02,0x6b,0x76,0x18,0x03,0x20,0x01,0x28,
0x01,0x52,0x02,0x6b,0x76,0x12,0x0e,0x0a,0x02,0x6b,
0x61,0x18,0x04,0x20,0x01,0x28,0x01,0x52,0x02,0x6b,
0x61,0x12,0x0e,0x0a,0x02,0x64,0x74,0x18,0x05,0x20,
0x01,0x28,0x01,0x52,0x02,0x64,0x74,0x22,0x60,0x0a,
0x1e,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x53,
0x69,0x6d,0x70,0x6c,0x65,0x4d,0x6f,0x74,0x6f,0x72,
0x46,0x65,0x65,0x64,0x66,0x6f,0x72,0x77,0x61,0x72,
0x64,0x12,0x0e,0x0a,0x02,0x6b,0x73,0x18,0x01,0x20,
0x01,0x28,0x01,0x52,0x02,0x6b,0x73,0x12,0x0e,0x0a,
0x02,0x6b,0x76,0x18,0x02,0x20,0x01,0x28,0x01,0x52,
0x02,0x6b,0x76,0x12,0x0e,0x0a,0x02,0x6b,0x61,0x18,
0x03,0x20,0x01,0x28,0x01,0x52,0x02,0x6b,0x61,0x12,
0x0e,0x0a,0x02,0x64,0x74,0x18,0x04,0x20,0x01,0x28,
0x01,0x52,0x02,0x64,0x74,0x22,0x52,0x0a,0x26,0x50,
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x44,0x69,0x66,
0x66,0x65,0x72,0x65,0x6e,0x74,0x69,0x61,0x6c,0x44,
0x72,0x69,0x76,0x65,0x57,0x68,0x65,0x65,0x6c,0x56,
0x6f,0x6c,0x74,0x61,0x67,0x65,0x73,0x12,0x12,0x0a,
0x04,0x6c,0x65,0x66,0x74,0x18,0x01,0x20,0x01,0x28,
0x01,0x52,0x04,0x6c,0x65,0x66,0x74,0x12,0x14,0x0a,
0x05,0x72,0x69,0x67,0x68,0x74,0x18,0x02,0x20,0x01,
0x28,0x01,0x52,0x05,0x72,0x69,0x67,0x68,0x74,0x42,
0x1a,0x0a,0x18,0x65,0x64,0x75,0x2e,0x77,0x70,0x69,
0x2e,0x66,0x69,0x72,0x73,0x74,0x2e,0x6d,0x61,0x74,
0x68,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x4a,0xf5,0x09,
0x0a,0x06,0x12,0x04,0x00,0x00,0x27,0x01,0x0a,0x08,
0x0a,0x01,0x0c,0x12,0x03,0x00,0x00,0x12,0x0a,0x08,
0x0a,0x01,0x02,0x12,0x03,0x02,0x00,0x12,0x0a,0x08,
0x0a,0x01,0x08,0x12,0x03,0x04,0x00,0x31,0x0a,0x09,
0x0a,0x02,0x08,0x01,0x12,0x03,0x04,0x00,0x31,0x0a,
0x0a,0x0a,0x02,0x04,0x00,0x12,0x04,0x06,0x00,0x0c,
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x00,0x01,0x12,0x03,
0x06,0x08,0x1e,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,
0x00,0x12,0x03,0x07,0x02,0x10,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x00,0x05,0x12,0x03,0x07,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x01,0x12,
0x03,0x07,0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x00,0x03,0x12,0x03,0x07,0x0e,0x0f,0x0a,0x0b,
0x0a,0x04,0x04,0x00,0x02,0x01,0x12,0x03,0x08,0x02,
0x10,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x05,
0x12,0x03,0x08,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x01,0x01,0x12,0x03,0x08,0x09,0x0b,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x03,0x12,0x03,
0x08,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,
0x02,0x12,0x03,0x09,0x02,0x10,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x02,0x05,0x12,0x03,0x09,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x01,0x12,
0x03,0x09,0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x02,0x03,0x12,0x03,0x09,0x0e,0x0f,0x0a,0x0b,
0x0a,0x04,0x04,0x00,0x02,0x03,0x12,0x03,0x0a,0x02,
0x10,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x05,
0x12,0x03,0x0a,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x03,0x01,0x12,0x03,0x0a,0x09,0x0b,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x03,0x12,0x03,
0x0a,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,
0x04,0x12,0x03,0x0b,0x02,0x10,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x04,0x05,0x12,0x03,0x0b,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x04,0x01,0x12,
0x03,0x0b,0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x04,0x03,0x12,0x03,0x0b,0x0e,0x0f,0x0a,0x0a,
0x0a,0x02,0x04,0x01,0x12,0x04,0x0e,0x00,0x13,0x01,
0x0a,0x0a,0x0a,0x03,0x04,0x01,0x01,0x12,0x03,0x0e,
0x08,0x2c,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x00,
0x12,0x03,0x0f,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,
0x01,0x02,0x00,0x05,0x12,0x03,0x0f,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x01,0x12,0x03,
0x0f,0x09,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x00,0x03,0x12,0x03,0x0f,0x15,0x16,0x0a,0x0b,0x0a,
0x04,0x04,0x01,0x02,0x01,0x12,0x03,0x10,0x02,0x17,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x01,0x05,0x12,
0x03,0x10,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x01,0x01,0x12,0x03,0x10,0x09,0x12,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x01,0x03,0x12,0x03,0x10,
0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x02,
0x12,0x03,0x11,0x02,0x18,0x0a,0x0c,0x0a,0x05,0x04,
0x01,0x02,0x02,0x05,0x12,0x03,0x11,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x01,0x12,0x03,
0x11,0x09,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x02,0x03,0x12,0x03,0x11,0x16,0x17,0x0a,0x0b,0x0a,
0x04,0x04,0x01,0x02,0x03,0x12,0x03,0x12,0x02,0x18,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x03,0x05,0x12,
0x03,0x12,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x03,0x01,0x12,0x03,0x12,0x09,0x13,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x03,0x03,0x12,0x03,0x12,
0x16,0x17,0x0a,0x0a,0x0a,0x02,0x04,0x02,0x12,0x04,
0x15,0x00,0x1b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02,
0x01,0x12,0x03,0x15,0x08,0x23,0x0a,0x0b,0x0a,0x04,
0x04,0x02,0x02,0x00,0x12,0x03,0x16,0x02,0x10,0x0a,
0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x05,0x12,0x03,
0x16,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x00,0x01,0x12,0x03,0x16,0x09,0x0b,0x0a,0x0c,0x0a,
0x05,0x04,0x02,0x02,0x00,0x03,0x12,0x03,0x16,0x0e,
0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x01,0x12,
0x03,0x17,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x02,
0x02,0x01,0x05,0x12,0x03,0x17,0x02,0x08,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x01,0x01,0x12,0x03,0x17,
0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,
0x03,0x12,0x03,0x17,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,
0x04,0x02,0x02,0x02,0x12,0x03,0x18,0x02,0x10,0x0a,
0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x05,0x12,0x03,
0x18,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x02,0x01,0x12,0x03,0x18,0x09,0x0b,0x0a,0x0c,0x0a,
0x05,0x04,0x02,0x02,0x02,0x03,0x12,0x03,0x18,0x0e,
0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x03,0x12,
0x03,0x19,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x02,
0x02,0x03,0x05,0x12,0x03,0x19,0x02,0x08,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x03,0x01,0x12,0x03,0x19,
0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x03,
0x03,0x12,0x03,0x19,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,
0x04,0x02,0x02,0x04,0x12,0x03,0x1a,0x02,0x10,0x0a,
0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x05,0x12,0x03,
0x1a,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x04,0x01,0x12,0x03,0x1a,0x09,0x0b,0x0a,0x0c,0x0a,
0x05,0x04,0x02,0x02,0x04,0x03,0x12,0x03,0x1a,0x0e,
0x0f,0x0a,0x0a,0x0a,0x02,0x04,0x03,0x12,0x04,0x1d,
0x00,0x22,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x03,0x01,
0x12,0x03,0x1d,0x08,0x26,0x0a,0x0b,0x0a,0x04,0x04,
0x03,0x02,0x00,0x12,0x03,0x1e,0x02,0x10,0x0a,0x0c,
0x0a,0x05,0x04,0x03,0x02,0x00,0x05,0x12,0x03,0x1e,
0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,
0x01,0x12,0x03,0x1e,0x09,0x0b,0x0a,0x0c,0x0a,0x05,
0x04,0x03,0x02,0x00,0x03,0x12,0x03,0x1e,0x0e,0x0f,
0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x01,0x12,0x03,
0x1f,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,
0x01,0x05,0x12,0x03,0x1f,0x02,0x08,0x0a,0x0c,0x0a,
0x05,0x04,0x03,0x02,0x01,0x01,0x12,0x03,0x1f,0x09,
0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x03,
0x12,0x03,0x1f,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,
0x03,0x02,0x02,0x12,0x03,0x20,0x02,0x10,0x0a,0x0c,
0x0a,0x05,0x04,0x03,0x02,0x02,0x05,0x12,0x03,0x20,
0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x02,
0x01,0x12,0x03,0x20,0x09,0x0b,0x0a,0x0c,0x0a,0x05,
0x04,0x03,0x02,0x02,0x03,0x12,0x03,0x20,0x0e,0x0f,
0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x03,0x12,0x03,
0x21,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,
0x03,0x05,0x12,0x03,0x21,0x02,0x08,0x0a,0x0c,0x0a,
0x05,0x04,0x03,0x02,0x03,0x01,0x12,0x03,0x21,0x09,
0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x03,0x03,
0x12,0x03,0x21,0x0e,0x0f,0x0a,0x0a,0x0a,0x02,0x04,
0x04,0x12,0x04,0x24,0x00,0x27,0x01,0x0a,0x0a,0x0a,
0x03,0x04,0x04,0x01,0x12,0x03,0x24,0x08,0x2e,0x0a,
0x0b,0x0a,0x04,0x04,0x04,0x02,0x00,0x12,0x03,0x25,
0x02,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,
0x05,0x12,0x03,0x25,0x02,0x08,0x0a,0x0c,0x0a,0x05,
0x04,0x04,0x02,0x00,0x01,0x12,0x03,0x25,0x09,0x0d,
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x03,0x12,
0x03,0x25,0x10,0x11,0x0a,0x0b,0x0a,0x04,0x04,0x04,
0x02,0x01,0x12,0x03,0x26,0x02,0x13,0x0a,0x0c,0x0a,
0x05,0x04,0x04,0x02,0x01,0x05,0x12,0x03,0x26,0x02,
0x08,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x01,
0x12,0x03,0x26,0x09,0x0e,0x0a,0x0c,0x0a,0x05,0x04,
0x04,0x02,0x01,0x03,0x12,0x03,0x26,0x11,0x12,0x62,
0x06,0x70,0x72,0x6f,0x74,0x6f,0x33,
};
static const char file_name[] = "controller.proto";
static const char wpi_proto_ProtobufArmFeedforward_name[] = "wpi.proto.ProtobufArmFeedforward";
std::string_view wpi_proto_ProtobufArmFeedforward::msg_name(void) noexcept { return wpi_proto_ProtobufArmFeedforward_name; }
pb_filedesc_t wpi_proto_ProtobufArmFeedforward::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufArmFeedforward, wpi_proto_ProtobufArmFeedforward, AUTO)
static const char wpi_proto_ProtobufDifferentialDriveFeedforward_name[] = "wpi.proto.ProtobufDifferentialDriveFeedforward";
std::string_view wpi_proto_ProtobufDifferentialDriveFeedforward::msg_name(void) noexcept { return wpi_proto_ProtobufDifferentialDriveFeedforward_name; }
pb_filedesc_t wpi_proto_ProtobufDifferentialDriveFeedforward::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufDifferentialDriveFeedforward, wpi_proto_ProtobufDifferentialDriveFeedforward, AUTO)
static const char wpi_proto_ProtobufElevatorFeedforward_name[] = "wpi.proto.ProtobufElevatorFeedforward";
std::string_view wpi_proto_ProtobufElevatorFeedforward::msg_name(void) noexcept { return wpi_proto_ProtobufElevatorFeedforward_name; }
pb_filedesc_t wpi_proto_ProtobufElevatorFeedforward::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufElevatorFeedforward, wpi_proto_ProtobufElevatorFeedforward, AUTO)
static const char wpi_proto_ProtobufSimpleMotorFeedforward_name[] = "wpi.proto.ProtobufSimpleMotorFeedforward";
std::string_view wpi_proto_ProtobufSimpleMotorFeedforward::msg_name(void) noexcept { return wpi_proto_ProtobufSimpleMotorFeedforward_name; }
pb_filedesc_t wpi_proto_ProtobufSimpleMotorFeedforward::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufSimpleMotorFeedforward, wpi_proto_ProtobufSimpleMotorFeedforward, AUTO)
static const char wpi_proto_ProtobufDifferentialDriveWheelVoltages_name[] = "wpi.proto.ProtobufDifferentialDriveWheelVoltages";
std::string_view wpi_proto_ProtobufDifferentialDriveWheelVoltages::msg_name(void) noexcept { return wpi_proto_ProtobufDifferentialDriveWheelVoltages_name; }
pb_filedesc_t wpi_proto_ProtobufDifferentialDriveWheelVoltages::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufDifferentialDriveWheelVoltages, wpi_proto_ProtobufDifferentialDriveWheelVoltages, AUTO)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -0,0 +1,158 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_CONTROLLER_NPB_H_INCLUDED
#define PB_WPI_PROTO_CONTROLLER_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufArmFeedforward {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double ks;
double kg;
double kv;
double ka;
double dt;
} wpi_proto_ProtobufArmFeedforward;
typedef struct _wpi_proto_ProtobufDifferentialDriveFeedforward {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double kv_linear;
double ka_linear;
double kv_angular;
double ka_angular;
} wpi_proto_ProtobufDifferentialDriveFeedforward;
typedef struct _wpi_proto_ProtobufElevatorFeedforward {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double ks;
double kg;
double kv;
double ka;
double dt;
} wpi_proto_ProtobufElevatorFeedforward;
typedef struct _wpi_proto_ProtobufSimpleMotorFeedforward {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double ks;
double kv;
double ka;
double dt;
} wpi_proto_ProtobufSimpleMotorFeedforward;
typedef struct _wpi_proto_ProtobufDifferentialDriveWheelVoltages {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double left;
double right;
} wpi_proto_ProtobufDifferentialDriveWheelVoltages;
/* Initializer values for message structs */
#define wpi_proto_ProtobufArmFeedforward_init_default {0, 0, 0, 0, 0}
#define wpi_proto_ProtobufDifferentialDriveFeedforward_init_default {0, 0, 0, 0}
#define wpi_proto_ProtobufElevatorFeedforward_init_default {0, 0, 0, 0, 0}
#define wpi_proto_ProtobufSimpleMotorFeedforward_init_default {0, 0, 0, 0}
#define wpi_proto_ProtobufDifferentialDriveWheelVoltages_init_default {0, 0}
#define wpi_proto_ProtobufArmFeedforward_init_zero {0, 0, 0, 0, 0}
#define wpi_proto_ProtobufDifferentialDriveFeedforward_init_zero {0, 0, 0, 0}
#define wpi_proto_ProtobufElevatorFeedforward_init_zero {0, 0, 0, 0, 0}
#define wpi_proto_ProtobufSimpleMotorFeedforward_init_zero {0, 0, 0, 0}
#define wpi_proto_ProtobufDifferentialDriveWheelVoltages_init_zero {0, 0}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufArmFeedforward_ks_tag 1
#define wpi_proto_ProtobufArmFeedforward_kg_tag 2
#define wpi_proto_ProtobufArmFeedforward_kv_tag 3
#define wpi_proto_ProtobufArmFeedforward_ka_tag 4
#define wpi_proto_ProtobufArmFeedforward_dt_tag 5
#define wpi_proto_ProtobufDifferentialDriveFeedforward_kv_linear_tag 1
#define wpi_proto_ProtobufDifferentialDriveFeedforward_ka_linear_tag 2
#define wpi_proto_ProtobufDifferentialDriveFeedforward_kv_angular_tag 3
#define wpi_proto_ProtobufDifferentialDriveFeedforward_ka_angular_tag 4
#define wpi_proto_ProtobufElevatorFeedforward_ks_tag 1
#define wpi_proto_ProtobufElevatorFeedforward_kg_tag 2
#define wpi_proto_ProtobufElevatorFeedforward_kv_tag 3
#define wpi_proto_ProtobufElevatorFeedforward_ka_tag 4
#define wpi_proto_ProtobufElevatorFeedforward_dt_tag 5
#define wpi_proto_ProtobufSimpleMotorFeedforward_ks_tag 1
#define wpi_proto_ProtobufSimpleMotorFeedforward_kv_tag 2
#define wpi_proto_ProtobufSimpleMotorFeedforward_ka_tag 3
#define wpi_proto_ProtobufSimpleMotorFeedforward_dt_tag 4
#define wpi_proto_ProtobufDifferentialDriveWheelVoltages_left_tag 1
#define wpi_proto_ProtobufDifferentialDriveWheelVoltages_right_tag 2
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufArmFeedforward_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, ks, 1) \
X(a, STATIC, SINGULAR, DOUBLE, kg, 2) \
X(a, STATIC, SINGULAR, DOUBLE, kv, 3) \
X(a, STATIC, SINGULAR, DOUBLE, ka, 4) \
X(a, STATIC, SINGULAR, DOUBLE, dt, 5)
#define wpi_proto_ProtobufArmFeedforward_CALLBACK NULL
#define wpi_proto_ProtobufArmFeedforward_DEFAULT NULL
#define wpi_proto_ProtobufDifferentialDriveFeedforward_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, kv_linear, 1) \
X(a, STATIC, SINGULAR, DOUBLE, ka_linear, 2) \
X(a, STATIC, SINGULAR, DOUBLE, kv_angular, 3) \
X(a, STATIC, SINGULAR, DOUBLE, ka_angular, 4)
#define wpi_proto_ProtobufDifferentialDriveFeedforward_CALLBACK NULL
#define wpi_proto_ProtobufDifferentialDriveFeedforward_DEFAULT NULL
#define wpi_proto_ProtobufElevatorFeedforward_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, ks, 1) \
X(a, STATIC, SINGULAR, DOUBLE, kg, 2) \
X(a, STATIC, SINGULAR, DOUBLE, kv, 3) \
X(a, STATIC, SINGULAR, DOUBLE, ka, 4) \
X(a, STATIC, SINGULAR, DOUBLE, dt, 5)
#define wpi_proto_ProtobufElevatorFeedforward_CALLBACK NULL
#define wpi_proto_ProtobufElevatorFeedforward_DEFAULT NULL
#define wpi_proto_ProtobufSimpleMotorFeedforward_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, ks, 1) \
X(a, STATIC, SINGULAR, DOUBLE, kv, 2) \
X(a, STATIC, SINGULAR, DOUBLE, ka, 3) \
X(a, STATIC, SINGULAR, DOUBLE, dt, 4)
#define wpi_proto_ProtobufSimpleMotorFeedforward_CALLBACK NULL
#define wpi_proto_ProtobufSimpleMotorFeedforward_DEFAULT NULL
#define wpi_proto_ProtobufDifferentialDriveWheelVoltages_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, left, 1) \
X(a, STATIC, SINGULAR, DOUBLE, right, 2)
#define wpi_proto_ProtobufDifferentialDriveWheelVoltages_CALLBACK NULL
#define wpi_proto_ProtobufDifferentialDriveWheelVoltages_DEFAULT NULL
/* Maximum encoded size of messages (where known) */
#define WPI_PROTO_CONTROLLER_NPB_H_MAX_SIZE wpi_proto_ProtobufArmFeedforward_size
#define wpi_proto_ProtobufArmFeedforward_size 45
#define wpi_proto_ProtobufDifferentialDriveFeedforward_size 36
#define wpi_proto_ProtobufDifferentialDriveWheelVoltages_size 18
#define wpi_proto_ProtobufElevatorFeedforward_size 45
#define wpi_proto_ProtobufSimpleMotorFeedforward_size 36
#endif

View File

@@ -0,0 +1,256 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "geometry2d.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x10,0x67,0x65,0x6f,0x6d,0x65,0x74,0x72,0x79,
0x32,0x64,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,
0x33,0x0a,0x15,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,
0x66,0x54,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x69,
0x6f,0x6e,0x32,0x64,0x12,0x0c,0x0a,0x01,0x78,0x18,
0x01,0x20,0x01,0x28,0x01,0x52,0x01,0x78,0x12,0x0c,
0x0a,0x01,0x79,0x18,0x02,0x20,0x01,0x28,0x01,0x52,
0x01,0x79,0x22,0x2a,0x0a,0x12,0x50,0x72,0x6f,0x74,
0x6f,0x62,0x75,0x66,0x52,0x6f,0x74,0x61,0x74,0x69,
0x6f,0x6e,0x32,0x64,0x12,0x14,0x0a,0x05,0x76,0x61,
0x6c,0x75,0x65,0x18,0x01,0x20,0x01,0x28,0x01,0x52,
0x05,0x76,0x61,0x6c,0x75,0x65,0x22,0x8f,0x01,0x0a,
0x0e,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x50,
0x6f,0x73,0x65,0x32,0x64,0x12,0x42,0x0a,0x0b,0x74,
0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,
0x18,0x01,0x20,0x01,0x28,0x0b,0x32,0x20,0x2e,0x77,
0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x54,0x72,0x61,
0x6e,0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,
0x52,0x0b,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,
0x69,0x6f,0x6e,0x12,0x39,0x0a,0x08,0x72,0x6f,0x74,
0x61,0x74,0x69,0x6f,0x6e,0x18,0x02,0x20,0x01,0x28,
0x0b,0x32,0x1d,0x2e,0x77,0x70,0x69,0x2e,0x70,0x72,
0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,0x62,
0x75,0x66,0x52,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,
0x32,0x64,0x52,0x08,0x72,0x6f,0x74,0x61,0x74,0x69,
0x6f,0x6e,0x22,0x94,0x01,0x0a,0x13,0x50,0x72,0x6f,
0x74,0x6f,0x62,0x75,0x66,0x54,0x72,0x61,0x6e,0x73,
0x66,0x6f,0x72,0x6d,0x32,0x64,0x12,0x42,0x0a,0x0b,
0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x69,0x6f,
0x6e,0x18,0x01,0x20,0x01,0x28,0x0b,0x32,0x20,0x2e,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x54,0x72,
0x61,0x6e,0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x32,
0x64,0x52,0x0b,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,
0x74,0x69,0x6f,0x6e,0x12,0x39,0x0a,0x08,0x72,0x6f,
0x74,0x61,0x74,0x69,0x6f,0x6e,0x18,0x02,0x20,0x01,
0x28,0x0b,0x32,0x1d,0x2e,0x77,0x70,0x69,0x2e,0x70,
0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,
0x62,0x75,0x66,0x52,0x6f,0x74,0x61,0x74,0x69,0x6f,
0x6e,0x32,0x64,0x52,0x08,0x72,0x6f,0x74,0x61,0x74,
0x69,0x6f,0x6e,0x22,0x49,0x0a,0x0f,0x50,0x72,0x6f,
0x74,0x6f,0x62,0x75,0x66,0x54,0x77,0x69,0x73,0x74,
0x32,0x64,0x12,0x0e,0x0a,0x02,0x64,0x78,0x18,0x01,
0x20,0x01,0x28,0x01,0x52,0x02,0x64,0x78,0x12,0x0e,
0x0a,0x02,0x64,0x79,0x18,0x02,0x20,0x01,0x28,0x01,
0x52,0x02,0x64,0x79,0x12,0x16,0x0a,0x06,0x64,0x74,
0x68,0x65,0x74,0x61,0x18,0x03,0x20,0x01,0x28,0x01,
0x52,0x06,0x64,0x74,0x68,0x65,0x74,0x61,0x22,0x78,
0x0a,0x13,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,
0x52,0x65,0x63,0x74,0x61,0x6e,0x67,0x6c,0x65,0x32,
0x64,0x12,0x31,0x0a,0x06,0x63,0x65,0x6e,0x74,0x65,
0x72,0x18,0x01,0x20,0x01,0x28,0x0b,0x32,0x19,0x2e,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x50,0x6f,
0x73,0x65,0x32,0x64,0x52,0x06,0x63,0x65,0x6e,0x74,
0x65,0x72,0x12,0x16,0x0a,0x06,0x78,0x57,0x69,0x64,
0x74,0x68,0x18,0x02,0x20,0x01,0x28,0x01,0x52,0x06,
0x78,0x57,0x69,0x64,0x74,0x68,0x12,0x16,0x0a,0x06,
0x79,0x57,0x69,0x64,0x74,0x68,0x18,0x03,0x20,0x01,
0x28,0x01,0x52,0x06,0x79,0x57,0x69,0x64,0x74,0x68,
0x22,0x82,0x01,0x0a,0x11,0x50,0x72,0x6f,0x74,0x6f,
0x62,0x75,0x66,0x45,0x6c,0x6c,0x69,0x70,0x73,0x65,
0x32,0x64,0x12,0x31,0x0a,0x06,0x63,0x65,0x6e,0x74,
0x65,0x72,0x18,0x01,0x20,0x01,0x28,0x0b,0x32,0x19,
0x2e,0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,
0x2e,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x50,
0x6f,0x73,0x65,0x32,0x64,0x52,0x06,0x63,0x65,0x6e,
0x74,0x65,0x72,0x12,0x1c,0x0a,0x09,0x78,0x53,0x65,
0x6d,0x69,0x41,0x78,0x69,0x73,0x18,0x02,0x20,0x01,
0x28,0x01,0x52,0x09,0x78,0x53,0x65,0x6d,0x69,0x41,
0x78,0x69,0x73,0x12,0x1c,0x0a,0x09,0x79,0x53,0x65,
0x6d,0x69,0x41,0x78,0x69,0x73,0x18,0x03,0x20,0x01,
0x28,0x01,0x52,0x09,0x79,0x53,0x65,0x6d,0x69,0x41,
0x78,0x69,0x73,0x42,0x1a,0x0a,0x18,0x65,0x64,0x75,
0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,0x72,0x73,0x74,
0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,0x72,0x6f,0x74,
0x6f,0x4a,0xc9,0x08,0x0a,0x06,0x12,0x04,0x00,0x00,
0x29,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,0x03,0x00,
0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,0x03,0x02,
0x00,0x12,0x0a,0x08,0x0a,0x01,0x08,0x12,0x03,0x04,
0x00,0x31,0x0a,0x09,0x0a,0x02,0x08,0x01,0x12,0x03,
0x04,0x00,0x31,0x0a,0x0a,0x0a,0x02,0x04,0x00,0x12,
0x04,0x06,0x00,0x09,0x01,0x0a,0x0a,0x0a,0x03,0x04,
0x00,0x01,0x12,0x03,0x06,0x08,0x1d,0x0a,0x0b,0x0a,
0x04,0x04,0x00,0x02,0x00,0x12,0x03,0x07,0x02,0x0f,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x05,0x12,
0x03,0x07,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x00,0x01,0x12,0x03,0x07,0x09,0x0a,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x00,0x03,0x12,0x03,0x07,
0x0d,0x0e,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x01,
0x12,0x03,0x08,0x02,0x0f,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x01,0x05,0x12,0x03,0x08,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x01,0x12,0x03,
0x08,0x09,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x01,0x03,0x12,0x03,0x08,0x0d,0x0e,0x0a,0x0a,0x0a,
0x02,0x04,0x01,0x12,0x04,0x0b,0x00,0x0d,0x01,0x0a,
0x0a,0x0a,0x03,0x04,0x01,0x01,0x12,0x03,0x0b,0x08,
0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x00,0x12,
0x03,0x0c,0x02,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x00,0x05,0x12,0x03,0x0c,0x02,0x08,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x00,0x01,0x12,0x03,0x0c,
0x09,0x0e,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,
0x03,0x12,0x03,0x0c,0x11,0x12,0x0a,0x0a,0x0a,0x02,
0x04,0x02,0x12,0x04,0x0f,0x00,0x12,0x01,0x0a,0x0a,
0x0a,0x03,0x04,0x02,0x01,0x12,0x03,0x0f,0x08,0x16,
0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x00,0x12,0x03,
0x10,0x02,0x28,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x00,0x06,0x12,0x03,0x10,0x02,0x17,0x0a,0x0c,0x0a,
0x05,0x04,0x02,0x02,0x00,0x01,0x12,0x03,0x10,0x18,
0x23,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x03,
0x12,0x03,0x10,0x26,0x27,0x0a,0x0b,0x0a,0x04,0x04,
0x02,0x02,0x01,0x12,0x03,0x11,0x02,0x22,0x0a,0x0c,
0x0a,0x05,0x04,0x02,0x02,0x01,0x06,0x12,0x03,0x11,
0x02,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,
0x01,0x12,0x03,0x11,0x15,0x1d,0x0a,0x0c,0x0a,0x05,
0x04,0x02,0x02,0x01,0x03,0x12,0x03,0x11,0x20,0x21,
0x0a,0x0a,0x0a,0x02,0x04,0x03,0x12,0x04,0x14,0x00,
0x17,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x03,0x01,0x12,
0x03,0x14,0x08,0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x03,
0x02,0x00,0x12,0x03,0x15,0x02,0x28,0x0a,0x0c,0x0a,
0x05,0x04,0x03,0x02,0x00,0x06,0x12,0x03,0x15,0x02,
0x17,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01,
0x12,0x03,0x15,0x18,0x23,0x0a,0x0c,0x0a,0x05,0x04,
0x03,0x02,0x00,0x03,0x12,0x03,0x15,0x26,0x27,0x0a,
0x0b,0x0a,0x04,0x04,0x03,0x02,0x01,0x12,0x03,0x16,
0x02,0x22,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,
0x06,0x12,0x03,0x16,0x02,0x14,0x0a,0x0c,0x0a,0x05,
0x04,0x03,0x02,0x01,0x01,0x12,0x03,0x16,0x15,0x1d,
0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x03,0x12,
0x03,0x16,0x20,0x21,0x0a,0x0a,0x0a,0x02,0x04,0x04,
0x12,0x04,0x19,0x00,0x1d,0x01,0x0a,0x0a,0x0a,0x03,
0x04,0x04,0x01,0x12,0x03,0x19,0x08,0x17,0x0a,0x0b,
0x0a,0x04,0x04,0x04,0x02,0x00,0x12,0x03,0x1a,0x02,
0x10,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x05,
0x12,0x03,0x1a,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,
0x04,0x02,0x00,0x01,0x12,0x03,0x1a,0x09,0x0b,0x0a,
0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x03,0x12,0x03,
0x1a,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,
0x01,0x12,0x03,0x1b,0x02,0x10,0x0a,0x0c,0x0a,0x05,
0x04,0x04,0x02,0x01,0x05,0x12,0x03,0x1b,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x01,0x12,
0x03,0x1b,0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x04,
0x02,0x01,0x03,0x12,0x03,0x1b,0x0e,0x0f,0x0a,0x0b,
0x0a,0x04,0x04,0x04,0x02,0x02,0x12,0x03,0x1c,0x02,
0x14,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x05,
0x12,0x03,0x1c,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,
0x04,0x02,0x02,0x01,0x12,0x03,0x1c,0x09,0x0f,0x0a,
0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x03,0x12,0x03,
0x1c,0x12,0x13,0x0a,0x0a,0x0a,0x02,0x04,0x05,0x12,
0x04,0x1f,0x00,0x23,0x01,0x0a,0x0a,0x0a,0x03,0x04,
0x05,0x01,0x12,0x03,0x1f,0x08,0x1b,0x0a,0x0b,0x0a,
0x04,0x04,0x05,0x02,0x00,0x12,0x03,0x20,0x02,0x1c,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x06,0x12,
0x03,0x20,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x00,0x01,0x12,0x03,0x20,0x11,0x17,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x00,0x03,0x12,0x03,0x20,
0x1a,0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x01,
0x12,0x03,0x21,0x02,0x14,0x0a,0x0c,0x0a,0x05,0x04,
0x05,0x02,0x01,0x05,0x12,0x03,0x21,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,0x01,0x12,0x03,
0x21,0x09,0x0f,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
0x01,0x03,0x12,0x03,0x21,0x12,0x13,0x0a,0x0b,0x0a,
0x04,0x04,0x05,0x02,0x02,0x12,0x03,0x22,0x02,0x14,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x05,0x12,
0x03,0x22,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x02,0x01,0x12,0x03,0x22,0x09,0x0f,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x02,0x03,0x12,0x03,0x22,
0x12,0x13,0x0a,0x0a,0x0a,0x02,0x04,0x06,0x12,0x04,
0x25,0x00,0x29,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x06,
0x01,0x12,0x03,0x25,0x08,0x19,0x0a,0x0b,0x0a,0x04,
0x04,0x06,0x02,0x00,0x12,0x03,0x26,0x02,0x1c,0x0a,
0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,0x06,0x12,0x03,
0x26,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,
0x00,0x01,0x12,0x03,0x26,0x11,0x17,0x0a,0x0c,0x0a,
0x05,0x04,0x06,0x02,0x00,0x03,0x12,0x03,0x26,0x1a,
0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x06,0x02,0x01,0x12,
0x03,0x27,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x06,
0x02,0x01,0x05,0x12,0x03,0x27,0x02,0x08,0x0a,0x0c,
0x0a,0x05,0x04,0x06,0x02,0x01,0x01,0x12,0x03,0x27,
0x09,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,
0x03,0x12,0x03,0x27,0x15,0x16,0x0a,0x0b,0x0a,0x04,
0x04,0x06,0x02,0x02,0x12,0x03,0x28,0x02,0x17,0x0a,
0x0c,0x0a,0x05,0x04,0x06,0x02,0x02,0x05,0x12,0x03,
0x28,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,
0x02,0x01,0x12,0x03,0x28,0x09,0x12,0x0a,0x0c,0x0a,
0x05,0x04,0x06,0x02,0x02,0x03,0x12,0x03,0x28,0x15,
0x16,0x62,0x06,0x70,0x72,0x6f,0x74,0x6f,0x33,
};
static const char file_name[] = "geometry2d.proto";
static const char wpi_proto_ProtobufTranslation2d_name[] = "wpi.proto.ProtobufTranslation2d";
std::string_view wpi_proto_ProtobufTranslation2d::msg_name(void) noexcept { return wpi_proto_ProtobufTranslation2d_name; }
pb_filedesc_t wpi_proto_ProtobufTranslation2d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufTranslation2d, wpi_proto_ProtobufTranslation2d, AUTO)
static const char wpi_proto_ProtobufRotation2d_name[] = "wpi.proto.ProtobufRotation2d";
std::string_view wpi_proto_ProtobufRotation2d::msg_name(void) noexcept { return wpi_proto_ProtobufRotation2d_name; }
pb_filedesc_t wpi_proto_ProtobufRotation2d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufRotation2d, wpi_proto_ProtobufRotation2d, AUTO)
static const char wpi_proto_ProtobufPose2d_name[] = "wpi.proto.ProtobufPose2d";
std::string_view wpi_proto_ProtobufPose2d::msg_name(void) noexcept { return wpi_proto_ProtobufPose2d_name; }
pb_filedesc_t wpi_proto_ProtobufPose2d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufPose2d, wpi_proto_ProtobufPose2d, AUTO)
static const char wpi_proto_ProtobufTransform2d_name[] = "wpi.proto.ProtobufTransform2d";
std::string_view wpi_proto_ProtobufTransform2d::msg_name(void) noexcept { return wpi_proto_ProtobufTransform2d_name; }
pb_filedesc_t wpi_proto_ProtobufTransform2d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufTransform2d, wpi_proto_ProtobufTransform2d, AUTO)
static const char wpi_proto_ProtobufTwist2d_name[] = "wpi.proto.ProtobufTwist2d";
std::string_view wpi_proto_ProtobufTwist2d::msg_name(void) noexcept { return wpi_proto_ProtobufTwist2d_name; }
pb_filedesc_t wpi_proto_ProtobufTwist2d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufTwist2d, wpi_proto_ProtobufTwist2d, AUTO)
static const char wpi_proto_ProtobufRectangle2d_name[] = "wpi.proto.ProtobufRectangle2d";
std::string_view wpi_proto_ProtobufRectangle2d::msg_name(void) noexcept { return wpi_proto_ProtobufRectangle2d_name; }
pb_filedesc_t wpi_proto_ProtobufRectangle2d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufRectangle2d, wpi_proto_ProtobufRectangle2d, AUTO)
static const char wpi_proto_ProtobufEllipse2d_name[] = "wpi.proto.ProtobufEllipse2d";
std::string_view wpi_proto_ProtobufEllipse2d::msg_name(void) noexcept { return wpi_proto_ProtobufEllipse2d_name; }
pb_filedesc_t wpi_proto_ProtobufEllipse2d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufEllipse2d, wpi_proto_ProtobufEllipse2d, AUTO)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -0,0 +1,180 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_GEOMETRY2D_NPB_H_INCLUDED
#define PB_WPI_PROTO_GEOMETRY2D_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufTranslation2d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double x;
double y;
} wpi_proto_ProtobufTranslation2d;
typedef struct _wpi_proto_ProtobufRotation2d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double value;
} wpi_proto_ProtobufRotation2d;
typedef struct _wpi_proto_ProtobufPose2d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t translation;
pb_callback_t rotation;
} wpi_proto_ProtobufPose2d;
typedef struct _wpi_proto_ProtobufTransform2d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t translation;
pb_callback_t rotation;
} wpi_proto_ProtobufTransform2d;
typedef struct _wpi_proto_ProtobufTwist2d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double dx;
double dy;
double dtheta;
} wpi_proto_ProtobufTwist2d;
typedef struct _wpi_proto_ProtobufRectangle2d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t center;
double xWidth;
double yWidth;
} wpi_proto_ProtobufRectangle2d;
typedef struct _wpi_proto_ProtobufEllipse2d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t center;
double xSemiAxis;
double ySemiAxis;
} wpi_proto_ProtobufEllipse2d;
/* Initializer values for message structs */
#define wpi_proto_ProtobufTranslation2d_init_default {0, 0}
#define wpi_proto_ProtobufRotation2d_init_default {0}
#define wpi_proto_ProtobufPose2d_init_default {{{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufTransform2d_init_default {{{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufTwist2d_init_default {0, 0, 0}
#define wpi_proto_ProtobufRectangle2d_init_default {{{NULL}, NULL}, 0, 0}
#define wpi_proto_ProtobufEllipse2d_init_default {{{NULL}, NULL}, 0, 0}
#define wpi_proto_ProtobufTranslation2d_init_zero {0, 0}
#define wpi_proto_ProtobufRotation2d_init_zero {0}
#define wpi_proto_ProtobufPose2d_init_zero {{{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufTransform2d_init_zero {{{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufTwist2d_init_zero {0, 0, 0}
#define wpi_proto_ProtobufRectangle2d_init_zero {{{NULL}, NULL}, 0, 0}
#define wpi_proto_ProtobufEllipse2d_init_zero {{{NULL}, NULL}, 0, 0}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufTranslation2d_x_tag 1
#define wpi_proto_ProtobufTranslation2d_y_tag 2
#define wpi_proto_ProtobufRotation2d_value_tag 1
#define wpi_proto_ProtobufPose2d_translation_tag 1
#define wpi_proto_ProtobufPose2d_rotation_tag 2
#define wpi_proto_ProtobufTransform2d_translation_tag 1
#define wpi_proto_ProtobufTransform2d_rotation_tag 2
#define wpi_proto_ProtobufTwist2d_dx_tag 1
#define wpi_proto_ProtobufTwist2d_dy_tag 2
#define wpi_proto_ProtobufTwist2d_dtheta_tag 3
#define wpi_proto_ProtobufRectangle2d_center_tag 1
#define wpi_proto_ProtobufRectangle2d_xWidth_tag 2
#define wpi_proto_ProtobufRectangle2d_yWidth_tag 3
#define wpi_proto_ProtobufEllipse2d_center_tag 1
#define wpi_proto_ProtobufEllipse2d_xSemiAxis_tag 2
#define wpi_proto_ProtobufEllipse2d_ySemiAxis_tag 3
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufTranslation2d_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, x, 1) \
X(a, STATIC, SINGULAR, DOUBLE, y, 2)
#define wpi_proto_ProtobufTranslation2d_CALLBACK NULL
#define wpi_proto_ProtobufTranslation2d_DEFAULT NULL
#define wpi_proto_ProtobufRotation2d_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, value, 1)
#define wpi_proto_ProtobufRotation2d_CALLBACK NULL
#define wpi_proto_ProtobufRotation2d_DEFAULT NULL
#define wpi_proto_ProtobufPose2d_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, MESSAGE, translation, 1) \
X(a, CALLBACK, OPTIONAL, MESSAGE, rotation, 2)
#define wpi_proto_ProtobufPose2d_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufPose2d_DEFAULT NULL
#define wpi_proto_ProtobufPose2d_translation_MSGTYPE wpi_proto_ProtobufTranslation2d
#define wpi_proto_ProtobufPose2d_rotation_MSGTYPE wpi_proto_ProtobufRotation2d
#define wpi_proto_ProtobufTransform2d_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, MESSAGE, translation, 1) \
X(a, CALLBACK, OPTIONAL, MESSAGE, rotation, 2)
#define wpi_proto_ProtobufTransform2d_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufTransform2d_DEFAULT NULL
#define wpi_proto_ProtobufTransform2d_translation_MSGTYPE wpi_proto_ProtobufTranslation2d
#define wpi_proto_ProtobufTransform2d_rotation_MSGTYPE wpi_proto_ProtobufRotation2d
#define wpi_proto_ProtobufTwist2d_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, dx, 1) \
X(a, STATIC, SINGULAR, DOUBLE, dy, 2) \
X(a, STATIC, SINGULAR, DOUBLE, dtheta, 3)
#define wpi_proto_ProtobufTwist2d_CALLBACK NULL
#define wpi_proto_ProtobufTwist2d_DEFAULT NULL
#define wpi_proto_ProtobufRectangle2d_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, MESSAGE, center, 1) \
X(a, STATIC, SINGULAR, DOUBLE, xWidth, 2) \
X(a, STATIC, SINGULAR, DOUBLE, yWidth, 3)
#define wpi_proto_ProtobufRectangle2d_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufRectangle2d_DEFAULT NULL
#define wpi_proto_ProtobufRectangle2d_center_MSGTYPE wpi_proto_ProtobufPose2d
#define wpi_proto_ProtobufEllipse2d_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, MESSAGE, center, 1) \
X(a, STATIC, SINGULAR, DOUBLE, xSemiAxis, 2) \
X(a, STATIC, SINGULAR, DOUBLE, ySemiAxis, 3)
#define wpi_proto_ProtobufEllipse2d_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufEllipse2d_DEFAULT NULL
#define wpi_proto_ProtobufEllipse2d_center_MSGTYPE wpi_proto_ProtobufPose2d
/* Maximum encoded size of messages (where known) */
/* wpi_proto_ProtobufPose2d_size depends on runtime parameters */
/* wpi_proto_ProtobufTransform2d_size depends on runtime parameters */
/* wpi_proto_ProtobufRectangle2d_size depends on runtime parameters */
/* wpi_proto_ProtobufEllipse2d_size depends on runtime parameters */
#define WPI_PROTO_GEOMETRY2D_NPB_H_MAX_SIZE wpi_proto_ProtobufTwist2d_size
#define wpi_proto_ProtobufRotation2d_size 9
#define wpi_proto_ProtobufTranslation2d_size 18
#define wpi_proto_ProtobufTwist2d_size 27
#endif

View File

@@ -0,0 +1,249 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "geometry3d.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x10,0x67,0x65,0x6f,0x6d,0x65,0x74,0x72,0x79,
0x33,0x64,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,
0x41,0x0a,0x15,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,
0x66,0x54,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x69,
0x6f,0x6e,0x33,0x64,0x12,0x0c,0x0a,0x01,0x78,0x18,
0x01,0x20,0x01,0x28,0x01,0x52,0x01,0x78,0x12,0x0c,
0x0a,0x01,0x79,0x18,0x02,0x20,0x01,0x28,0x01,0x52,
0x01,0x79,0x12,0x0c,0x0a,0x01,0x7a,0x18,0x03,0x20,
0x01,0x28,0x01,0x52,0x01,0x7a,0x22,0x4c,0x0a,0x12,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x51,0x75,
0x61,0x74,0x65,0x72,0x6e,0x69,0x6f,0x6e,0x12,0x0c,
0x0a,0x01,0x77,0x18,0x01,0x20,0x01,0x28,0x01,0x52,
0x01,0x77,0x12,0x0c,0x0a,0x01,0x78,0x18,0x02,0x20,
0x01,0x28,0x01,0x52,0x01,0x78,0x12,0x0c,0x0a,0x01,
0x79,0x18,0x03,0x20,0x01,0x28,0x01,0x52,0x01,0x79,
0x12,0x0c,0x0a,0x01,0x7a,0x18,0x04,0x20,0x01,0x28,
0x01,0x52,0x01,0x7a,0x22,0x41,0x0a,0x12,0x50,0x72,
0x6f,0x74,0x6f,0x62,0x75,0x66,0x52,0x6f,0x74,0x61,
0x74,0x69,0x6f,0x6e,0x33,0x64,0x12,0x2b,0x0a,0x01,
0x71,0x18,0x01,0x20,0x01,0x28,0x0b,0x32,0x1d,0x2e,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x51,0x75,
0x61,0x74,0x65,0x72,0x6e,0x69,0x6f,0x6e,0x52,0x01,
0x71,0x22,0x8f,0x01,0x0a,0x0e,0x50,0x72,0x6f,0x74,
0x6f,0x62,0x75,0x66,0x50,0x6f,0x73,0x65,0x33,0x64,
0x12,0x42,0x0a,0x0b,0x74,0x72,0x61,0x6e,0x73,0x6c,
0x61,0x74,0x69,0x6f,0x6e,0x18,0x01,0x20,0x01,0x28,
0x0b,0x32,0x20,0x2e,0x77,0x70,0x69,0x2e,0x70,0x72,
0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,0x62,
0x75,0x66,0x54,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,
0x69,0x6f,0x6e,0x33,0x64,0x52,0x0b,0x74,0x72,0x61,
0x6e,0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x12,0x39,
0x0a,0x08,0x72,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,
0x18,0x02,0x20,0x01,0x28,0x0b,0x32,0x1d,0x2e,0x77,
0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x52,0x6f,0x74,
0x61,0x74,0x69,0x6f,0x6e,0x33,0x64,0x52,0x08,0x72,
0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x22,0x94,0x01,
0x0a,0x13,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,
0x54,0x72,0x61,0x6e,0x73,0x66,0x6f,0x72,0x6d,0x33,
0x64,0x12,0x42,0x0a,0x0b,0x74,0x72,0x61,0x6e,0x73,
0x6c,0x61,0x74,0x69,0x6f,0x6e,0x18,0x01,0x20,0x01,
0x28,0x0b,0x32,0x20,0x2e,0x77,0x70,0x69,0x2e,0x70,
0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,
0x62,0x75,0x66,0x54,0x72,0x61,0x6e,0x73,0x6c,0x61,
0x74,0x69,0x6f,0x6e,0x33,0x64,0x52,0x0b,0x74,0x72,
0x61,0x6e,0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x12,
0x39,0x0a,0x08,0x72,0x6f,0x74,0x61,0x74,0x69,0x6f,
0x6e,0x18,0x02,0x20,0x01,0x28,0x0b,0x32,0x1d,0x2e,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x52,0x6f,
0x74,0x61,0x74,0x69,0x6f,0x6e,0x33,0x64,0x52,0x08,
0x72,0x6f,0x74,0x61,0x74,0x69,0x6f,0x6e,0x22,0x71,
0x0a,0x0f,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,
0x54,0x77,0x69,0x73,0x74,0x33,0x64,0x12,0x0e,0x0a,
0x02,0x64,0x78,0x18,0x01,0x20,0x01,0x28,0x01,0x52,
0x02,0x64,0x78,0x12,0x0e,0x0a,0x02,0x64,0x79,0x18,
0x02,0x20,0x01,0x28,0x01,0x52,0x02,0x64,0x79,0x12,
0x0e,0x0a,0x02,0x64,0x7a,0x18,0x03,0x20,0x01,0x28,
0x01,0x52,0x02,0x64,0x7a,0x12,0x0e,0x0a,0x02,0x72,
0x78,0x18,0x04,0x20,0x01,0x28,0x01,0x52,0x02,0x72,
0x78,0x12,0x0e,0x0a,0x02,0x72,0x79,0x18,0x05,0x20,
0x01,0x28,0x01,0x52,0x02,0x72,0x79,0x12,0x0e,0x0a,
0x02,0x72,0x7a,0x18,0x06,0x20,0x01,0x28,0x01,0x52,
0x02,0x72,0x7a,0x42,0x1a,0x0a,0x18,0x65,0x64,0x75,
0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,0x72,0x73,0x74,
0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,0x72,0x6f,0x74,
0x6f,0x4a,0x9f,0x09,0x0a,0x06,0x12,0x04,0x00,0x00,
0x28,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,0x03,0x00,
0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,0x03,0x02,
0x00,0x12,0x0a,0x08,0x0a,0x01,0x08,0x12,0x03,0x04,
0x00,0x31,0x0a,0x09,0x0a,0x02,0x08,0x01,0x12,0x03,
0x04,0x00,0x31,0x0a,0x0a,0x0a,0x02,0x04,0x00,0x12,
0x04,0x06,0x00,0x0a,0x01,0x0a,0x0a,0x0a,0x03,0x04,
0x00,0x01,0x12,0x03,0x06,0x08,0x1d,0x0a,0x0b,0x0a,
0x04,0x04,0x00,0x02,0x00,0x12,0x03,0x07,0x02,0x0f,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x05,0x12,
0x03,0x07,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x00,0x01,0x12,0x03,0x07,0x09,0x0a,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x00,0x03,0x12,0x03,0x07,
0x0d,0x0e,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x01,
0x12,0x03,0x08,0x02,0x0f,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x01,0x05,0x12,0x03,0x08,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x01,0x12,0x03,
0x08,0x09,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x01,0x03,0x12,0x03,0x08,0x0d,0x0e,0x0a,0x0b,0x0a,
0x04,0x04,0x00,0x02,0x02,0x12,0x03,0x09,0x02,0x0f,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x05,0x12,
0x03,0x09,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x02,0x01,0x12,0x03,0x09,0x09,0x0a,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x02,0x03,0x12,0x03,0x09,
0x0d,0x0e,0x0a,0x0a,0x0a,0x02,0x04,0x01,0x12,0x04,
0x0c,0x00,0x11,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x01,
0x01,0x12,0x03,0x0c,0x08,0x1a,0x0a,0x0b,0x0a,0x04,
0x04,0x01,0x02,0x00,0x12,0x03,0x0d,0x02,0x0f,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x05,0x12,0x03,
0x0d,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x00,0x01,0x12,0x03,0x0d,0x09,0x0a,0x0a,0x0c,0x0a,
0x05,0x04,0x01,0x02,0x00,0x03,0x12,0x03,0x0d,0x0d,
0x0e,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x01,0x12,
0x03,0x0e,0x02,0x0f,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x01,0x05,0x12,0x03,0x0e,0x02,0x08,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x01,0x01,0x12,0x03,0x0e,
0x09,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x01,
0x03,0x12,0x03,0x0e,0x0d,0x0e,0x0a,0x0b,0x0a,0x04,
0x04,0x01,0x02,0x02,0x12,0x03,0x0f,0x02,0x0f,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x05,0x12,0x03,
0x0f,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x02,0x01,0x12,0x03,0x0f,0x09,0x0a,0x0a,0x0c,0x0a,
0x05,0x04,0x01,0x02,0x02,0x03,0x12,0x03,0x0f,0x0d,
0x0e,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x03,0x12,
0x03,0x10,0x02,0x0f,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x03,0x05,0x12,0x03,0x10,0x02,0x08,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x03,0x01,0x12,0x03,0x10,
0x09,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x03,
0x03,0x12,0x03,0x10,0x0d,0x0e,0x0a,0x0a,0x0a,0x02,
0x04,0x02,0x12,0x04,0x13,0x00,0x15,0x01,0x0a,0x0a,
0x0a,0x03,0x04,0x02,0x01,0x12,0x03,0x13,0x08,0x1a,
0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,0x00,0x12,0x03,
0x14,0x02,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,
0x00,0x06,0x12,0x03,0x14,0x02,0x14,0x0a,0x0c,0x0a,
0x05,0x04,0x02,0x02,0x00,0x01,0x12,0x03,0x14,0x15,
0x16,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x03,
0x12,0x03,0x14,0x19,0x1a,0x0a,0x0a,0x0a,0x02,0x04,
0x03,0x12,0x04,0x17,0x00,0x1a,0x01,0x0a,0x0a,0x0a,
0x03,0x04,0x03,0x01,0x12,0x03,0x17,0x08,0x16,0x0a,
0x0b,0x0a,0x04,0x04,0x03,0x02,0x00,0x12,0x03,0x18,
0x02,0x28,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,
0x06,0x12,0x03,0x18,0x02,0x17,0x0a,0x0c,0x0a,0x05,
0x04,0x03,0x02,0x00,0x01,0x12,0x03,0x18,0x18,0x23,
0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x03,0x12,
0x03,0x18,0x26,0x27,0x0a,0x0b,0x0a,0x04,0x04,0x03,
0x02,0x01,0x12,0x03,0x19,0x02,0x22,0x0a,0x0c,0x0a,
0x05,0x04,0x03,0x02,0x01,0x06,0x12,0x03,0x19,0x02,
0x14,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x01,
0x12,0x03,0x19,0x15,0x1d,0x0a,0x0c,0x0a,0x05,0x04,
0x03,0x02,0x01,0x03,0x12,0x03,0x19,0x20,0x21,0x0a,
0x0a,0x0a,0x02,0x04,0x04,0x12,0x04,0x1c,0x00,0x1f,
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x04,0x01,0x12,0x03,
0x1c,0x08,0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,
0x00,0x12,0x03,0x1d,0x02,0x28,0x0a,0x0c,0x0a,0x05,
0x04,0x04,0x02,0x00,0x06,0x12,0x03,0x1d,0x02,0x17,
0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x01,0x12,
0x03,0x1d,0x18,0x23,0x0a,0x0c,0x0a,0x05,0x04,0x04,
0x02,0x00,0x03,0x12,0x03,0x1d,0x26,0x27,0x0a,0x0b,
0x0a,0x04,0x04,0x04,0x02,0x01,0x12,0x03,0x1e,0x02,
0x22,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x06,
0x12,0x03,0x1e,0x02,0x14,0x0a,0x0c,0x0a,0x05,0x04,
0x04,0x02,0x01,0x01,0x12,0x03,0x1e,0x15,0x1d,0x0a,
0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x03,0x12,0x03,
0x1e,0x20,0x21,0x0a,0x0a,0x0a,0x02,0x04,0x05,0x12,
0x04,0x21,0x00,0x28,0x01,0x0a,0x0a,0x0a,0x03,0x04,
0x05,0x01,0x12,0x03,0x21,0x08,0x17,0x0a,0x0b,0x0a,
0x04,0x04,0x05,0x02,0x00,0x12,0x03,0x22,0x02,0x10,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x05,0x12,
0x03,0x22,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x00,0x01,0x12,0x03,0x22,0x09,0x0b,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x00,0x03,0x12,0x03,0x22,
0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x01,
0x12,0x03,0x23,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,
0x05,0x02,0x01,0x05,0x12,0x03,0x23,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,0x01,0x12,0x03,
0x23,0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
0x01,0x03,0x12,0x03,0x23,0x0e,0x0f,0x0a,0x0b,0x0a,
0x04,0x04,0x05,0x02,0x02,0x12,0x03,0x24,0x02,0x10,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x05,0x12,
0x03,0x24,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x02,0x01,0x12,0x03,0x24,0x09,0x0b,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x02,0x03,0x12,0x03,0x24,
0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x03,
0x12,0x03,0x25,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,
0x05,0x02,0x03,0x05,0x12,0x03,0x25,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x05,0x02,0x03,0x01,0x12,0x03,
0x25,0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
0x03,0x03,0x12,0x03,0x25,0x0e,0x0f,0x0a,0x0b,0x0a,
0x04,0x04,0x05,0x02,0x04,0x12,0x03,0x26,0x02,0x10,
0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x04,0x05,0x12,
0x03,0x26,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,
0x02,0x04,0x01,0x12,0x03,0x26,0x09,0x0b,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x04,0x03,0x12,0x03,0x26,
0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x05,
0x12,0x03,0x27,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,
0x05,0x02,0x05,0x05,0x12,0x03,0x27,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x05,0x02,0x05,0x01,0x12,0x03,
0x27,0x09,0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
0x05,0x03,0x12,0x03,0x27,0x0e,0x0f,0x62,0x06,0x70,
0x72,0x6f,0x74,0x6f,0x33,
};
static const char file_name[] = "geometry3d.proto";
static const char wpi_proto_ProtobufTranslation3d_name[] = "wpi.proto.ProtobufTranslation3d";
std::string_view wpi_proto_ProtobufTranslation3d::msg_name(void) noexcept { return wpi_proto_ProtobufTranslation3d_name; }
pb_filedesc_t wpi_proto_ProtobufTranslation3d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufTranslation3d, wpi_proto_ProtobufTranslation3d, AUTO)
static const char wpi_proto_ProtobufQuaternion_name[] = "wpi.proto.ProtobufQuaternion";
std::string_view wpi_proto_ProtobufQuaternion::msg_name(void) noexcept { return wpi_proto_ProtobufQuaternion_name; }
pb_filedesc_t wpi_proto_ProtobufQuaternion::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufQuaternion, wpi_proto_ProtobufQuaternion, AUTO)
static const char wpi_proto_ProtobufRotation3d_name[] = "wpi.proto.ProtobufRotation3d";
std::string_view wpi_proto_ProtobufRotation3d::msg_name(void) noexcept { return wpi_proto_ProtobufRotation3d_name; }
pb_filedesc_t wpi_proto_ProtobufRotation3d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufRotation3d, wpi_proto_ProtobufRotation3d, AUTO)
static const char wpi_proto_ProtobufPose3d_name[] = "wpi.proto.ProtobufPose3d";
std::string_view wpi_proto_ProtobufPose3d::msg_name(void) noexcept { return wpi_proto_ProtobufPose3d_name; }
pb_filedesc_t wpi_proto_ProtobufPose3d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufPose3d, wpi_proto_ProtobufPose3d, AUTO)
static const char wpi_proto_ProtobufTransform3d_name[] = "wpi.proto.ProtobufTransform3d";
std::string_view wpi_proto_ProtobufTransform3d::msg_name(void) noexcept { return wpi_proto_ProtobufTransform3d_name; }
pb_filedesc_t wpi_proto_ProtobufTransform3d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufTransform3d, wpi_proto_ProtobufTransform3d, AUTO)
static const char wpi_proto_ProtobufTwist3d_name[] = "wpi.proto.ProtobufTwist3d";
std::string_view wpi_proto_ProtobufTwist3d::msg_name(void) noexcept { return wpi_proto_ProtobufTwist3d_name; }
pb_filedesc_t wpi_proto_ProtobufTwist3d::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufTwist3d, wpi_proto_ProtobufTwist3d, AUTO)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -0,0 +1,171 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_GEOMETRY3D_NPB_H_INCLUDED
#define PB_WPI_PROTO_GEOMETRY3D_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufTranslation3d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double x;
double y;
double z;
} wpi_proto_ProtobufTranslation3d;
typedef struct _wpi_proto_ProtobufQuaternion {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double w;
double x;
double y;
double z;
} wpi_proto_ProtobufQuaternion;
typedef struct _wpi_proto_ProtobufRotation3d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t q;
} wpi_proto_ProtobufRotation3d;
typedef struct _wpi_proto_ProtobufPose3d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t translation;
pb_callback_t rotation;
} wpi_proto_ProtobufPose3d;
typedef struct _wpi_proto_ProtobufTransform3d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t translation;
pb_callback_t rotation;
} wpi_proto_ProtobufTransform3d;
typedef struct _wpi_proto_ProtobufTwist3d {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double dx;
double dy;
double dz;
double rx;
double ry;
double rz;
} wpi_proto_ProtobufTwist3d;
/* Initializer values for message structs */
#define wpi_proto_ProtobufTranslation3d_init_default {0, 0, 0}
#define wpi_proto_ProtobufQuaternion_init_default {0, 0, 0, 0}
#define wpi_proto_ProtobufRotation3d_init_default {{{NULL}, NULL}}
#define wpi_proto_ProtobufPose3d_init_default {{{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufTransform3d_init_default {{{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufTwist3d_init_default {0, 0, 0, 0, 0, 0}
#define wpi_proto_ProtobufTranslation3d_init_zero {0, 0, 0}
#define wpi_proto_ProtobufQuaternion_init_zero {0, 0, 0, 0}
#define wpi_proto_ProtobufRotation3d_init_zero {{{NULL}, NULL}}
#define wpi_proto_ProtobufPose3d_init_zero {{{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufTransform3d_init_zero {{{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufTwist3d_init_zero {0, 0, 0, 0, 0, 0}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufTranslation3d_x_tag 1
#define wpi_proto_ProtobufTranslation3d_y_tag 2
#define wpi_proto_ProtobufTranslation3d_z_tag 3
#define wpi_proto_ProtobufQuaternion_w_tag 1
#define wpi_proto_ProtobufQuaternion_x_tag 2
#define wpi_proto_ProtobufQuaternion_y_tag 3
#define wpi_proto_ProtobufQuaternion_z_tag 4
#define wpi_proto_ProtobufRotation3d_q_tag 1
#define wpi_proto_ProtobufPose3d_translation_tag 1
#define wpi_proto_ProtobufPose3d_rotation_tag 2
#define wpi_proto_ProtobufTransform3d_translation_tag 1
#define wpi_proto_ProtobufTransform3d_rotation_tag 2
#define wpi_proto_ProtobufTwist3d_dx_tag 1
#define wpi_proto_ProtobufTwist3d_dy_tag 2
#define wpi_proto_ProtobufTwist3d_dz_tag 3
#define wpi_proto_ProtobufTwist3d_rx_tag 4
#define wpi_proto_ProtobufTwist3d_ry_tag 5
#define wpi_proto_ProtobufTwist3d_rz_tag 6
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufTranslation3d_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, x, 1) \
X(a, STATIC, SINGULAR, DOUBLE, y, 2) \
X(a, STATIC, SINGULAR, DOUBLE, z, 3)
#define wpi_proto_ProtobufTranslation3d_CALLBACK NULL
#define wpi_proto_ProtobufTranslation3d_DEFAULT NULL
#define wpi_proto_ProtobufQuaternion_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, w, 1) \
X(a, STATIC, SINGULAR, DOUBLE, x, 2) \
X(a, STATIC, SINGULAR, DOUBLE, y, 3) \
X(a, STATIC, SINGULAR, DOUBLE, z, 4)
#define wpi_proto_ProtobufQuaternion_CALLBACK NULL
#define wpi_proto_ProtobufQuaternion_DEFAULT NULL
#define wpi_proto_ProtobufRotation3d_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, MESSAGE, q, 1)
#define wpi_proto_ProtobufRotation3d_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufRotation3d_DEFAULT NULL
#define wpi_proto_ProtobufRotation3d_q_MSGTYPE wpi_proto_ProtobufQuaternion
#define wpi_proto_ProtobufPose3d_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, MESSAGE, translation, 1) \
X(a, CALLBACK, OPTIONAL, MESSAGE, rotation, 2)
#define wpi_proto_ProtobufPose3d_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufPose3d_DEFAULT NULL
#define wpi_proto_ProtobufPose3d_translation_MSGTYPE wpi_proto_ProtobufTranslation3d
#define wpi_proto_ProtobufPose3d_rotation_MSGTYPE wpi_proto_ProtobufRotation3d
#define wpi_proto_ProtobufTransform3d_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, MESSAGE, translation, 1) \
X(a, CALLBACK, OPTIONAL, MESSAGE, rotation, 2)
#define wpi_proto_ProtobufTransform3d_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufTransform3d_DEFAULT NULL
#define wpi_proto_ProtobufTransform3d_translation_MSGTYPE wpi_proto_ProtobufTranslation3d
#define wpi_proto_ProtobufTransform3d_rotation_MSGTYPE wpi_proto_ProtobufRotation3d
#define wpi_proto_ProtobufTwist3d_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, dx, 1) \
X(a, STATIC, SINGULAR, DOUBLE, dy, 2) \
X(a, STATIC, SINGULAR, DOUBLE, dz, 3) \
X(a, STATIC, SINGULAR, DOUBLE, rx, 4) \
X(a, STATIC, SINGULAR, DOUBLE, ry, 5) \
X(a, STATIC, SINGULAR, DOUBLE, rz, 6)
#define wpi_proto_ProtobufTwist3d_CALLBACK NULL
#define wpi_proto_ProtobufTwist3d_DEFAULT NULL
/* Maximum encoded size of messages (where known) */
/* wpi_proto_ProtobufRotation3d_size depends on runtime parameters */
/* wpi_proto_ProtobufPose3d_size depends on runtime parameters */
/* wpi_proto_ProtobufTransform3d_size depends on runtime parameters */
#define WPI_PROTO_GEOMETRY3D_NPB_H_MAX_SIZE wpi_proto_ProtobufTwist3d_size
#define wpi_proto_ProtobufQuaternion_size 36
#define wpi_proto_ProtobufTranslation3d_size 27
#define wpi_proto_ProtobufTwist3d_size 54
#endif

View File

@@ -0,0 +1,434 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "kinematics.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x10,0x6b,0x69,0x6e,0x65,0x6d,0x61,0x74,0x69,
0x63,0x73,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x1a,
0x10,0x67,0x65,0x6f,0x6d,0x65,0x74,0x72,0x79,0x32,
0x64,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,0x4d,0x0a,
0x15,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x43,
0x68,0x61,0x73,0x73,0x69,0x73,0x53,0x70,0x65,0x65,
0x64,0x73,0x12,0x0e,0x0a,0x02,0x76,0x78,0x18,0x01,
0x20,0x01,0x28,0x01,0x52,0x02,0x76,0x78,0x12,0x0e,
0x0a,0x02,0x76,0x79,0x18,0x02,0x20,0x01,0x28,0x01,
0x52,0x02,0x76,0x79,0x12,0x14,0x0a,0x05,0x6f,0x6d,
0x65,0x67,0x61,0x18,0x03,0x20,0x01,0x28,0x01,0x52,
0x05,0x6f,0x6d,0x65,0x67,0x61,0x22,0x46,0x0a,0x23,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x44,0x69,
0x66,0x66,0x65,0x72,0x65,0x6e,0x74,0x69,0x61,0x6c,
0x44,0x72,0x69,0x76,0x65,0x4b,0x69,0x6e,0x65,0x6d,
0x61,0x74,0x69,0x63,0x73,0x12,0x1f,0x0a,0x0b,0x74,
0x72,0x61,0x63,0x6b,0x5f,0x77,0x69,0x64,0x74,0x68,
0x18,0x01,0x20,0x01,0x28,0x01,0x52,0x0a,0x74,0x72,
0x61,0x63,0x6b,0x57,0x69,0x64,0x74,0x68,0x22,0x50,
0x0a,0x24,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,
0x44,0x69,0x66,0x66,0x65,0x72,0x65,0x6e,0x74,0x69,
0x61,0x6c,0x44,0x72,0x69,0x76,0x65,0x57,0x68,0x65,
0x65,0x6c,0x53,0x70,0x65,0x65,0x64,0x73,0x12,0x12,
0x0a,0x04,0x6c,0x65,0x66,0x74,0x18,0x01,0x20,0x01,
0x28,0x01,0x52,0x04,0x6c,0x65,0x66,0x74,0x12,0x14,
0x0a,0x05,0x72,0x69,0x67,0x68,0x74,0x18,0x02,0x20,
0x01,0x28,0x01,0x52,0x05,0x72,0x69,0x67,0x68,0x74,
0x22,0x53,0x0a,0x27,0x50,0x72,0x6f,0x74,0x6f,0x62,
0x75,0x66,0x44,0x69,0x66,0x66,0x65,0x72,0x65,0x6e,
0x74,0x69,0x61,0x6c,0x44,0x72,0x69,0x76,0x65,0x57,
0x68,0x65,0x65,0x6c,0x50,0x6f,0x73,0x69,0x74,0x69,
0x6f,0x6e,0x73,0x12,0x12,0x0a,0x04,0x6c,0x65,0x66,
0x74,0x18,0x01,0x20,0x01,0x28,0x01,0x52,0x04,0x6c,
0x65,0x66,0x74,0x12,0x14,0x0a,0x05,0x72,0x69,0x67,
0x68,0x74,0x18,0x02,0x20,0x01,0x28,0x01,0x52,0x05,
0x72,0x69,0x67,0x68,0x74,0x22,0xa4,0x02,0x0a,0x1e,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4d,0x65,
0x63,0x61,0x6e,0x75,0x6d,0x44,0x72,0x69,0x76,0x65,
0x4b,0x69,0x6e,0x65,0x6d,0x61,0x74,0x69,0x63,0x73,
0x12,0x3f,0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x5f,
0x6c,0x65,0x66,0x74,0x18,0x01,0x20,0x01,0x28,0x0b,
0x32,0x20,0x2e,0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,
0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,
0x66,0x54,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x69,
0x6f,0x6e,0x32,0x64,0x52,0x09,0x66,0x72,0x6f,0x6e,
0x74,0x4c,0x65,0x66,0x74,0x12,0x41,0x0a,0x0b,0x66,
0x72,0x6f,0x6e,0x74,0x5f,0x72,0x69,0x67,0x68,0x74,
0x18,0x02,0x20,0x01,0x28,0x0b,0x32,0x20,0x2e,0x77,
0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x54,0x72,0x61,
0x6e,0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,
0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x52,0x69,0x67,
0x68,0x74,0x12,0x3d,0x0a,0x09,0x72,0x65,0x61,0x72,
0x5f,0x6c,0x65,0x66,0x74,0x18,0x03,0x20,0x01,0x28,
0x0b,0x32,0x20,0x2e,0x77,0x70,0x69,0x2e,0x70,0x72,
0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,0x62,
0x75,0x66,0x54,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,
0x69,0x6f,0x6e,0x32,0x64,0x52,0x08,0x72,0x65,0x61,
0x72,0x4c,0x65,0x66,0x74,0x12,0x3f,0x0a,0x0a,0x72,
0x65,0x61,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,
0x04,0x20,0x01,0x28,0x0b,0x32,0x20,0x2e,0x77,0x70,
0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,
0x6f,0x74,0x6f,0x62,0x75,0x66,0x54,0x72,0x61,0x6e,
0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,0x52,
0x09,0x72,0x65,0x61,0x72,0x52,0x69,0x67,0x68,0x74,
0x22,0x9f,0x01,0x0a,0x21,0x50,0x72,0x6f,0x74,0x6f,
0x62,0x75,0x66,0x4d,0x65,0x63,0x61,0x6e,0x75,0x6d,
0x44,0x72,0x69,0x76,0x65,0x4d,0x6f,0x74,0x6f,0x72,
0x56,0x6f,0x6c,0x74,0x61,0x67,0x65,0x73,0x12,0x1d,
0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x5f,0x6c,0x65,
0x66,0x74,0x18,0x01,0x20,0x01,0x28,0x01,0x52,0x09,
0x66,0x72,0x6f,0x6e,0x74,0x4c,0x65,0x66,0x74,0x12,
0x1f,0x0a,0x0b,0x66,0x72,0x6f,0x6e,0x74,0x5f,0x72,
0x69,0x67,0x68,0x74,0x18,0x02,0x20,0x01,0x28,0x01,
0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74,0x52,0x69,0x67,
0x68,0x74,0x12,0x1b,0x0a,0x09,0x72,0x65,0x61,0x72,
0x5f,0x6c,0x65,0x66,0x74,0x18,0x03,0x20,0x01,0x28,
0x01,0x52,0x08,0x72,0x65,0x61,0x72,0x4c,0x65,0x66,
0x74,0x12,0x1d,0x0a,0x0a,0x72,0x65,0x61,0x72,0x5f,
0x72,0x69,0x67,0x68,0x74,0x18,0x04,0x20,0x01,0x28,
0x01,0x52,0x09,0x72,0x65,0x61,0x72,0x52,0x69,0x67,
0x68,0x74,0x22,0xa0,0x01,0x0a,0x22,0x50,0x72,0x6f,
0x74,0x6f,0x62,0x75,0x66,0x4d,0x65,0x63,0x61,0x6e,
0x75,0x6d,0x44,0x72,0x69,0x76,0x65,0x57,0x68,0x65,
0x65,0x6c,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x73,0x12,0x1d,0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74,
0x5f,0x6c,0x65,0x66,0x74,0x18,0x01,0x20,0x01,0x28,
0x01,0x52,0x09,0x66,0x72,0x6f,0x6e,0x74,0x4c,0x65,
0x66,0x74,0x12,0x1f,0x0a,0x0b,0x66,0x72,0x6f,0x6e,
0x74,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x02,0x20,
0x01,0x28,0x01,0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74,
0x52,0x69,0x67,0x68,0x74,0x12,0x1b,0x0a,0x09,0x72,
0x65,0x61,0x72,0x5f,0x6c,0x65,0x66,0x74,0x18,0x03,
0x20,0x01,0x28,0x01,0x52,0x08,0x72,0x65,0x61,0x72,
0x4c,0x65,0x66,0x74,0x12,0x1d,0x0a,0x0a,0x72,0x65,
0x61,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x04,
0x20,0x01,0x28,0x01,0x52,0x09,0x72,0x65,0x61,0x72,
0x52,0x69,0x67,0x68,0x74,0x22,0x9d,0x01,0x0a,0x1f,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4d,0x65,
0x63,0x61,0x6e,0x75,0x6d,0x44,0x72,0x69,0x76,0x65,
0x57,0x68,0x65,0x65,0x6c,0x53,0x70,0x65,0x65,0x64,
0x73,0x12,0x1d,0x0a,0x0a,0x66,0x72,0x6f,0x6e,0x74,
0x5f,0x6c,0x65,0x66,0x74,0x18,0x01,0x20,0x01,0x28,
0x01,0x52,0x09,0x66,0x72,0x6f,0x6e,0x74,0x4c,0x65,
0x66,0x74,0x12,0x1f,0x0a,0x0b,0x66,0x72,0x6f,0x6e,
0x74,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x02,0x20,
0x01,0x28,0x01,0x52,0x0a,0x66,0x72,0x6f,0x6e,0x74,
0x52,0x69,0x67,0x68,0x74,0x12,0x1b,0x0a,0x09,0x72,
0x65,0x61,0x72,0x5f,0x6c,0x65,0x66,0x74,0x18,0x03,
0x20,0x01,0x28,0x01,0x52,0x08,0x72,0x65,0x61,0x72,
0x4c,0x65,0x66,0x74,0x12,0x1d,0x0a,0x0a,0x72,0x65,
0x61,0x72,0x5f,0x72,0x69,0x67,0x68,0x74,0x18,0x04,
0x20,0x01,0x28,0x01,0x52,0x09,0x72,0x65,0x61,0x72,
0x52,0x69,0x67,0x68,0x74,0x22,0x5b,0x0a,0x1d,0x50,
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x53,0x77,0x65,
0x72,0x76,0x65,0x44,0x72,0x69,0x76,0x65,0x4b,0x69,
0x6e,0x65,0x6d,0x61,0x74,0x69,0x63,0x73,0x12,0x3a,
0x0a,0x07,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x73,0x18,
0x01,0x20,0x03,0x28,0x0b,0x32,0x20,0x2e,0x77,0x70,
0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,
0x6f,0x74,0x6f,0x62,0x75,0x66,0x54,0x72,0x61,0x6e,
0x73,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,0x52,
0x07,0x6d,0x6f,0x64,0x75,0x6c,0x65,0x73,0x22,0x6f,
0x0a,0x1c,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,
0x53,0x77,0x65,0x72,0x76,0x65,0x4d,0x6f,0x64,0x75,
0x6c,0x65,0x50,0x6f,0x73,0x69,0x74,0x69,0x6f,0x6e,
0x12,0x1a,0x0a,0x08,0x64,0x69,0x73,0x74,0x61,0x6e,
0x63,0x65,0x18,0x01,0x20,0x01,0x28,0x01,0x52,0x08,
0x64,0x69,0x73,0x74,0x61,0x6e,0x63,0x65,0x12,0x33,
0x0a,0x05,0x61,0x6e,0x67,0x6c,0x65,0x18,0x02,0x20,
0x01,0x28,0x0b,0x32,0x1d,0x2e,0x77,0x70,0x69,0x2e,
0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,
0x6f,0x62,0x75,0x66,0x52,0x6f,0x74,0x61,0x74,0x69,
0x6f,0x6e,0x32,0x64,0x52,0x05,0x61,0x6e,0x67,0x6c,
0x65,0x22,0x66,0x0a,0x19,0x50,0x72,0x6f,0x74,0x6f,
0x62,0x75,0x66,0x53,0x77,0x65,0x72,0x76,0x65,0x4d,
0x6f,0x64,0x75,0x6c,0x65,0x53,0x74,0x61,0x74,0x65,
0x12,0x14,0x0a,0x05,0x73,0x70,0x65,0x65,0x64,0x18,
0x01,0x20,0x01,0x28,0x01,0x52,0x05,0x73,0x70,0x65,
0x65,0x64,0x12,0x33,0x0a,0x05,0x61,0x6e,0x67,0x6c,
0x65,0x18,0x02,0x20,0x01,0x28,0x0b,0x32,0x1d,0x2e,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x52,0x6f,
0x74,0x61,0x74,0x69,0x6f,0x6e,0x32,0x64,0x52,0x05,
0x61,0x6e,0x67,0x6c,0x65,0x42,0x1a,0x0a,0x18,0x65,
0x64,0x75,0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,0x72,
0x73,0x74,0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,0x72,
0x6f,0x74,0x6f,0x4a,0x8d,0x0f,0x0a,0x06,0x12,0x04,
0x00,0x00,0x44,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,
0x03,0x00,0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,
0x03,0x02,0x00,0x12,0x0a,0x09,0x0a,0x02,0x03,0x00,
0x12,0x03,0x04,0x00,0x1a,0x0a,0x08,0x0a,0x01,0x08,
0x12,0x03,0x06,0x00,0x31,0x0a,0x09,0x0a,0x02,0x08,
0x01,0x12,0x03,0x06,0x00,0x31,0x0a,0x0a,0x0a,0x02,
0x04,0x00,0x12,0x04,0x08,0x00,0x0c,0x01,0x0a,0x0a,
0x0a,0x03,0x04,0x00,0x01,0x12,0x03,0x08,0x08,0x1d,
0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x00,0x12,0x03,
0x09,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x00,0x05,0x12,0x03,0x09,0x02,0x08,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x00,0x01,0x12,0x03,0x09,0x09,
0x0b,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x03,
0x12,0x03,0x09,0x0e,0x0f,0x0a,0x0b,0x0a,0x04,0x04,
0x00,0x02,0x01,0x12,0x03,0x0a,0x02,0x10,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x01,0x05,0x12,0x03,0x0a,
0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,
0x01,0x12,0x03,0x0a,0x09,0x0b,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x01,0x03,0x12,0x03,0x0a,0x0e,0x0f,
0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x02,0x12,0x03,
0x0b,0x02,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x02,0x05,0x12,0x03,0x0b,0x02,0x08,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x02,0x01,0x12,0x03,0x0b,0x09,
0x0e,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x03,
0x12,0x03,0x0b,0x11,0x12,0x0a,0x0a,0x0a,0x02,0x04,
0x01,0x12,0x04,0x0e,0x00,0x10,0x01,0x0a,0x0a,0x0a,
0x03,0x04,0x01,0x01,0x12,0x03,0x0e,0x08,0x2b,0x0a,
0x0b,0x0a,0x04,0x04,0x01,0x02,0x00,0x12,0x03,0x0f,
0x02,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,
0x05,0x12,0x03,0x0f,0x02,0x08,0x0a,0x0c,0x0a,0x05,
0x04,0x01,0x02,0x00,0x01,0x12,0x03,0x0f,0x09,0x14,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x03,0x12,
0x03,0x0f,0x17,0x18,0x0a,0x0a,0x0a,0x02,0x04,0x02,
0x12,0x04,0x12,0x00,0x15,0x01,0x0a,0x0a,0x0a,0x03,
0x04,0x02,0x01,0x12,0x03,0x12,0x08,0x2c,0x0a,0x0b,
0x0a,0x04,0x04,0x02,0x02,0x00,0x12,0x03,0x13,0x02,
0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x05,
0x12,0x03,0x13,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,
0x02,0x02,0x00,0x01,0x12,0x03,0x13,0x09,0x0d,0x0a,
0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x03,0x12,0x03,
0x13,0x10,0x11,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02,
0x01,0x12,0x03,0x14,0x02,0x13,0x0a,0x0c,0x0a,0x05,
0x04,0x02,0x02,0x01,0x05,0x12,0x03,0x14,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,0x01,0x12,
0x03,0x14,0x09,0x0e,0x0a,0x0c,0x0a,0x05,0x04,0x02,
0x02,0x01,0x03,0x12,0x03,0x14,0x11,0x12,0x0a,0x0a,
0x0a,0x02,0x04,0x03,0x12,0x04,0x17,0x00,0x1a,0x01,
0x0a,0x0a,0x0a,0x03,0x04,0x03,0x01,0x12,0x03,0x17,
0x08,0x2f,0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x00,
0x12,0x03,0x18,0x02,0x12,0x0a,0x0c,0x0a,0x05,0x04,
0x03,0x02,0x00,0x05,0x12,0x03,0x18,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01,0x12,0x03,
0x18,0x09,0x0d,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,
0x00,0x03,0x12,0x03,0x18,0x10,0x11,0x0a,0x0b,0x0a,
0x04,0x04,0x03,0x02,0x01,0x12,0x03,0x19,0x02,0x13,
0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x05,0x12,
0x03,0x19,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x03,
0x02,0x01,0x01,0x12,0x03,0x19,0x09,0x0e,0x0a,0x0c,
0x0a,0x05,0x04,0x03,0x02,0x01,0x03,0x12,0x03,0x19,
0x11,0x12,0x0a,0x0a,0x0a,0x02,0x04,0x04,0x12,0x04,
0x1c,0x00,0x21,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x04,
0x01,0x12,0x03,0x1c,0x08,0x26,0x0a,0x0b,0x0a,0x04,
0x04,0x04,0x02,0x00,0x12,0x03,0x1d,0x02,0x27,0x0a,
0x0c,0x0a,0x05,0x04,0x04,0x02,0x00,0x06,0x12,0x03,
0x1d,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,
0x00,0x01,0x12,0x03,0x1d,0x18,0x22,0x0a,0x0c,0x0a,
0x05,0x04,0x04,0x02,0x00,0x03,0x12,0x03,0x1d,0x25,
0x26,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x01,0x12,
0x03,0x1e,0x02,0x28,0x0a,0x0c,0x0a,0x05,0x04,0x04,
0x02,0x01,0x06,0x12,0x03,0x1e,0x02,0x17,0x0a,0x0c,
0x0a,0x05,0x04,0x04,0x02,0x01,0x01,0x12,0x03,0x1e,
0x18,0x23,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,
0x03,0x12,0x03,0x1e,0x26,0x27,0x0a,0x0b,0x0a,0x04,
0x04,0x04,0x02,0x02,0x12,0x03,0x1f,0x02,0x26,0x0a,
0x0c,0x0a,0x05,0x04,0x04,0x02,0x02,0x06,0x12,0x03,
0x1f,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,
0x02,0x01,0x12,0x03,0x1f,0x18,0x21,0x0a,0x0c,0x0a,
0x05,0x04,0x04,0x02,0x02,0x03,0x12,0x03,0x1f,0x24,
0x25,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x03,0x12,
0x03,0x20,0x02,0x27,0x0a,0x0c,0x0a,0x05,0x04,0x04,
0x02,0x03,0x06,0x12,0x03,0x20,0x02,0x17,0x0a,0x0c,
0x0a,0x05,0x04,0x04,0x02,0x03,0x01,0x12,0x03,0x20,
0x18,0x22,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x03,
0x03,0x12,0x03,0x20,0x25,0x26,0x0a,0x0a,0x0a,0x02,
0x04,0x05,0x12,0x04,0x23,0x00,0x28,0x01,0x0a,0x0a,
0x0a,0x03,0x04,0x05,0x01,0x12,0x03,0x23,0x08,0x29,
0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x00,0x12,0x03,
0x24,0x02,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
0x00,0x05,0x12,0x03,0x24,0x02,0x08,0x0a,0x0c,0x0a,
0x05,0x04,0x05,0x02,0x00,0x01,0x12,0x03,0x24,0x09,
0x13,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x03,
0x12,0x03,0x24,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,
0x05,0x02,0x01,0x12,0x03,0x25,0x02,0x19,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x01,0x05,0x12,0x03,0x25,
0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01,
0x01,0x12,0x03,0x25,0x09,0x14,0x0a,0x0c,0x0a,0x05,
0x04,0x05,0x02,0x01,0x03,0x12,0x03,0x25,0x17,0x18,
0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x02,0x12,0x03,
0x26,0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,
0x02,0x05,0x12,0x03,0x26,0x02,0x08,0x0a,0x0c,0x0a,
0x05,0x04,0x05,0x02,0x02,0x01,0x12,0x03,0x26,0x09,
0x12,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x03,
0x12,0x03,0x26,0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04,
0x05,0x02,0x03,0x12,0x03,0x27,0x02,0x18,0x0a,0x0c,
0x0a,0x05,0x04,0x05,0x02,0x03,0x05,0x12,0x03,0x27,
0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03,
0x01,0x12,0x03,0x27,0x09,0x13,0x0a,0x0c,0x0a,0x05,
0x04,0x05,0x02,0x03,0x03,0x12,0x03,0x27,0x16,0x17,
0x0a,0x0a,0x0a,0x02,0x04,0x06,0x12,0x04,0x2a,0x00,
0x2f,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x06,0x01,0x12,
0x03,0x2a,0x08,0x2a,0x0a,0x0b,0x0a,0x04,0x04,0x06,
0x02,0x00,0x12,0x03,0x2b,0x02,0x18,0x0a,0x0c,0x0a,
0x05,0x04,0x06,0x02,0x00,0x05,0x12,0x03,0x2b,0x02,
0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x00,0x01,
0x12,0x03,0x2b,0x09,0x13,0x0a,0x0c,0x0a,0x05,0x04,
0x06,0x02,0x00,0x03,0x12,0x03,0x2b,0x16,0x17,0x0a,
0x0b,0x0a,0x04,0x04,0x06,0x02,0x01,0x12,0x03,0x2c,
0x02,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,
0x05,0x12,0x03,0x2c,0x02,0x08,0x0a,0x0c,0x0a,0x05,
0x04,0x06,0x02,0x01,0x01,0x12,0x03,0x2c,0x09,0x14,
0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x01,0x03,0x12,
0x03,0x2c,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x06,
0x02,0x02,0x12,0x03,0x2d,0x02,0x17,0x0a,0x0c,0x0a,
0x05,0x04,0x06,0x02,0x02,0x05,0x12,0x03,0x2d,0x02,
0x08,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x02,0x01,
0x12,0x03,0x2d,0x09,0x12,0x0a,0x0c,0x0a,0x05,0x04,
0x06,0x02,0x02,0x03,0x12,0x03,0x2d,0x15,0x16,0x0a,
0x0b,0x0a,0x04,0x04,0x06,0x02,0x03,0x12,0x03,0x2e,
0x02,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x03,
0x05,0x12,0x03,0x2e,0x02,0x08,0x0a,0x0c,0x0a,0x05,
0x04,0x06,0x02,0x03,0x01,0x12,0x03,0x2e,0x09,0x13,
0x0a,0x0c,0x0a,0x05,0x04,0x06,0x02,0x03,0x03,0x12,
0x03,0x2e,0x16,0x17,0x0a,0x0a,0x0a,0x02,0x04,0x07,
0x12,0x04,0x31,0x00,0x36,0x01,0x0a,0x0a,0x0a,0x03,
0x04,0x07,0x01,0x12,0x03,0x31,0x08,0x27,0x0a,0x0b,
0x0a,0x04,0x04,0x07,0x02,0x00,0x12,0x03,0x32,0x02,
0x18,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x05,
0x12,0x03,0x32,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,
0x07,0x02,0x00,0x01,0x12,0x03,0x32,0x09,0x13,0x0a,
0x0c,0x0a,0x05,0x04,0x07,0x02,0x00,0x03,0x12,0x03,
0x32,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,0x07,0x02,
0x01,0x12,0x03,0x33,0x02,0x19,0x0a,0x0c,0x0a,0x05,
0x04,0x07,0x02,0x01,0x05,0x12,0x03,0x33,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x01,0x01,0x12,
0x03,0x33,0x09,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x07,
0x02,0x01,0x03,0x12,0x03,0x33,0x17,0x18,0x0a,0x0b,
0x0a,0x04,0x04,0x07,0x02,0x02,0x12,0x03,0x34,0x02,
0x17,0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x02,0x05,
0x12,0x03,0x34,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,
0x07,0x02,0x02,0x01,0x12,0x03,0x34,0x09,0x12,0x0a,
0x0c,0x0a,0x05,0x04,0x07,0x02,0x02,0x03,0x12,0x03,
0x34,0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x07,0x02,
0x03,0x12,0x03,0x35,0x02,0x18,0x0a,0x0c,0x0a,0x05,
0x04,0x07,0x02,0x03,0x05,0x12,0x03,0x35,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x07,0x02,0x03,0x01,0x12,
0x03,0x35,0x09,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x07,
0x02,0x03,0x03,0x12,0x03,0x35,0x16,0x17,0x0a,0x0a,
0x0a,0x02,0x04,0x08,0x12,0x04,0x38,0x00,0x3a,0x01,
0x0a,0x0a,0x0a,0x03,0x04,0x08,0x01,0x12,0x03,0x38,
0x08,0x25,0x0a,0x0b,0x0a,0x04,0x04,0x08,0x02,0x00,
0x12,0x03,0x39,0x02,0x2d,0x0a,0x0c,0x0a,0x05,0x04,
0x08,0x02,0x00,0x04,0x12,0x03,0x39,0x02,0x0a,0x0a,
0x0c,0x0a,0x05,0x04,0x08,0x02,0x00,0x06,0x12,0x03,
0x39,0x0b,0x20,0x0a,0x0c,0x0a,0x05,0x04,0x08,0x02,
0x00,0x01,0x12,0x03,0x39,0x21,0x28,0x0a,0x0c,0x0a,
0x05,0x04,0x08,0x02,0x00,0x03,0x12,0x03,0x39,0x2b,
0x2c,0x0a,0x0a,0x0a,0x02,0x04,0x09,0x12,0x04,0x3c,
0x00,0x3f,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x09,0x01,
0x12,0x03,0x3c,0x08,0x24,0x0a,0x0b,0x0a,0x04,0x04,
0x09,0x02,0x00,0x12,0x03,0x3d,0x02,0x16,0x0a,0x0c,
0x0a,0x05,0x04,0x09,0x02,0x00,0x05,0x12,0x03,0x3d,
0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,0x00,
0x01,0x12,0x03,0x3d,0x09,0x11,0x0a,0x0c,0x0a,0x05,
0x04,0x09,0x02,0x00,0x03,0x12,0x03,0x3d,0x14,0x15,
0x0a,0x0b,0x0a,0x04,0x04,0x09,0x02,0x01,0x12,0x03,
0x3e,0x02,0x1f,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,
0x01,0x06,0x12,0x03,0x3e,0x02,0x14,0x0a,0x0c,0x0a,
0x05,0x04,0x09,0x02,0x01,0x01,0x12,0x03,0x3e,0x15,
0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x09,0x02,0x01,0x03,
0x12,0x03,0x3e,0x1d,0x1e,0x0a,0x0a,0x0a,0x02,0x04,
0x0a,0x12,0x04,0x41,0x00,0x44,0x01,0x0a,0x0a,0x0a,
0x03,0x04,0x0a,0x01,0x12,0x03,0x41,0x08,0x21,0x0a,
0x0b,0x0a,0x04,0x04,0x0a,0x02,0x00,0x12,0x03,0x42,
0x02,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x00,
0x05,0x12,0x03,0x42,0x02,0x08,0x0a,0x0c,0x0a,0x05,
0x04,0x0a,0x02,0x00,0x01,0x12,0x03,0x42,0x09,0x0e,
0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x00,0x03,0x12,
0x03,0x42,0x11,0x12,0x0a,0x0b,0x0a,0x04,0x04,0x0a,
0x02,0x01,0x12,0x03,0x43,0x02,0x1f,0x0a,0x0c,0x0a,
0x05,0x04,0x0a,0x02,0x01,0x06,0x12,0x03,0x43,0x02,
0x14,0x0a,0x0c,0x0a,0x05,0x04,0x0a,0x02,0x01,0x01,
0x12,0x03,0x43,0x15,0x1a,0x0a,0x0c,0x0a,0x05,0x04,
0x0a,0x02,0x01,0x03,0x12,0x03,0x43,0x1d,0x1e,0x62,
0x06,0x70,0x72,0x6f,0x74,0x6f,0x33,
};
static const char file_name[] = "kinematics.proto";
static const char wpi_proto_ProtobufChassisSpeeds_name[] = "wpi.proto.ProtobufChassisSpeeds";
std::string_view wpi_proto_ProtobufChassisSpeeds::msg_name(void) noexcept { return wpi_proto_ProtobufChassisSpeeds_name; }
pb_filedesc_t wpi_proto_ProtobufChassisSpeeds::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufChassisSpeeds, wpi_proto_ProtobufChassisSpeeds, AUTO)
static const char wpi_proto_ProtobufDifferentialDriveKinematics_name[] = "wpi.proto.ProtobufDifferentialDriveKinematics";
std::string_view wpi_proto_ProtobufDifferentialDriveKinematics::msg_name(void) noexcept { return wpi_proto_ProtobufDifferentialDriveKinematics_name; }
pb_filedesc_t wpi_proto_ProtobufDifferentialDriveKinematics::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufDifferentialDriveKinematics, wpi_proto_ProtobufDifferentialDriveKinematics, AUTO)
static const char wpi_proto_ProtobufDifferentialDriveWheelSpeeds_name[] = "wpi.proto.ProtobufDifferentialDriveWheelSpeeds";
std::string_view wpi_proto_ProtobufDifferentialDriveWheelSpeeds::msg_name(void) noexcept { return wpi_proto_ProtobufDifferentialDriveWheelSpeeds_name; }
pb_filedesc_t wpi_proto_ProtobufDifferentialDriveWheelSpeeds::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufDifferentialDriveWheelSpeeds, wpi_proto_ProtobufDifferentialDriveWheelSpeeds, AUTO)
static const char wpi_proto_ProtobufDifferentialDriveWheelPositions_name[] = "wpi.proto.ProtobufDifferentialDriveWheelPositions";
std::string_view wpi_proto_ProtobufDifferentialDriveWheelPositions::msg_name(void) noexcept { return wpi_proto_ProtobufDifferentialDriveWheelPositions_name; }
pb_filedesc_t wpi_proto_ProtobufDifferentialDriveWheelPositions::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufDifferentialDriveWheelPositions, wpi_proto_ProtobufDifferentialDriveWheelPositions, AUTO)
static const char wpi_proto_ProtobufMecanumDriveKinematics_name[] = "wpi.proto.ProtobufMecanumDriveKinematics";
std::string_view wpi_proto_ProtobufMecanumDriveKinematics::msg_name(void) noexcept { return wpi_proto_ProtobufMecanumDriveKinematics_name; }
pb_filedesc_t wpi_proto_ProtobufMecanumDriveKinematics::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufMecanumDriveKinematics, wpi_proto_ProtobufMecanumDriveKinematics, AUTO)
static const char wpi_proto_ProtobufMecanumDriveMotorVoltages_name[] = "wpi.proto.ProtobufMecanumDriveMotorVoltages";
std::string_view wpi_proto_ProtobufMecanumDriveMotorVoltages::msg_name(void) noexcept { return wpi_proto_ProtobufMecanumDriveMotorVoltages_name; }
pb_filedesc_t wpi_proto_ProtobufMecanumDriveMotorVoltages::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufMecanumDriveMotorVoltages, wpi_proto_ProtobufMecanumDriveMotorVoltages, AUTO)
static const char wpi_proto_ProtobufMecanumDriveWheelPositions_name[] = "wpi.proto.ProtobufMecanumDriveWheelPositions";
std::string_view wpi_proto_ProtobufMecanumDriveWheelPositions::msg_name(void) noexcept { return wpi_proto_ProtobufMecanumDriveWheelPositions_name; }
pb_filedesc_t wpi_proto_ProtobufMecanumDriveWheelPositions::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufMecanumDriveWheelPositions, wpi_proto_ProtobufMecanumDriveWheelPositions, AUTO)
static const char wpi_proto_ProtobufMecanumDriveWheelSpeeds_name[] = "wpi.proto.ProtobufMecanumDriveWheelSpeeds";
std::string_view wpi_proto_ProtobufMecanumDriveWheelSpeeds::msg_name(void) noexcept { return wpi_proto_ProtobufMecanumDriveWheelSpeeds_name; }
pb_filedesc_t wpi_proto_ProtobufMecanumDriveWheelSpeeds::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufMecanumDriveWheelSpeeds, wpi_proto_ProtobufMecanumDriveWheelSpeeds, AUTO)
static const char wpi_proto_ProtobufSwerveDriveKinematics_name[] = "wpi.proto.ProtobufSwerveDriveKinematics";
std::string_view wpi_proto_ProtobufSwerveDriveKinematics::msg_name(void) noexcept { return wpi_proto_ProtobufSwerveDriveKinematics_name; }
pb_filedesc_t wpi_proto_ProtobufSwerveDriveKinematics::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufSwerveDriveKinematics, wpi_proto_ProtobufSwerveDriveKinematics, AUTO)
static const char wpi_proto_ProtobufSwerveModulePosition_name[] = "wpi.proto.ProtobufSwerveModulePosition";
std::string_view wpi_proto_ProtobufSwerveModulePosition::msg_name(void) noexcept { return wpi_proto_ProtobufSwerveModulePosition_name; }
pb_filedesc_t wpi_proto_ProtobufSwerveModulePosition::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufSwerveModulePosition, wpi_proto_ProtobufSwerveModulePosition, AUTO)
static const char wpi_proto_ProtobufSwerveModuleState_name[] = "wpi.proto.ProtobufSwerveModuleState";
std::string_view wpi_proto_ProtobufSwerveModuleState::msg_name(void) noexcept { return wpi_proto_ProtobufSwerveModuleState_name; }
pb_filedesc_t wpi_proto_ProtobufSwerveModuleState::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufSwerveModuleState, wpi_proto_ProtobufSwerveModuleState, AUTO)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -0,0 +1,277 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_KINEMATICS_NPB_H_INCLUDED
#define PB_WPI_PROTO_KINEMATICS_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#include "geometry2d.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufChassisSpeeds {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double vx;
double vy;
double omega;
} wpi_proto_ProtobufChassisSpeeds;
typedef struct _wpi_proto_ProtobufDifferentialDriveKinematics {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double track_width;
} wpi_proto_ProtobufDifferentialDriveKinematics;
typedef struct _wpi_proto_ProtobufDifferentialDriveWheelSpeeds {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double left;
double right;
} wpi_proto_ProtobufDifferentialDriveWheelSpeeds;
typedef struct _wpi_proto_ProtobufDifferentialDriveWheelPositions {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double left;
double right;
} wpi_proto_ProtobufDifferentialDriveWheelPositions;
typedef struct _wpi_proto_ProtobufMecanumDriveKinematics {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t front_left;
pb_callback_t front_right;
pb_callback_t rear_left;
pb_callback_t rear_right;
} wpi_proto_ProtobufMecanumDriveKinematics;
typedef struct _wpi_proto_ProtobufMecanumDriveMotorVoltages {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double front_left;
double front_right;
double rear_left;
double rear_right;
} wpi_proto_ProtobufMecanumDriveMotorVoltages;
typedef struct _wpi_proto_ProtobufMecanumDriveWheelPositions {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double front_left;
double front_right;
double rear_left;
double rear_right;
} wpi_proto_ProtobufMecanumDriveWheelPositions;
typedef struct _wpi_proto_ProtobufMecanumDriveWheelSpeeds {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double front_left;
double front_right;
double rear_left;
double rear_right;
} wpi_proto_ProtobufMecanumDriveWheelSpeeds;
typedef struct _wpi_proto_ProtobufSwerveDriveKinematics {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t modules;
} wpi_proto_ProtobufSwerveDriveKinematics;
typedef struct _wpi_proto_ProtobufSwerveModulePosition {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double distance;
pb_callback_t angle;
} wpi_proto_ProtobufSwerveModulePosition;
typedef struct _wpi_proto_ProtobufSwerveModuleState {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double speed;
pb_callback_t angle;
} wpi_proto_ProtobufSwerveModuleState;
/* Initializer values for message structs */
#define wpi_proto_ProtobufChassisSpeeds_init_default {0, 0, 0}
#define wpi_proto_ProtobufDifferentialDriveKinematics_init_default {0}
#define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_init_default {0, 0}
#define wpi_proto_ProtobufDifferentialDriveWheelPositions_init_default {0, 0}
#define wpi_proto_ProtobufMecanumDriveKinematics_init_default {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_init_default {0, 0, 0, 0}
#define wpi_proto_ProtobufMecanumDriveWheelPositions_init_default {0, 0, 0, 0}
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_init_default {0, 0, 0, 0}
#define wpi_proto_ProtobufSwerveDriveKinematics_init_default {{{NULL}, NULL}}
#define wpi_proto_ProtobufSwerveModulePosition_init_default {0, {{NULL}, NULL}}
#define wpi_proto_ProtobufSwerveModuleState_init_default {0, {{NULL}, NULL}}
#define wpi_proto_ProtobufChassisSpeeds_init_zero {0, 0, 0}
#define wpi_proto_ProtobufDifferentialDriveKinematics_init_zero {0}
#define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_init_zero {0, 0}
#define wpi_proto_ProtobufDifferentialDriveWheelPositions_init_zero {0, 0}
#define wpi_proto_ProtobufMecanumDriveKinematics_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_init_zero {0, 0, 0, 0}
#define wpi_proto_ProtobufMecanumDriveWheelPositions_init_zero {0, 0, 0, 0}
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_init_zero {0, 0, 0, 0}
#define wpi_proto_ProtobufSwerveDriveKinematics_init_zero {{{NULL}, NULL}}
#define wpi_proto_ProtobufSwerveModulePosition_init_zero {0, {{NULL}, NULL}}
#define wpi_proto_ProtobufSwerveModuleState_init_zero {0, {{NULL}, NULL}}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufChassisSpeeds_vx_tag 1
#define wpi_proto_ProtobufChassisSpeeds_vy_tag 2
#define wpi_proto_ProtobufChassisSpeeds_omega_tag 3
#define wpi_proto_ProtobufDifferentialDriveKinematics_track_width_tag 1
#define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_left_tag 1
#define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_right_tag 2
#define wpi_proto_ProtobufDifferentialDriveWheelPositions_left_tag 1
#define wpi_proto_ProtobufDifferentialDriveWheelPositions_right_tag 2
#define wpi_proto_ProtobufMecanumDriveKinematics_front_left_tag 1
#define wpi_proto_ProtobufMecanumDriveKinematics_front_right_tag 2
#define wpi_proto_ProtobufMecanumDriveKinematics_rear_left_tag 3
#define wpi_proto_ProtobufMecanumDriveKinematics_rear_right_tag 4
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_front_left_tag 1
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_front_right_tag 2
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_rear_left_tag 3
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_rear_right_tag 4
#define wpi_proto_ProtobufMecanumDriveWheelPositions_front_left_tag 1
#define wpi_proto_ProtobufMecanumDriveWheelPositions_front_right_tag 2
#define wpi_proto_ProtobufMecanumDriveWheelPositions_rear_left_tag 3
#define wpi_proto_ProtobufMecanumDriveWheelPositions_rear_right_tag 4
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_front_left_tag 1
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_front_right_tag 2
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_rear_left_tag 3
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_rear_right_tag 4
#define wpi_proto_ProtobufSwerveDriveKinematics_modules_tag 1
#define wpi_proto_ProtobufSwerveModulePosition_distance_tag 1
#define wpi_proto_ProtobufSwerveModulePosition_angle_tag 2
#define wpi_proto_ProtobufSwerveModuleState_speed_tag 1
#define wpi_proto_ProtobufSwerveModuleState_angle_tag 2
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufChassisSpeeds_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, vx, 1) \
X(a, STATIC, SINGULAR, DOUBLE, vy, 2) \
X(a, STATIC, SINGULAR, DOUBLE, omega, 3)
#define wpi_proto_ProtobufChassisSpeeds_CALLBACK NULL
#define wpi_proto_ProtobufChassisSpeeds_DEFAULT NULL
#define wpi_proto_ProtobufDifferentialDriveKinematics_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, track_width, 1)
#define wpi_proto_ProtobufDifferentialDriveKinematics_CALLBACK NULL
#define wpi_proto_ProtobufDifferentialDriveKinematics_DEFAULT NULL
#define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, left, 1) \
X(a, STATIC, SINGULAR, DOUBLE, right, 2)
#define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_CALLBACK NULL
#define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_DEFAULT NULL
#define wpi_proto_ProtobufDifferentialDriveWheelPositions_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, left, 1) \
X(a, STATIC, SINGULAR, DOUBLE, right, 2)
#define wpi_proto_ProtobufDifferentialDriveWheelPositions_CALLBACK NULL
#define wpi_proto_ProtobufDifferentialDriveWheelPositions_DEFAULT NULL
#define wpi_proto_ProtobufMecanumDriveKinematics_FIELDLIST(X, a) \
X(a, CALLBACK, OPTIONAL, MESSAGE, front_left, 1) \
X(a, CALLBACK, OPTIONAL, MESSAGE, front_right, 2) \
X(a, CALLBACK, OPTIONAL, MESSAGE, rear_left, 3) \
X(a, CALLBACK, OPTIONAL, MESSAGE, rear_right, 4)
#define wpi_proto_ProtobufMecanumDriveKinematics_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufMecanumDriveKinematics_DEFAULT NULL
#define wpi_proto_ProtobufMecanumDriveKinematics_front_left_MSGTYPE wpi_proto_ProtobufTranslation2d
#define wpi_proto_ProtobufMecanumDriveKinematics_front_right_MSGTYPE wpi_proto_ProtobufTranslation2d
#define wpi_proto_ProtobufMecanumDriveKinematics_rear_left_MSGTYPE wpi_proto_ProtobufTranslation2d
#define wpi_proto_ProtobufMecanumDriveKinematics_rear_right_MSGTYPE wpi_proto_ProtobufTranslation2d
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, front_left, 1) \
X(a, STATIC, SINGULAR, DOUBLE, front_right, 2) \
X(a, STATIC, SINGULAR, DOUBLE, rear_left, 3) \
X(a, STATIC, SINGULAR, DOUBLE, rear_right, 4)
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_CALLBACK NULL
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_DEFAULT NULL
#define wpi_proto_ProtobufMecanumDriveWheelPositions_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, front_left, 1) \
X(a, STATIC, SINGULAR, DOUBLE, front_right, 2) \
X(a, STATIC, SINGULAR, DOUBLE, rear_left, 3) \
X(a, STATIC, SINGULAR, DOUBLE, rear_right, 4)
#define wpi_proto_ProtobufMecanumDriveWheelPositions_CALLBACK NULL
#define wpi_proto_ProtobufMecanumDriveWheelPositions_DEFAULT NULL
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, front_left, 1) \
X(a, STATIC, SINGULAR, DOUBLE, front_right, 2) \
X(a, STATIC, SINGULAR, DOUBLE, rear_left, 3) \
X(a, STATIC, SINGULAR, DOUBLE, rear_right, 4)
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_CALLBACK NULL
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_DEFAULT NULL
#define wpi_proto_ProtobufSwerveDriveKinematics_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, MESSAGE, modules, 1)
#define wpi_proto_ProtobufSwerveDriveKinematics_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufSwerveDriveKinematics_DEFAULT NULL
#define wpi_proto_ProtobufSwerveDriveKinematics_modules_MSGTYPE wpi_proto_ProtobufTranslation2d
#define wpi_proto_ProtobufSwerveModulePosition_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, distance, 1) \
X(a, CALLBACK, OPTIONAL, MESSAGE, angle, 2)
#define wpi_proto_ProtobufSwerveModulePosition_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufSwerveModulePosition_DEFAULT NULL
#define wpi_proto_ProtobufSwerveModulePosition_angle_MSGTYPE wpi_proto_ProtobufRotation2d
#define wpi_proto_ProtobufSwerveModuleState_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, speed, 1) \
X(a, CALLBACK, OPTIONAL, MESSAGE, angle, 2)
#define wpi_proto_ProtobufSwerveModuleState_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufSwerveModuleState_DEFAULT NULL
#define wpi_proto_ProtobufSwerveModuleState_angle_MSGTYPE wpi_proto_ProtobufRotation2d
/* Maximum encoded size of messages (where known) */
/* wpi_proto_ProtobufMecanumDriveKinematics_size depends on runtime parameters */
/* wpi_proto_ProtobufSwerveDriveKinematics_size depends on runtime parameters */
/* wpi_proto_ProtobufSwerveModulePosition_size depends on runtime parameters */
/* wpi_proto_ProtobufSwerveModuleState_size depends on runtime parameters */
#define WPI_PROTO_KINEMATICS_NPB_H_MAX_SIZE wpi_proto_ProtobufMecanumDriveMotorVoltages_size
#define wpi_proto_ProtobufChassisSpeeds_size 27
#define wpi_proto_ProtobufDifferentialDriveKinematics_size 9
#define wpi_proto_ProtobufDifferentialDriveWheelPositions_size 18
#define wpi_proto_ProtobufDifferentialDriveWheelSpeeds_size 18
#define wpi_proto_ProtobufMecanumDriveMotorVoltages_size 36
#define wpi_proto_ProtobufMecanumDriveWheelPositions_size 36
#define wpi_proto_ProtobufMecanumDriveWheelSpeeds_size 36
#endif

View File

@@ -0,0 +1,93 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "plant.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x0b,0x70,0x6c,0x61,0x6e,0x74,0x2e,0x70,0x72,
0x6f,0x74,0x6f,0x12,0x09,0x77,0x70,0x69,0x2e,0x70,
0x72,0x6f,0x74,0x6f,0x22,0xc4,0x01,0x0a,0x0f,0x50,
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x44,0x43,0x4d,
0x6f,0x74,0x6f,0x72,0x12,0x27,0x0a,0x0f,0x6e,0x6f,
0x6d,0x69,0x6e,0x61,0x6c,0x5f,0x76,0x6f,0x6c,0x74,
0x61,0x67,0x65,0x18,0x01,0x20,0x01,0x28,0x01,0x52,
0x0e,0x6e,0x6f,0x6d,0x69,0x6e,0x61,0x6c,0x56,0x6f,
0x6c,0x74,0x61,0x67,0x65,0x12,0x21,0x0a,0x0c,0x73,
0x74,0x61,0x6c,0x6c,0x5f,0x74,0x6f,0x72,0x71,0x75,
0x65,0x18,0x02,0x20,0x01,0x28,0x01,0x52,0x0b,0x73,
0x74,0x61,0x6c,0x6c,0x54,0x6f,0x72,0x71,0x75,0x65,
0x12,0x23,0x0a,0x0d,0x73,0x74,0x61,0x6c,0x6c,0x5f,
0x63,0x75,0x72,0x72,0x65,0x6e,0x74,0x18,0x03,0x20,
0x01,0x28,0x01,0x52,0x0c,0x73,0x74,0x61,0x6c,0x6c,
0x43,0x75,0x72,0x72,0x65,0x6e,0x74,0x12,0x21,0x0a,
0x0c,0x66,0x72,0x65,0x65,0x5f,0x63,0x75,0x72,0x72,
0x65,0x6e,0x74,0x18,0x04,0x20,0x01,0x28,0x01,0x52,
0x0b,0x66,0x72,0x65,0x65,0x43,0x75,0x72,0x72,0x65,
0x6e,0x74,0x12,0x1d,0x0a,0x0a,0x66,0x72,0x65,0x65,
0x5f,0x73,0x70,0x65,0x65,0x64,0x18,0x05,0x20,0x01,
0x28,0x01,0x52,0x09,0x66,0x72,0x65,0x65,0x53,0x70,
0x65,0x65,0x64,0x42,0x1a,0x0a,0x18,0x65,0x64,0x75,
0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,0x72,0x73,0x74,
0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,0x72,0x6f,0x74,
0x6f,0x4a,0xdc,0x02,0x0a,0x06,0x12,0x04,0x00,0x00,
0x0c,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,0x03,0x00,
0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,0x03,0x02,
0x00,0x12,0x0a,0x08,0x0a,0x01,0x08,0x12,0x03,0x04,
0x00,0x31,0x0a,0x09,0x0a,0x02,0x08,0x01,0x12,0x03,
0x04,0x00,0x31,0x0a,0x0a,0x0a,0x02,0x04,0x00,0x12,
0x04,0x06,0x00,0x0c,0x01,0x0a,0x0a,0x0a,0x03,0x04,
0x00,0x01,0x12,0x03,0x06,0x08,0x17,0x0a,0x0b,0x0a,
0x04,0x04,0x00,0x02,0x00,0x12,0x03,0x07,0x02,0x1d,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x05,0x12,
0x03,0x07,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x00,0x01,0x12,0x03,0x07,0x09,0x18,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x00,0x03,0x12,0x03,0x07,
0x1b,0x1c,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x01,
0x12,0x03,0x08,0x02,0x1a,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x01,0x05,0x12,0x03,0x08,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x01,0x12,0x03,
0x08,0x09,0x15,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x01,0x03,0x12,0x03,0x08,0x18,0x19,0x0a,0x0b,0x0a,
0x04,0x04,0x00,0x02,0x02,0x12,0x03,0x09,0x02,0x1b,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x05,0x12,
0x03,0x09,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x02,0x01,0x12,0x03,0x09,0x09,0x16,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x02,0x03,0x12,0x03,0x09,
0x19,0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x03,
0x12,0x03,0x0a,0x02,0x1a,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x03,0x05,0x12,0x03,0x0a,0x02,0x08,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x01,0x12,0x03,
0x0a,0x09,0x15,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x03,0x03,0x12,0x03,0x0a,0x18,0x19,0x0a,0x0b,0x0a,
0x04,0x04,0x00,0x02,0x04,0x12,0x03,0x0b,0x02,0x18,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x04,0x05,0x12,
0x03,0x0b,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x04,0x01,0x12,0x03,0x0b,0x09,0x13,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x04,0x03,0x12,0x03,0x0b,
0x16,0x17,0x62,0x06,0x70,0x72,0x6f,0x74,0x6f,0x33,
};
static const char file_name[] = "plant.proto";
static const char wpi_proto_ProtobufDCMotor_name[] = "wpi.proto.ProtobufDCMotor";
std::string_view wpi_proto_ProtobufDCMotor::msg_name(void) noexcept { return wpi_proto_ProtobufDCMotor_name; }
pb_filedesc_t wpi_proto_ProtobufDCMotor::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufDCMotor, wpi_proto_ProtobufDCMotor, AUTO)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -0,0 +1,57 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_PLANT_NPB_H_INCLUDED
#define PB_WPI_PROTO_PLANT_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufDCMotor {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double nominal_voltage;
double stall_torque;
double stall_current;
double free_current;
double free_speed;
} wpi_proto_ProtobufDCMotor;
/* Initializer values for message structs */
#define wpi_proto_ProtobufDCMotor_init_default {0, 0, 0, 0, 0}
#define wpi_proto_ProtobufDCMotor_init_zero {0, 0, 0, 0, 0}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufDCMotor_nominal_voltage_tag 1
#define wpi_proto_ProtobufDCMotor_stall_torque_tag 2
#define wpi_proto_ProtobufDCMotor_stall_current_tag 3
#define wpi_proto_ProtobufDCMotor_free_current_tag 4
#define wpi_proto_ProtobufDCMotor_free_speed_tag 5
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufDCMotor_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, nominal_voltage, 1) \
X(a, STATIC, SINGULAR, DOUBLE, stall_torque, 2) \
X(a, STATIC, SINGULAR, DOUBLE, stall_current, 3) \
X(a, STATIC, SINGULAR, DOUBLE, free_current, 4) \
X(a, STATIC, SINGULAR, DOUBLE, free_speed, 5)
#define wpi_proto_ProtobufDCMotor_CALLBACK NULL
#define wpi_proto_ProtobufDCMotor_DEFAULT NULL
/* Maximum encoded size of messages (where known) */
#define WPI_PROTO_PLANT_NPB_H_MAX_SIZE wpi_proto_ProtobufDCMotor_size
#define wpi_proto_ProtobufDCMotor_size 45
#endif

View File

@@ -0,0 +1,137 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "spline.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x0c,0x73,0x70,0x6c,0x69,0x6e,0x65,0x2e,0x70,
0x72,0x6f,0x74,0x6f,0x12,0x09,0x77,0x70,0x69,0x2e,
0x70,0x72,0x6f,0x74,0x6f,0x22,0x88,0x01,0x0a,0x1a,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x43,0x75,
0x62,0x69,0x63,0x48,0x65,0x72,0x6d,0x69,0x74,0x65,
0x53,0x70,0x6c,0x69,0x6e,0x65,0x12,0x1b,0x0a,0x09,
0x78,0x5f,0x69,0x6e,0x69,0x74,0x69,0x61,0x6c,0x18,
0x01,0x20,0x03,0x28,0x01,0x52,0x08,0x78,0x49,0x6e,
0x69,0x74,0x69,0x61,0x6c,0x12,0x17,0x0a,0x07,0x78,
0x5f,0x66,0x69,0x6e,0x61,0x6c,0x18,0x02,0x20,0x03,
0x28,0x01,0x52,0x06,0x78,0x46,0x69,0x6e,0x61,0x6c,
0x12,0x1b,0x0a,0x09,0x79,0x5f,0x69,0x6e,0x69,0x74,
0x69,0x61,0x6c,0x18,0x03,0x20,0x03,0x28,0x01,0x52,
0x08,0x79,0x49,0x6e,0x69,0x74,0x69,0x61,0x6c,0x12,
0x17,0x0a,0x07,0x79,0x5f,0x66,0x69,0x6e,0x61,0x6c,
0x18,0x04,0x20,0x03,0x28,0x01,0x52,0x06,0x79,0x46,
0x69,0x6e,0x61,0x6c,0x22,0x8a,0x01,0x0a,0x1c,0x50,
0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x51,0x75,0x69,
0x6e,0x74,0x69,0x63,0x48,0x65,0x72,0x6d,0x69,0x74,
0x65,0x53,0x70,0x6c,0x69,0x6e,0x65,0x12,0x1b,0x0a,
0x09,0x78,0x5f,0x69,0x6e,0x69,0x74,0x69,0x61,0x6c,
0x18,0x01,0x20,0x03,0x28,0x01,0x52,0x08,0x78,0x49,
0x6e,0x69,0x74,0x69,0x61,0x6c,0x12,0x17,0x0a,0x07,
0x78,0x5f,0x66,0x69,0x6e,0x61,0x6c,0x18,0x02,0x20,
0x03,0x28,0x01,0x52,0x06,0x78,0x46,0x69,0x6e,0x61,
0x6c,0x12,0x1b,0x0a,0x09,0x79,0x5f,0x69,0x6e,0x69,
0x74,0x69,0x61,0x6c,0x18,0x03,0x20,0x03,0x28,0x01,
0x52,0x08,0x79,0x49,0x6e,0x69,0x74,0x69,0x61,0x6c,
0x12,0x17,0x0a,0x07,0x79,0x5f,0x66,0x69,0x6e,0x61,
0x6c,0x18,0x04,0x20,0x03,0x28,0x01,0x52,0x06,0x79,
0x46,0x69,0x6e,0x61,0x6c,0x42,0x1a,0x0a,0x18,0x65,
0x64,0x75,0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,0x72,
0x73,0x74,0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,0x72,
0x6f,0x74,0x6f,0x4a,0x89,0x05,0x0a,0x06,0x12,0x04,
0x00,0x00,0x12,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,
0x03,0x00,0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,
0x03,0x02,0x00,0x12,0x0a,0x08,0x0a,0x01,0x08,0x12,
0x03,0x04,0x00,0x31,0x0a,0x09,0x0a,0x02,0x08,0x01,
0x12,0x03,0x04,0x00,0x31,0x0a,0x0a,0x0a,0x02,0x04,
0x00,0x12,0x04,0x06,0x00,0x0b,0x01,0x0a,0x0a,0x0a,
0x03,0x04,0x00,0x01,0x12,0x03,0x06,0x08,0x22,0x0a,
0x0b,0x0a,0x04,0x04,0x00,0x02,0x00,0x12,0x03,0x07,
0x02,0x20,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,
0x04,0x12,0x03,0x07,0x02,0x0a,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x00,0x05,0x12,0x03,0x07,0x0b,0x11,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x01,0x12,
0x03,0x07,0x12,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x00,0x03,0x12,0x03,0x07,0x1e,0x1f,0x0a,0x0b,
0x0a,0x04,0x04,0x00,0x02,0x01,0x12,0x03,0x08,0x02,
0x1e,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x04,
0x12,0x03,0x08,0x02,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x01,0x05,0x12,0x03,0x08,0x0b,0x11,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x01,0x12,0x03,
0x08,0x12,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x01,0x03,0x12,0x03,0x08,0x1c,0x1d,0x0a,0x0b,0x0a,
0x04,0x04,0x00,0x02,0x02,0x12,0x03,0x09,0x02,0x20,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x04,0x12,
0x03,0x09,0x02,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x02,0x05,0x12,0x03,0x09,0x0b,0x11,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x02,0x01,0x12,0x03,0x09,
0x12,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,
0x03,0x12,0x03,0x09,0x1e,0x1f,0x0a,0x0b,0x0a,0x04,
0x04,0x00,0x02,0x03,0x12,0x03,0x0a,0x02,0x1e,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x04,0x12,0x03,
0x0a,0x02,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x03,0x05,0x12,0x03,0x0a,0x0b,0x11,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x03,0x01,0x12,0x03,0x0a,0x12,
0x19,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x03,
0x12,0x03,0x0a,0x1c,0x1d,0x0a,0x0a,0x0a,0x02,0x04,
0x01,0x12,0x04,0x0d,0x00,0x12,0x01,0x0a,0x0a,0x0a,
0x03,0x04,0x01,0x01,0x12,0x03,0x0d,0x08,0x24,0x0a,
0x0b,0x0a,0x04,0x04,0x01,0x02,0x00,0x12,0x03,0x0e,
0x02,0x20,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,
0x04,0x12,0x03,0x0e,0x02,0x0a,0x0a,0x0c,0x0a,0x05,
0x04,0x01,0x02,0x00,0x05,0x12,0x03,0x0e,0x0b,0x11,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x01,0x12,
0x03,0x0e,0x12,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x00,0x03,0x12,0x03,0x0e,0x1e,0x1f,0x0a,0x0b,
0x0a,0x04,0x04,0x01,0x02,0x01,0x12,0x03,0x0f,0x02,
0x1e,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x01,0x04,
0x12,0x03,0x0f,0x02,0x0a,0x0a,0x0c,0x0a,0x05,0x04,
0x01,0x02,0x01,0x05,0x12,0x03,0x0f,0x0b,0x11,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x01,0x01,0x12,0x03,
0x0f,0x12,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x01,0x03,0x12,0x03,0x0f,0x1c,0x1d,0x0a,0x0b,0x0a,
0x04,0x04,0x01,0x02,0x02,0x12,0x03,0x10,0x02,0x20,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x04,0x12,
0x03,0x10,0x02,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x02,0x05,0x12,0x03,0x10,0x0b,0x11,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x02,0x01,0x12,0x03,0x10,
0x12,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,
0x03,0x12,0x03,0x10,0x1e,0x1f,0x0a,0x0b,0x0a,0x04,
0x04,0x01,0x02,0x03,0x12,0x03,0x11,0x02,0x1e,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x03,0x04,0x12,0x03,
0x11,0x02,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x03,0x05,0x12,0x03,0x11,0x0b,0x11,0x0a,0x0c,0x0a,
0x05,0x04,0x01,0x02,0x03,0x01,0x12,0x03,0x11,0x12,
0x19,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x03,0x03,
0x12,0x03,0x11,0x1c,0x1d,0x62,0x06,0x70,0x72,0x6f,
0x74,0x6f,0x33,
};
static const char file_name[] = "spline.proto";
static const char wpi_proto_ProtobufCubicHermiteSpline_name[] = "wpi.proto.ProtobufCubicHermiteSpline";
std::string_view wpi_proto_ProtobufCubicHermiteSpline::msg_name(void) noexcept { return wpi_proto_ProtobufCubicHermiteSpline_name; }
pb_filedesc_t wpi_proto_ProtobufCubicHermiteSpline::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufCubicHermiteSpline, wpi_proto_ProtobufCubicHermiteSpline, AUTO)
static const char wpi_proto_ProtobufQuinticHermiteSpline_name[] = "wpi.proto.ProtobufQuinticHermiteSpline";
std::string_view wpi_proto_ProtobufQuinticHermiteSpline::msg_name(void) noexcept { return wpi_proto_ProtobufQuinticHermiteSpline_name; }
pb_filedesc_t wpi_proto_ProtobufQuinticHermiteSpline::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufQuinticHermiteSpline, wpi_proto_ProtobufQuinticHermiteSpline, AUTO)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -0,0 +1,79 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_SPLINE_NPB_H_INCLUDED
#define PB_WPI_PROTO_SPLINE_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufCubicHermiteSpline {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t x_initial;
pb_callback_t x_final;
pb_callback_t y_initial;
pb_callback_t y_final;
} wpi_proto_ProtobufCubicHermiteSpline;
typedef struct _wpi_proto_ProtobufQuinticHermiteSpline {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t x_initial;
pb_callback_t x_final;
pb_callback_t y_initial;
pb_callback_t y_final;
} wpi_proto_ProtobufQuinticHermiteSpline;
/* Initializer values for message structs */
#define wpi_proto_ProtobufCubicHermiteSpline_init_default {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufQuinticHermiteSpline_init_default {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufCubicHermiteSpline_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufQuinticHermiteSpline_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufCubicHermiteSpline_x_initial_tag 1
#define wpi_proto_ProtobufCubicHermiteSpline_x_final_tag 2
#define wpi_proto_ProtobufCubicHermiteSpline_y_initial_tag 3
#define wpi_proto_ProtobufCubicHermiteSpline_y_final_tag 4
#define wpi_proto_ProtobufQuinticHermiteSpline_x_initial_tag 1
#define wpi_proto_ProtobufQuinticHermiteSpline_x_final_tag 2
#define wpi_proto_ProtobufQuinticHermiteSpline_y_initial_tag 3
#define wpi_proto_ProtobufQuinticHermiteSpline_y_final_tag 4
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufCubicHermiteSpline_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, DOUBLE, x_initial, 1) \
X(a, CALLBACK, REPEATED, DOUBLE, x_final, 2) \
X(a, CALLBACK, REPEATED, DOUBLE, y_initial, 3) \
X(a, CALLBACK, REPEATED, DOUBLE, y_final, 4)
#define wpi_proto_ProtobufCubicHermiteSpline_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufCubicHermiteSpline_DEFAULT NULL
#define wpi_proto_ProtobufQuinticHermiteSpline_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, DOUBLE, x_initial, 1) \
X(a, CALLBACK, REPEATED, DOUBLE, x_final, 2) \
X(a, CALLBACK, REPEATED, DOUBLE, y_initial, 3) \
X(a, CALLBACK, REPEATED, DOUBLE, y_final, 4)
#define wpi_proto_ProtobufQuinticHermiteSpline_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufQuinticHermiteSpline_DEFAULT NULL
/* Maximum encoded size of messages (where known) */
/* wpi_proto_ProtobufCubicHermiteSpline_size depends on runtime parameters */
/* wpi_proto_ProtobufQuinticHermiteSpline_size depends on runtime parameters */
#endif

View File

@@ -0,0 +1,107 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "system.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x0c,0x73,0x79,0x73,0x74,0x65,0x6d,0x2e,0x70,
0x72,0x6f,0x74,0x6f,0x12,0x09,0x77,0x70,0x69,0x2e,
0x70,0x72,0x6f,0x74,0x6f,0x1a,0x0d,0x77,0x70,0x69,
0x6d,0x61,0x74,0x68,0x2e,0x70,0x72,0x6f,0x74,0x6f,
0x22,0x99,0x02,0x0a,0x14,0x50,0x72,0x6f,0x74,0x6f,
0x62,0x75,0x66,0x4c,0x69,0x6e,0x65,0x61,0x72,0x53,
0x79,0x73,0x74,0x65,0x6d,0x12,0x1d,0x0a,0x0a,0x6e,
0x75,0x6d,0x5f,0x73,0x74,0x61,0x74,0x65,0x73,0x18,
0x01,0x20,0x01,0x28,0x0d,0x52,0x09,0x6e,0x75,0x6d,
0x53,0x74,0x61,0x74,0x65,0x73,0x12,0x1d,0x0a,0x0a,
0x6e,0x75,0x6d,0x5f,0x69,0x6e,0x70,0x75,0x74,0x73,
0x18,0x02,0x20,0x01,0x28,0x0d,0x52,0x09,0x6e,0x75,
0x6d,0x49,0x6e,0x70,0x75,0x74,0x73,0x12,0x1f,0x0a,
0x0b,0x6e,0x75,0x6d,0x5f,0x6f,0x75,0x74,0x70,0x75,
0x74,0x73,0x18,0x03,0x20,0x01,0x28,0x0d,0x52,0x0a,
0x6e,0x75,0x6d,0x4f,0x75,0x74,0x70,0x75,0x74,0x73,
0x12,0x27,0x0a,0x01,0x61,0x18,0x04,0x20,0x01,0x28,
0x0b,0x32,0x19,0x2e,0x77,0x70,0x69,0x2e,0x70,0x72,
0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,0x62,
0x75,0x66,0x4d,0x61,0x74,0x72,0x69,0x78,0x52,0x01,
0x61,0x12,0x27,0x0a,0x01,0x62,0x18,0x05,0x20,0x01,
0x28,0x0b,0x32,0x19,0x2e,0x77,0x70,0x69,0x2e,0x70,
0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,0x6f,
0x62,0x75,0x66,0x4d,0x61,0x74,0x72,0x69,0x78,0x52,
0x01,0x62,0x12,0x27,0x0a,0x01,0x63,0x18,0x06,0x20,
0x01,0x28,0x0b,0x32,0x19,0x2e,0x77,0x70,0x69,0x2e,
0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,
0x6f,0x62,0x75,0x66,0x4d,0x61,0x74,0x72,0x69,0x78,
0x52,0x01,0x63,0x12,0x27,0x0a,0x01,0x64,0x18,0x07,
0x20,0x01,0x28,0x0b,0x32,0x19,0x2e,0x77,0x70,0x69,
0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,
0x74,0x6f,0x62,0x75,0x66,0x4d,0x61,0x74,0x72,0x69,
0x78,0x52,0x01,0x64,0x42,0x1a,0x0a,0x18,0x65,0x64,
0x75,0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,0x72,0x73,
0x74,0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,0x72,0x6f,
0x74,0x6f,0x4a,0xd5,0x03,0x0a,0x06,0x12,0x04,0x00,
0x00,0x10,0x01,0x0a,0x08,0x0a,0x01,0x0c,0x12,0x03,
0x00,0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,0x12,0x03,
0x02,0x00,0x12,0x0a,0x09,0x0a,0x02,0x03,0x00,0x12,
0x03,0x04,0x00,0x17,0x0a,0x08,0x0a,0x01,0x08,0x12,
0x03,0x06,0x00,0x31,0x0a,0x09,0x0a,0x02,0x08,0x01,
0x12,0x03,0x06,0x00,0x31,0x0a,0x0a,0x0a,0x02,0x04,
0x00,0x12,0x04,0x08,0x00,0x10,0x01,0x0a,0x0a,0x0a,
0x03,0x04,0x00,0x01,0x12,0x03,0x08,0x08,0x1c,0x0a,
0x0b,0x0a,0x04,0x04,0x00,0x02,0x00,0x12,0x03,0x09,
0x02,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,
0x05,0x12,0x03,0x09,0x02,0x08,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x00,0x01,0x12,0x03,0x09,0x09,0x13,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x03,0x12,
0x03,0x09,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,0x00,
0x02,0x01,0x12,0x03,0x0a,0x02,0x18,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x01,0x05,0x12,0x03,0x0a,0x02,
0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x01,
0x12,0x03,0x0a,0x09,0x13,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x01,0x03,0x12,0x03,0x0a,0x16,0x17,0x0a,
0x0b,0x0a,0x04,0x04,0x00,0x02,0x02,0x12,0x03,0x0b,
0x02,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,
0x05,0x12,0x03,0x0b,0x02,0x08,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x02,0x01,0x12,0x03,0x0b,0x09,0x14,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x03,0x12,
0x03,0x0b,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x00,
0x02,0x03,0x12,0x03,0x0c,0x02,0x17,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x03,0x06,0x12,0x03,0x0c,0x02,
0x10,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x01,
0x12,0x03,0x0c,0x11,0x12,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x03,0x03,0x12,0x03,0x0c,0x15,0x16,0x0a,
0x0b,0x0a,0x04,0x04,0x00,0x02,0x04,0x12,0x03,0x0d,
0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x04,
0x06,0x12,0x03,0x0d,0x02,0x10,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x04,0x01,0x12,0x03,0x0d,0x11,0x12,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x04,0x03,0x12,
0x03,0x0d,0x15,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x00,
0x02,0x05,0x12,0x03,0x0e,0x02,0x17,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x05,0x06,0x12,0x03,0x0e,0x02,
0x10,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x05,0x01,
0x12,0x03,0x0e,0x11,0x12,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x05,0x03,0x12,0x03,0x0e,0x15,0x16,0x0a,
0x0b,0x0a,0x04,0x04,0x00,0x02,0x06,0x12,0x03,0x0f,
0x02,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x06,
0x06,0x12,0x03,0x0f,0x02,0x10,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x06,0x01,0x12,0x03,0x0f,0x11,0x12,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x06,0x03,0x12,
0x03,0x0f,0x15,0x16,0x62,0x06,0x70,0x72,0x6f,0x74,
0x6f,0x33,
};
static const char file_name[] = "system.proto";
static const char wpi_proto_ProtobufLinearSystem_name[] = "wpi.proto.ProtobufLinearSystem";
std::string_view wpi_proto_ProtobufLinearSystem::msg_name(void) noexcept { return wpi_proto_ProtobufLinearSystem_name; }
pb_filedesc_t wpi_proto_ProtobufLinearSystem::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufLinearSystem, wpi_proto_ProtobufLinearSystem, AUTO)

View File

@@ -0,0 +1,67 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_SYSTEM_NPB_H_INCLUDED
#define PB_WPI_PROTO_SYSTEM_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#include "wpimath.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufLinearSystem {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
uint32_t num_states;
uint32_t num_inputs;
uint32_t num_outputs;
pb_callback_t a;
pb_callback_t b;
pb_callback_t c;
pb_callback_t d;
} wpi_proto_ProtobufLinearSystem;
/* Initializer values for message structs */
#define wpi_proto_ProtobufLinearSystem_init_default {0, 0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
#define wpi_proto_ProtobufLinearSystem_init_zero {0, 0, 0, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}, {{NULL}, NULL}}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufLinearSystem_num_states_tag 1
#define wpi_proto_ProtobufLinearSystem_num_inputs_tag 2
#define wpi_proto_ProtobufLinearSystem_num_outputs_tag 3
#define wpi_proto_ProtobufLinearSystem_a_tag 4
#define wpi_proto_ProtobufLinearSystem_b_tag 5
#define wpi_proto_ProtobufLinearSystem_c_tag 6
#define wpi_proto_ProtobufLinearSystem_d_tag 7
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufLinearSystem_FIELDLIST(X, a_) \
X(a_, STATIC, SINGULAR, UINT32, num_states, 1) \
X(a_, STATIC, SINGULAR, UINT32, num_inputs, 2) \
X(a_, STATIC, SINGULAR, UINT32, num_outputs, 3) \
X(a_, CALLBACK, OPTIONAL, MESSAGE, a, 4) \
X(a_, CALLBACK, OPTIONAL, MESSAGE, b, 5) \
X(a_, CALLBACK, OPTIONAL, MESSAGE, c, 6) \
X(a_, CALLBACK, OPTIONAL, MESSAGE, d, 7)
#define wpi_proto_ProtobufLinearSystem_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufLinearSystem_DEFAULT NULL
#define wpi_proto_ProtobufLinearSystem_a_MSGTYPE wpi_proto_ProtobufMatrix
#define wpi_proto_ProtobufLinearSystem_b_MSGTYPE wpi_proto_ProtobufMatrix
#define wpi_proto_ProtobufLinearSystem_c_MSGTYPE wpi_proto_ProtobufMatrix
#define wpi_proto_ProtobufLinearSystem_d_MSGTYPE wpi_proto_ProtobufMatrix
/* Maximum encoded size of messages (where known) */
/* wpi_proto_ProtobufLinearSystem_size depends on runtime parameters */
#endif

View File

@@ -0,0 +1,118 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "trajectory.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x10,0x74,0x72,0x61,0x6a,0x65,0x63,0x74,0x6f,
0x72,0x79,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,
0x77,0x70,0x69,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x1a,
0x10,0x67,0x65,0x6f,0x6d,0x65,0x74,0x72,0x79,0x32,
0x64,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,0xba,0x01,
0x0a,0x17,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,
0x54,0x72,0x61,0x6a,0x65,0x63,0x74,0x6f,0x72,0x79,
0x53,0x74,0x61,0x74,0x65,0x12,0x12,0x0a,0x04,0x74,
0x69,0x6d,0x65,0x18,0x01,0x20,0x01,0x28,0x01,0x52,
0x04,0x74,0x69,0x6d,0x65,0x12,0x1a,0x0a,0x08,0x76,
0x65,0x6c,0x6f,0x63,0x69,0x74,0x79,0x18,0x02,0x20,
0x01,0x28,0x01,0x52,0x08,0x76,0x65,0x6c,0x6f,0x63,
0x69,0x74,0x79,0x12,0x22,0x0a,0x0c,0x61,0x63,0x63,
0x65,0x6c,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e,0x18,
0x03,0x20,0x01,0x28,0x01,0x52,0x0c,0x61,0x63,0x63,
0x65,0x6c,0x65,0x72,0x61,0x74,0x69,0x6f,0x6e,0x12,
0x2d,0x0a,0x04,0x70,0x6f,0x73,0x65,0x18,0x04,0x20,
0x01,0x28,0x0b,0x32,0x19,0x2e,0x77,0x70,0x69,0x2e,
0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,0x74,
0x6f,0x62,0x75,0x66,0x50,0x6f,0x73,0x65,0x32,0x64,
0x52,0x04,0x70,0x6f,0x73,0x65,0x12,0x1c,0x0a,0x09,
0x63,0x75,0x72,0x76,0x61,0x74,0x75,0x72,0x65,0x18,
0x05,0x20,0x01,0x28,0x01,0x52,0x09,0x63,0x75,0x72,
0x76,0x61,0x74,0x75,0x72,0x65,0x22,0x50,0x0a,0x12,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x54,0x72,
0x61,0x6a,0x65,0x63,0x74,0x6f,0x72,0x79,0x12,0x3a,
0x0a,0x06,0x73,0x74,0x61,0x74,0x65,0x73,0x18,0x02,
0x20,0x03,0x28,0x0b,0x32,0x22,0x2e,0x77,0x70,0x69,
0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e,0x50,0x72,0x6f,
0x74,0x6f,0x62,0x75,0x66,0x54,0x72,0x61,0x6a,0x65,
0x63,0x74,0x6f,0x72,0x79,0x53,0x74,0x61,0x74,0x65,
0x52,0x06,0x73,0x74,0x61,0x74,0x65,0x73,0x42,0x1a,
0x0a,0x18,0x65,0x64,0x75,0x2e,0x77,0x70,0x69,0x2e,
0x66,0x69,0x72,0x73,0x74,0x2e,0x6d,0x61,0x74,0x68,
0x2e,0x70,0x72,0x6f,0x74,0x6f,0x4a,0xc4,0x03,0x0a,
0x06,0x12,0x04,0x00,0x00,0x12,0x01,0x0a,0x08,0x0a,
0x01,0x0c,0x12,0x03,0x00,0x00,0x12,0x0a,0x08,0x0a,
0x01,0x02,0x12,0x03,0x02,0x00,0x12,0x0a,0x09,0x0a,
0x02,0x03,0x00,0x12,0x03,0x04,0x00,0x1a,0x0a,0x08,
0x0a,0x01,0x08,0x12,0x03,0x06,0x00,0x31,0x0a,0x09,
0x0a,0x02,0x08,0x01,0x12,0x03,0x06,0x00,0x31,0x0a,
0x0a,0x0a,0x02,0x04,0x00,0x12,0x04,0x08,0x00,0x0e,
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x00,0x01,0x12,0x03,
0x08,0x08,0x1f,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,
0x00,0x12,0x03,0x09,0x02,0x12,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x00,0x05,0x12,0x03,0x09,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x01,0x12,
0x03,0x09,0x09,0x0d,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x00,0x03,0x12,0x03,0x09,0x10,0x11,0x0a,0x0b,
0x0a,0x04,0x04,0x00,0x02,0x01,0x12,0x03,0x0a,0x02,
0x16,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x05,
0x12,0x03,0x0a,0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x01,0x01,0x12,0x03,0x0a,0x09,0x11,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x03,0x12,0x03,
0x0a,0x14,0x15,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,
0x02,0x12,0x03,0x0b,0x02,0x1a,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x02,0x05,0x12,0x03,0x0b,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x01,0x12,
0x03,0x0b,0x09,0x15,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x02,0x03,0x12,0x03,0x0b,0x18,0x19,0x0a,0x0b,
0x0a,0x04,0x04,0x00,0x02,0x03,0x12,0x03,0x0c,0x02,
0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x06,
0x12,0x03,0x0c,0x02,0x10,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x03,0x01,0x12,0x03,0x0c,0x11,0x15,0x0a,
0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x03,0x12,0x03,
0x0c,0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,
0x04,0x12,0x03,0x0d,0x02,0x17,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x04,0x05,0x12,0x03,0x0d,0x02,0x08,
0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x04,0x01,0x12,
0x03,0x0d,0x09,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x00,
0x02,0x04,0x03,0x12,0x03,0x0d,0x15,0x16,0x0a,0x0a,
0x0a,0x02,0x04,0x01,0x12,0x04,0x10,0x00,0x12,0x01,
0x0a,0x0a,0x0a,0x03,0x04,0x01,0x01,0x12,0x03,0x10,
0x08,0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x00,
0x12,0x03,0x11,0x02,0x2e,0x0a,0x0c,0x0a,0x05,0x04,
0x01,0x02,0x00,0x04,0x12,0x03,0x11,0x02,0x0a,0x0a,
0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x06,0x12,0x03,
0x11,0x0b,0x22,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,
0x00,0x01,0x12,0x03,0x11,0x23,0x29,0x0a,0x0c,0x0a,
0x05,0x04,0x01,0x02,0x00,0x03,0x12,0x03,0x11,0x2c,
0x2d,0x62,0x06,0x70,0x72,0x6f,0x74,0x6f,0x33,
};
static const char file_name[] = "trajectory.proto";
static const char wpi_proto_ProtobufTrajectoryState_name[] = "wpi.proto.ProtobufTrajectoryState";
std::string_view wpi_proto_ProtobufTrajectoryState::msg_name(void) noexcept { return wpi_proto_ProtobufTrajectoryState_name; }
pb_filedesc_t wpi_proto_ProtobufTrajectoryState::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufTrajectoryState, wpi_proto_ProtobufTrajectoryState, AUTO)
static const char wpi_proto_ProtobufTrajectory_name[] = "wpi.proto.ProtobufTrajectory";
std::string_view wpi_proto_ProtobufTrajectory::msg_name(void) noexcept { return wpi_proto_ProtobufTrajectory_name; }
pb_filedesc_t wpi_proto_ProtobufTrajectory::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufTrajectory, wpi_proto_ProtobufTrajectory, AUTO)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -0,0 +1,76 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_TRAJECTORY_NPB_H_INCLUDED
#define PB_WPI_PROTO_TRAJECTORY_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#include "geometry2d.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufTrajectoryState {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
double time;
double velocity;
double acceleration;
pb_callback_t pose;
double curvature;
} wpi_proto_ProtobufTrajectoryState;
typedef struct _wpi_proto_ProtobufTrajectory {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t states;
} wpi_proto_ProtobufTrajectory;
/* Initializer values for message structs */
#define wpi_proto_ProtobufTrajectoryState_init_default {0, 0, 0, {{NULL}, NULL}, 0}
#define wpi_proto_ProtobufTrajectory_init_default {{{NULL}, NULL}}
#define wpi_proto_ProtobufTrajectoryState_init_zero {0, 0, 0, {{NULL}, NULL}, 0}
#define wpi_proto_ProtobufTrajectory_init_zero {{{NULL}, NULL}}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufTrajectoryState_time_tag 1
#define wpi_proto_ProtobufTrajectoryState_velocity_tag 2
#define wpi_proto_ProtobufTrajectoryState_acceleration_tag 3
#define wpi_proto_ProtobufTrajectoryState_pose_tag 4
#define wpi_proto_ProtobufTrajectoryState_curvature_tag 5
#define wpi_proto_ProtobufTrajectory_states_tag 2
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufTrajectoryState_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, DOUBLE, time, 1) \
X(a, STATIC, SINGULAR, DOUBLE, velocity, 2) \
X(a, STATIC, SINGULAR, DOUBLE, acceleration, 3) \
X(a, CALLBACK, OPTIONAL, MESSAGE, pose, 4) \
X(a, STATIC, SINGULAR, DOUBLE, curvature, 5)
#define wpi_proto_ProtobufTrajectoryState_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufTrajectoryState_DEFAULT NULL
#define wpi_proto_ProtobufTrajectoryState_pose_MSGTYPE wpi_proto_ProtobufPose2d
#define wpi_proto_ProtobufTrajectory_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, MESSAGE, states, 2)
#define wpi_proto_ProtobufTrajectory_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufTrajectory_DEFAULT NULL
#define wpi_proto_ProtobufTrajectory_states_MSGTYPE wpi_proto_ProtobufTrajectoryState
/* Maximum encoded size of messages (where known) */
/* wpi_proto_ProtobufTrajectoryState_size depends on runtime parameters */
/* wpi_proto_ProtobufTrajectory_size depends on runtime parameters */
#endif

View File

@@ -0,0 +1,92 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb constant definitions */
/* Generated by nanopb-0.4.9 */
#include "wpimath.npb.h"
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
#include <span>
#include <string_view>
static const uint8_t file_descriptor[] {
0x0a,0x0d,0x77,0x70,0x69,0x6d,0x61,0x74,0x68,0x2e,
0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,0x77,0x70,0x69,
0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,0x5a,0x0a,0x0e,
0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4d,0x61,
0x74,0x72,0x69,0x78,0x12,0x19,0x0a,0x08,0x6e,0x75,
0x6d,0x5f,0x72,0x6f,0x77,0x73,0x18,0x01,0x20,0x01,
0x28,0x0d,0x52,0x07,0x6e,0x75,0x6d,0x52,0x6f,0x77,
0x73,0x12,0x19,0x0a,0x08,0x6e,0x75,0x6d,0x5f,0x63,
0x6f,0x6c,0x73,0x18,0x02,0x20,0x01,0x28,0x0d,0x52,
0x07,0x6e,0x75,0x6d,0x43,0x6f,0x6c,0x73,0x12,0x12,
0x0a,0x04,0x64,0x61,0x74,0x61,0x18,0x03,0x20,0x03,
0x28,0x01,0x52,0x04,0x64,0x61,0x74,0x61,0x22,0x24,
0x0a,0x0e,0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,
0x56,0x65,0x63,0x74,0x6f,0x72,0x12,0x12,0x0a,0x04,
0x72,0x6f,0x77,0x73,0x18,0x01,0x20,0x03,0x28,0x01,
0x52,0x04,0x72,0x6f,0x77,0x73,0x42,0x1a,0x0a,0x18,
0x65,0x64,0x75,0x2e,0x77,0x70,0x69,0x2e,0x66,0x69,
0x72,0x73,0x74,0x2e,0x6d,0x61,0x74,0x68,0x2e,0x70,
0x72,0x6f,0x74,0x6f,0x4a,0xd9,0x02,0x0a,0x06,0x12,
0x04,0x00,0x00,0x0e,0x01,0x0a,0x08,0x0a,0x01,0x0c,
0x12,0x03,0x00,0x00,0x12,0x0a,0x08,0x0a,0x01,0x02,
0x12,0x03,0x02,0x00,0x12,0x0a,0x08,0x0a,0x01,0x08,
0x12,0x03,0x04,0x00,0x31,0x0a,0x09,0x0a,0x02,0x08,
0x01,0x12,0x03,0x04,0x00,0x31,0x0a,0x0a,0x0a,0x02,
0x04,0x00,0x12,0x04,0x06,0x00,0x0a,0x01,0x0a,0x0a,
0x0a,0x03,0x04,0x00,0x01,0x12,0x03,0x06,0x08,0x16,
0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x00,0x12,0x03,
0x07,0x02,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x00,0x05,0x12,0x03,0x07,0x02,0x08,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x00,0x01,0x12,0x03,0x07,0x09,
0x11,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x03,
0x12,0x03,0x07,0x14,0x15,0x0a,0x0b,0x0a,0x04,0x04,
0x00,0x02,0x01,0x12,0x03,0x08,0x02,0x16,0x0a,0x0c,
0x0a,0x05,0x04,0x00,0x02,0x01,0x05,0x12,0x03,0x08,
0x02,0x08,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,
0x01,0x12,0x03,0x08,0x09,0x11,0x0a,0x0c,0x0a,0x05,
0x04,0x00,0x02,0x01,0x03,0x12,0x03,0x08,0x14,0x15,
0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02,0x02,0x12,0x03,
0x09,0x02,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,
0x02,0x04,0x12,0x03,0x09,0x02,0x0a,0x0a,0x0c,0x0a,
0x05,0x04,0x00,0x02,0x02,0x05,0x12,0x03,0x09,0x0b,
0x11,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x01,
0x12,0x03,0x09,0x12,0x16,0x0a,0x0c,0x0a,0x05,0x04,
0x00,0x02,0x02,0x03,0x12,0x03,0x09,0x19,0x1a,0x0a,
0x0a,0x0a,0x02,0x04,0x01,0x12,0x04,0x0c,0x00,0x0e,
0x01,0x0a,0x0a,0x0a,0x03,0x04,0x01,0x01,0x12,0x03,
0x0c,0x08,0x16,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,
0x00,0x12,0x03,0x0d,0x02,0x1b,0x0a,0x0c,0x0a,0x05,
0x04,0x01,0x02,0x00,0x04,0x12,0x03,0x0d,0x02,0x0a,
0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x05,0x12,
0x03,0x0d,0x0b,0x11,0x0a,0x0c,0x0a,0x05,0x04,0x01,
0x02,0x00,0x01,0x12,0x03,0x0d,0x12,0x16,0x0a,0x0c,
0x0a,0x05,0x04,0x01,0x02,0x00,0x03,0x12,0x03,0x0d,
0x19,0x1a,0x62,0x06,0x70,0x72,0x6f,0x74,0x6f,0x33,
};
static const char file_name[] = "wpimath.proto";
static const char wpi_proto_ProtobufMatrix_name[] = "wpi.proto.ProtobufMatrix";
std::string_view wpi_proto_ProtobufMatrix::msg_name(void) noexcept { return wpi_proto_ProtobufMatrix_name; }
pb_filedesc_t wpi_proto_ProtobufMatrix::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufMatrix, wpi_proto_ProtobufMatrix, AUTO)
static const char wpi_proto_ProtobufVector_name[] = "wpi.proto.ProtobufVector";
std::string_view wpi_proto_ProtobufVector::msg_name(void) noexcept { return wpi_proto_ProtobufVector_name; }
pb_filedesc_t wpi_proto_ProtobufVector::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; }
PB_BIND(wpi_proto_ProtobufVector, wpi_proto_ProtobufVector, AUTO)
#ifndef PB_CONVERT_DOUBLE_FLOAT
/* On some platforms (such as AVR), double is really float.
* To be able to encode/decode double on these platforms, you need.
* to define PB_CONVERT_DOUBLE_FLOAT in pb.h or compiler command line.
*/
PB_STATIC_ASSERT(sizeof(double) == 8, DOUBLE_MUST_BE_8_BYTES)
#endif

View File

@@ -0,0 +1,67 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
/* Automatically generated nanopb header */
/* Generated by nanopb-0.4.9 */
#ifndef PB_WPI_PROTO_WPIMATH_NPB_H_INCLUDED
#define PB_WPI_PROTO_WPIMATH_NPB_H_INCLUDED
#include <pb.h>
#include <span>
#include <string_view>
#if PB_PROTO_HEADER_VERSION != 40
#error Regenerate this file with the current version of nanopb generator.
#endif
/* Struct definitions */
typedef struct _wpi_proto_ProtobufMatrix {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
uint32_t num_rows;
uint32_t num_cols;
pb_callback_t data;
} wpi_proto_ProtobufMatrix;
typedef struct _wpi_proto_ProtobufVector {
static const pb_msgdesc_t* msg_descriptor(void) noexcept;
static std::string_view msg_name(void) noexcept;
static pb_filedesc_t file_descriptor(void) noexcept;
pb_callback_t rows;
} wpi_proto_ProtobufVector;
/* Initializer values for message structs */
#define wpi_proto_ProtobufMatrix_init_default {0, 0, {{NULL}, NULL}}
#define wpi_proto_ProtobufVector_init_default {{{NULL}, NULL}}
#define wpi_proto_ProtobufMatrix_init_zero {0, 0, {{NULL}, NULL}}
#define wpi_proto_ProtobufVector_init_zero {{{NULL}, NULL}}
/* Field tags (for use in manual encoding/decoding) */
#define wpi_proto_ProtobufMatrix_num_rows_tag 1
#define wpi_proto_ProtobufMatrix_num_cols_tag 2
#define wpi_proto_ProtobufMatrix_data_tag 3
#define wpi_proto_ProtobufVector_rows_tag 1
/* Struct field encoding specification for nanopb */
#define wpi_proto_ProtobufMatrix_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, UINT32, num_rows, 1) \
X(a, STATIC, SINGULAR, UINT32, num_cols, 2) \
X(a, CALLBACK, REPEATED, DOUBLE, data, 3)
#define wpi_proto_ProtobufMatrix_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufMatrix_DEFAULT NULL
#define wpi_proto_ProtobufVector_FIELDLIST(X, a) \
X(a, CALLBACK, REPEATED, DOUBLE, rows, 1)
#define wpi_proto_ProtobufVector_CALLBACK pb_default_field_callback
#define wpi_proto_ProtobufVector_DEFAULT NULL
/* Maximum encoded size of messages (where known) */
/* wpi_proto_ProtobufMatrix_size depends on runtime parameters */
/* wpi_proto_ProtobufVector_size depends on runtime parameters */
#endif

View File

@@ -4,31 +4,33 @@
#include "frc/controller/proto/ArmFeedforwardProto.h"
#include <wpi/ProtoHelper.h>
#include <optional>
#include "controller.pb.h"
#include "wpimath/protobuf/controller.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::ArmFeedforward>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufArmFeedforward>(arena);
}
std::optional<frc::ArmFeedforward> wpi::Protobuf<frc::ArmFeedforward>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufArmFeedforward msg;
if (!stream.Decode(msg)) {
return {};
}
frc::ArmFeedforward wpi::Protobuf<frc::ArmFeedforward>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufArmFeedforward*>(&msg);
return frc::ArmFeedforward{
units::volt_t{m->ks()},
units::volt_t{m->kg()},
units::unit_t<frc::ArmFeedforward::kv_unit>{m->kv()},
units::unit_t<frc::ArmFeedforward::ka_unit>{m->ka()},
units::volt_t{msg.ks},
units::volt_t{msg.kg},
units::unit_t<frc::ArmFeedforward::kv_unit>{msg.kv},
units::unit_t<frc::ArmFeedforward::ka_unit>{msg.ka},
};
}
void wpi::Protobuf<frc::ArmFeedforward>::Pack(
google::protobuf::Message* msg, const frc::ArmFeedforward& value) {
auto m = static_cast<wpi::proto::ProtobufArmFeedforward*>(msg);
m->set_ks(value.GetKs().value());
m->set_kg(value.GetKg().value());
m->set_kv(value.GetKv().value());
m->set_ka(value.GetKa().value());
bool wpi::Protobuf<frc::ArmFeedforward>::Pack(
OutputStream& stream, const frc::ArmFeedforward& value) {
wpi_proto_ProtobufArmFeedforward msg{
.ks = value.GetKs().value(),
.kg = value.GetKg().value(),
.kv = value.GetKv().value(),
.ka = value.GetKa().value(),
.dt = 0,
};
return stream.Encode(msg);
}

View File

@@ -4,33 +4,30 @@
#include "frc/controller/proto/DifferentialDriveFeedforwardProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/controller.npb.h"
#include "controller.pb.h"
std::optional<frc::DifferentialDriveFeedforward>
wpi::Protobuf<frc::DifferentialDriveFeedforward>::Unpack(InputStream& stream) {
wpi_proto_ProtobufDifferentialDriveFeedforward msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<
frc::DifferentialDriveFeedforward>::New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufDifferentialDriveFeedforward>(
arena);
return frc::DifferentialDriveFeedforward{
decltype(1_V / 1_mps){msg.kv_linear},
decltype(1_V / 1_mps_sq){msg.ka_linear},
decltype(1_V / 1_mps){msg.kv_angular},
decltype(1_V / 1_mps_sq){msg.ka_angular},
};
}
frc::DifferentialDriveFeedforward
wpi::Protobuf<frc::DifferentialDriveFeedforward>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufDifferentialDriveFeedforward*>(
&msg);
return {decltype(1_V / 1_mps){m->kv_linear()},
decltype(1_V / 1_mps_sq){m->ka_linear()},
decltype(1_V / 1_mps){m->kv_angular()},
decltype(1_V / 1_mps_sq){m->ka_angular()}};
}
void wpi::Protobuf<frc::DifferentialDriveFeedforward>::Pack(
google::protobuf::Message* msg,
const frc::DifferentialDriveFeedforward& value) {
auto m = static_cast<wpi::proto::ProtobufDifferentialDriveFeedforward*>(msg);
m->set_kv_linear(value.m_kVLinear.value());
m->set_ka_linear(value.m_kALinear.value());
m->set_kv_angular(value.m_kVAngular.value());
m->set_ka_angular(value.m_kAAngular.value());
bool wpi::Protobuf<frc::DifferentialDriveFeedforward>::Pack(
OutputStream& stream, const frc::DifferentialDriveFeedforward& value) {
wpi_proto_ProtobufDifferentialDriveFeedforward msg{
.kv_linear = value.m_kVLinear.value(),
.ka_linear = value.m_kALinear.value(),
.kv_angular = value.m_kVAngular.value(),
.ka_angular = value.m_kAAngular.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,33 +4,28 @@
#include "frc/controller/proto/DifferentialDriveWheelVoltagesProto.h"
#include <wpi/ProtoHelper.h>
#include <optional>
#include "controller.pb.h"
#include "wpimath/protobuf/controller.npb.h"
google::protobuf::Message* wpi::Protobuf<
frc::DifferentialDriveWheelVoltages>::New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufDifferentialDriveWheelVoltages>(
arena);
}
std::optional<frc::DifferentialDriveWheelVoltages> wpi::Protobuf<
frc::DifferentialDriveWheelVoltages>::Unpack(InputStream& stream) {
wpi_proto_ProtobufDifferentialDriveWheelVoltages msg;
if (!stream.Decode(msg)) {
return {};
}
frc::DifferentialDriveWheelVoltages
wpi::Protobuf<frc::DifferentialDriveWheelVoltages>::Unpack(
const google::protobuf::Message& msg) {
auto m =
static_cast<const wpi::proto::ProtobufDifferentialDriveWheelVoltages*>(
&msg);
return frc::DifferentialDriveWheelVoltages{
units::volt_t{m->left()},
units::volt_t{m->right()},
units::volt_t{msg.left},
units::volt_t{msg.right},
};
}
void wpi::Protobuf<frc::DifferentialDriveWheelVoltages>::Pack(
google::protobuf::Message* msg,
const frc::DifferentialDriveWheelVoltages& value) {
auto m =
static_cast<wpi::proto::ProtobufDifferentialDriveWheelVoltages*>(msg);
m->set_left(value.left.value());
m->set_right(value.right.value());
bool wpi::Protobuf<frc::DifferentialDriveWheelVoltages>::Pack(
OutputStream& stream, const frc::DifferentialDriveWheelVoltages& value) {
wpi_proto_ProtobufDifferentialDriveWheelVoltages msg{
.left = value.left.value(),
.right = value.right.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,31 +4,33 @@
#include "frc/controller/proto/ElevatorFeedforwardProto.h"
#include <wpi/ProtoHelper.h>
#include <optional>
#include "controller.pb.h"
#include "wpimath/protobuf/controller.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::ElevatorFeedforward>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufElevatorFeedforward>(arena);
}
std::optional<frc::ElevatorFeedforward>
wpi::Protobuf<frc::ElevatorFeedforward>::Unpack(InputStream& stream) {
wpi_proto_ProtobufElevatorFeedforward msg;
if (!stream.Decode(msg)) {
return {};
}
frc::ElevatorFeedforward wpi::Protobuf<frc::ElevatorFeedforward>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufElevatorFeedforward*>(&msg);
return frc::ElevatorFeedforward{
units::volt_t{m->ks()},
units::volt_t{m->kg()},
units::unit_t<frc::ElevatorFeedforward::kv_unit>{m->kv()},
units::unit_t<frc::ElevatorFeedforward::ka_unit>{m->ka()},
units::volt_t{msg.ks},
units::volt_t{msg.kg},
units::unit_t<frc::ElevatorFeedforward::kv_unit>{msg.kv},
units::unit_t<frc::ElevatorFeedforward::ka_unit>{msg.ka},
};
}
void wpi::Protobuf<frc::ElevatorFeedforward>::Pack(
google::protobuf::Message* msg, const frc::ElevatorFeedforward& value) {
auto m = static_cast<wpi::proto::ProtobufElevatorFeedforward*>(msg);
m->set_ks(value.GetKs().value());
m->set_kg(value.GetKg().value());
m->set_kv(value.GetKv().value());
m->set_ka(value.GetKa().value());
bool wpi::Protobuf<frc::ElevatorFeedforward>::Pack(
OutputStream& stream, const frc::ElevatorFeedforward& value) {
wpi_proto_ProtobufElevatorFeedforward msg{
.ks = value.GetKs().value(),
.kg = value.GetKg().value(),
.kv = value.GetKv().value(),
.ka = value.GetKa().value(),
.dt = 0,
};
return stream.Encode(msg);
}

View File

@@ -4,29 +4,42 @@
#include "frc/geometry/proto/Ellipse2dProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "geometry2d.pb.h"
#include "wpimath/protobuf/geometry2d.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::Ellipse2d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufEllipse2d>(arena);
}
std::optional<frc::Ellipse2d> wpi::Protobuf<frc::Ellipse2d>::Unpack(
InputStream& stream) {
wpi::UnpackCallback<frc::Pose2d> pose;
wpi_proto_ProtobufEllipse2d msg{
.center = pose.Callback(),
.xSemiAxis = 0,
.ySemiAxis = 0,
};
if (!stream.Decode(msg)) {
return {};
}
auto ipose = pose.Items();
if (ipose.empty()) {
return {};
}
frc::Ellipse2d wpi::Protobuf<frc::Ellipse2d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufEllipse2d*>(&msg);
return frc::Ellipse2d{
wpi::UnpackProtobuf<frc::Pose2d>(m->wpi_center()),
units::meter_t{m->xsemiaxis()},
units::meter_t{m->ysemiaxis()},
ipose[0],
units::meter_t{msg.xSemiAxis},
units::meter_t{msg.ySemiAxis},
};
}
void wpi::Protobuf<frc::Ellipse2d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Ellipse2d>::Pack(OutputStream& stream,
const frc::Ellipse2d& value) {
auto m = static_cast<wpi::proto::ProtobufEllipse2d*>(msg);
wpi::PackProtobuf(m->mutable_center(), value.Center());
m->set_xsemiaxis(value.XSemiAxis().value());
m->set_ysemiaxis(value.YSemiAxis().value());
wpi::PackCallback pose{&value.Center()};
wpi_proto_ProtobufEllipse2d msg{
.center = pose.Callback(),
.xSemiAxis = value.XSemiAxis().value(),
.ySemiAxis = value.YSemiAxis().value(),
};
return stream.Encode(msg);
}

View File

@@ -4,27 +4,42 @@
#include "frc/geometry/proto/Pose2dProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "geometry2d.pb.h"
#include "wpimath/protobuf/geometry2d.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::Pose2d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufPose2d>(arena);
}
std::optional<frc::Pose2d> wpi::Protobuf<frc::Pose2d>::Unpack(
InputStream& stream) {
wpi::UnpackCallback<frc::Translation2d> tsln;
wpi::UnpackCallback<frc::Rotation2d> rot;
wpi_proto_ProtobufPose2d msg{
.translation = tsln.Callback(),
.rotation = rot.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
auto itsln = tsln.Items();
auto irot = rot.Items();
if (itsln.empty() || irot.empty()) {
return {};
}
frc::Pose2d wpi::Protobuf<frc::Pose2d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufPose2d*>(&msg);
return frc::Pose2d{
wpi::UnpackProtobuf<frc::Translation2d>(m->wpi_translation()),
wpi::UnpackProtobuf<frc::Rotation2d>(m->wpi_rotation()),
itsln[0],
irot[0],
};
}
void wpi::Protobuf<frc::Pose2d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Pose2d>::Pack(OutputStream& stream,
const frc::Pose2d& value) {
auto m = static_cast<wpi::proto::ProtobufPose2d*>(msg);
wpi::PackProtobuf(m->mutable_translation(), value.Translation());
wpi::PackProtobuf(m->mutable_rotation(), value.Rotation());
wpi::PackCallback tsln{&value.Translation()};
wpi::PackCallback rot{&value.Rotation()};
wpi_proto_ProtobufPose2d msg{
.translation = tsln.Callback(),
.rotation = rot.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,27 +4,44 @@
#include "frc/geometry/proto/Pose3dProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/Protobuf.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "geometry3d.pb.h"
#include "frc/geometry/Pose3d.h"
#include "wpimath/protobuf/geometry3d.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::Pose3d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufPose3d>(arena);
}
std::optional<frc::Pose3d> wpi::Protobuf<frc::Pose3d>::Unpack(
InputStream& stream) {
wpi::UnpackCallback<frc::Translation3d> tsln;
wpi::UnpackCallback<frc::Rotation3d> rot;
wpi_proto_ProtobufPose3d msg{
.translation = tsln.Callback(),
.rotation = rot.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
auto itsln = tsln.Items();
auto irot = rot.Items();
if (itsln.empty() || irot.empty()) {
return {};
}
frc::Pose3d wpi::Protobuf<frc::Pose3d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufPose3d*>(&msg);
return frc::Pose3d{
wpi::UnpackProtobuf<frc::Translation3d>(m->wpi_translation()),
wpi::UnpackProtobuf<frc::Rotation3d>(m->wpi_rotation()),
itsln[0],
irot[0],
};
}
void wpi::Protobuf<frc::Pose3d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Pose3d>::Pack(OutputStream& stream,
const frc::Pose3d& value) {
auto m = static_cast<wpi::proto::ProtobufPose3d*>(msg);
wpi::PackProtobuf(m->mutable_translation(), value.Translation());
wpi::PackProtobuf(m->mutable_rotation(), value.Rotation());
wpi::PackCallback tsln{&value.Translation()};
wpi::PackCallback rot{&value.Rotation()};
wpi_proto_ProtobufPose3d msg{
.translation = tsln.Callback(),
.rotation = rot.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,31 +4,30 @@
#include "frc/geometry/proto/QuaternionProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/geometry3d.npb.h"
#include "geometry3d.pb.h"
std::optional<frc::Quaternion> wpi::Protobuf<frc::Quaternion>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufQuaternion msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::Quaternion>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufQuaternion>(arena);
}
frc::Quaternion wpi::Protobuf<frc::Quaternion>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufQuaternion*>(&msg);
return frc::Quaternion{
m->w(),
m->x(),
m->y(),
m->z(),
msg.w,
msg.x,
msg.y,
msg.z,
};
}
void wpi::Protobuf<frc::Quaternion>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Quaternion>::Pack(OutputStream& stream,
const frc::Quaternion& value) {
auto m = static_cast<wpi::proto::ProtobufQuaternion*>(msg);
m->set_w(value.W());
m->set_x(value.X());
m->set_y(value.Y());
m->set_z(value.Z());
wpi_proto_ProtobufQuaternion msg{
.w = value.W(),
.x = value.X(),
.y = value.Y(),
.z = value.Z(),
};
return stream.Encode(msg);
}

View File

@@ -4,29 +4,42 @@
#include "frc/geometry/proto/Rectangle2dProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "geometry2d.pb.h"
#include "wpimath/protobuf/geometry2d.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::Rectangle2d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufRectangle2d>(arena);
}
std::optional<frc::Rectangle2d> wpi::Protobuf<frc::Rectangle2d>::Unpack(
InputStream& stream) {
wpi::UnpackCallback<frc::Pose2d> pose;
wpi_proto_ProtobufRectangle2d msg{
.center = pose.Callback(),
.xWidth = 0,
.yWidth = 0,
};
if (!stream.Decode(msg)) {
return {};
}
auto ipose = pose.Items();
if (ipose.empty()) {
return {};
}
frc::Rectangle2d wpi::Protobuf<frc::Rectangle2d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufRectangle2d*>(&msg);
return frc::Rectangle2d{
wpi::UnpackProtobuf<frc::Pose2d>(m->wpi_center()),
units::meter_t{m->xwidth()},
units::meter_t{m->ywidth()},
ipose[0],
units::meter_t{msg.xWidth},
units::meter_t{msg.yWidth},
};
}
void wpi::Protobuf<frc::Rectangle2d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Rectangle2d>::Pack(OutputStream& stream,
const frc::Rectangle2d& value) {
auto m = static_cast<wpi::proto::ProtobufRectangle2d*>(msg);
wpi::PackProtobuf(m->mutable_center(), value.Center());
m->set_xwidth(value.XWidth().value());
m->set_ywidth(value.YWidth().value());
wpi::PackCallback pose{&value.Center()};
wpi_proto_ProtobufRectangle2d msg{
.center = pose.Callback(),
.xWidth = value.XWidth().value(),
.yWidth = value.YWidth().value(),
};
return stream.Encode(msg);
}

View File

@@ -4,25 +4,24 @@
#include "frc/geometry/proto/Rotation2dProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/geometry2d.npb.h"
#include "geometry2d.pb.h"
std::optional<frc::Rotation2d> wpi::Protobuf<frc::Rotation2d>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufRotation2d msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::Rotation2d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufRotation2d>(arena);
}
frc::Rotation2d wpi::Protobuf<frc::Rotation2d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufRotation2d*>(&msg);
return frc::Rotation2d{
units::radian_t{m->value()},
units::radian_t{msg.value},
};
}
void wpi::Protobuf<frc::Rotation2d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Rotation2d>::Pack(OutputStream& stream,
const frc::Rotation2d& value) {
auto m = static_cast<wpi::proto::ProtobufRotation2d*>(msg);
m->set_value(value.Radians().value());
wpi_proto_ProtobufRotation2d msg{
.value = value.Radians().value(),
};
return stream.Encode(msg);
}

View File

@@ -4,25 +4,36 @@
#include "frc/geometry/proto/Rotation3dProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "geometry3d.pb.h"
#include "wpimath/protobuf/geometry3d.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::Rotation3d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufRotation3d>(arena);
}
std::optional<frc::Rotation3d> wpi::Protobuf<frc::Rotation3d>::Unpack(
InputStream& stream) {
wpi::UnpackCallback<frc::Quaternion> quat;
wpi_proto_ProtobufRotation3d msg{
.q = quat.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
auto iquat = quat.Items();
if (iquat.empty()) {
return {};
}
frc::Rotation3d wpi::Protobuf<frc::Rotation3d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufRotation3d*>(&msg);
return frc::Rotation3d{
wpi::UnpackProtobuf<frc::Quaternion>(m->wpi_q()),
iquat[0],
};
}
void wpi::Protobuf<frc::Rotation3d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Rotation3d>::Pack(OutputStream& stream,
const frc::Rotation3d& value) {
auto m = static_cast<wpi::proto::ProtobufRotation3d*>(msg);
wpi::PackProtobuf(m->mutable_q(), value.GetQuaternion());
wpi::PackCallback quat{&value.GetQuaternion()};
wpi_proto_ProtobufRotation3d msg{
.q = quat.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,27 +4,42 @@
#include "frc/geometry/proto/Transform2dProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "geometry2d.pb.h"
#include "wpimath/protobuf/geometry2d.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::Transform2d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufTransform2d>(arena);
}
std::optional<frc::Transform2d> wpi::Protobuf<frc::Transform2d>::Unpack(
InputStream& stream) {
wpi::UnpackCallback<frc::Translation2d> tsln;
wpi::UnpackCallback<frc::Rotation2d> rot;
wpi_proto_ProtobufTransform2d msg{
.translation = tsln.Callback(),
.rotation = rot.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
auto itsln = tsln.Items();
auto irot = rot.Items();
if (itsln.empty() || irot.empty()) {
return {};
}
frc::Transform2d wpi::Protobuf<frc::Transform2d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufTransform2d*>(&msg);
return frc::Transform2d{
wpi::UnpackProtobuf<frc::Translation2d>(m->wpi_translation()),
wpi::UnpackProtobuf<frc::Rotation2d>(m->wpi_rotation()),
itsln[0],
irot[0],
};
}
void wpi::Protobuf<frc::Transform2d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Transform2d>::Pack(OutputStream& stream,
const frc::Transform2d& value) {
auto m = static_cast<wpi::proto::ProtobufTransform2d*>(msg);
wpi::PackProtobuf(m->mutable_translation(), value.Translation());
wpi::PackProtobuf(m->mutable_rotation(), value.Rotation());
wpi::PackCallback tsln{&value.Translation()};
wpi::PackCallback rot{&value.Rotation()};
wpi_proto_ProtobufTransform2d msg{
.translation = tsln.Callback(),
.rotation = rot.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,27 +4,42 @@
#include "frc/geometry/proto/Transform3dProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "geometry3d.pb.h"
#include "wpimath/protobuf/geometry3d.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::Transform3d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufTransform3d>(arena);
}
std::optional<frc::Transform3d> wpi::Protobuf<frc::Transform3d>::Unpack(
InputStream& stream) {
wpi::UnpackCallback<frc::Translation3d> tsln;
wpi::UnpackCallback<frc::Rotation3d> rot;
wpi_proto_ProtobufTransform3d msg{
.translation = tsln.Callback(),
.rotation = rot.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
auto itsln = tsln.Items();
auto irot = rot.Items();
if (itsln.empty() || irot.empty()) {
return {};
}
frc::Transform3d wpi::Protobuf<frc::Transform3d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufTransform3d*>(&msg);
return frc::Transform3d{
wpi::UnpackProtobuf<frc::Translation3d>(m->wpi_translation()),
wpi::UnpackProtobuf<frc::Rotation3d>(m->wpi_rotation()),
itsln[0],
irot[0],
};
}
void wpi::Protobuf<frc::Transform3d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Transform3d>::Pack(OutputStream& stream,
const frc::Transform3d& value) {
auto m = static_cast<wpi::proto::ProtobufTransform3d*>(msg);
wpi::PackProtobuf(m->mutable_translation(), value.Translation());
wpi::PackProtobuf(m->mutable_rotation(), value.Rotation());
wpi::PackCallback tsln{&value.Translation()};
wpi::PackCallback rot{&value.Rotation()};
wpi_proto_ProtobufTransform3d msg{
.translation = tsln.Callback(),
.rotation = rot.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,27 +4,26 @@
#include "frc/geometry/proto/Translation2dProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/geometry2d.npb.h"
#include "geometry2d.pb.h"
std::optional<frc::Translation2d> wpi::Protobuf<frc::Translation2d>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufTranslation2d msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::Translation2d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufTranslation2d>(arena);
}
frc::Translation2d wpi::Protobuf<frc::Translation2d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufTranslation2d*>(&msg);
return frc::Translation2d{
units::meter_t{m->x()},
units::meter_t{m->y()},
units::meter_t{msg.x},
units::meter_t{msg.y},
};
}
void wpi::Protobuf<frc::Translation2d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Translation2d>::Pack(OutputStream& stream,
const frc::Translation2d& value) {
auto m = static_cast<wpi::proto::ProtobufTranslation2d*>(msg);
m->set_x(value.X().value());
m->set_y(value.Y().value());
wpi_proto_ProtobufTranslation2d msg{
.x = value.X().value(),
.y = value.Y().value(),
};
return stream.Encode(msg);
}

View File

@@ -4,29 +4,28 @@
#include "frc/geometry/proto/Translation3dProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/geometry3d.npb.h"
#include "geometry3d.pb.h"
std::optional<frc::Translation3d> wpi::Protobuf<frc::Translation3d>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufTranslation3d msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::Translation3d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufTranslation3d>(arena);
}
frc::Translation3d wpi::Protobuf<frc::Translation3d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufTranslation3d*>(&msg);
return frc::Translation3d{
units::meter_t{m->x()},
units::meter_t{m->y()},
units::meter_t{m->z()},
units::meter_t{msg.x},
units::meter_t{msg.y},
units::meter_t{msg.z},
};
}
void wpi::Protobuf<frc::Translation3d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Translation3d>::Pack(OutputStream& stream,
const frc::Translation3d& value) {
auto m = static_cast<wpi::proto::ProtobufTranslation3d*>(msg);
m->set_x(value.X().value());
m->set_y(value.Y().value());
m->set_z(value.Z().value());
wpi_proto_ProtobufTranslation3d msg{
.x = value.X().value(),
.y = value.Y().value(),
.z = value.Z().value(),
};
return stream.Encode(msg);
}

View File

@@ -4,29 +4,28 @@
#include "frc/geometry/proto/Twist2dProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/geometry2d.npb.h"
#include "geometry2d.pb.h"
std::optional<frc::Twist2d> wpi::Protobuf<frc::Twist2d>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufTwist2d msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::Twist2d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufTwist2d>(arena);
}
frc::Twist2d wpi::Protobuf<frc::Twist2d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufTwist2d*>(&msg);
return frc::Twist2d{
units::meter_t{m->dx()},
units::meter_t{m->dy()},
units::radian_t{m->dtheta()},
units::meter_t{msg.dx},
units::meter_t{msg.dy},
units::radian_t{msg.dtheta},
};
}
void wpi::Protobuf<frc::Twist2d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Twist2d>::Pack(OutputStream& stream,
const frc::Twist2d& value) {
auto m = static_cast<wpi::proto::ProtobufTwist2d*>(msg);
m->set_dx(value.dx.value());
m->set_dy(value.dy.value());
m->set_dtheta(value.dtheta.value());
wpi_proto_ProtobufTwist2d msg{
.dx = value.dx.value(),
.dy = value.dy.value(),
.dtheta = value.dtheta.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,32 +4,30 @@
#include "frc/geometry/proto/Twist3dProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/geometry3d.npb.h"
#include "geometry3d.pb.h"
std::optional<frc::Twist3d> wpi::Protobuf<frc::Twist3d>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufTwist3d msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::Twist3d>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufTwist3d>(arena);
}
frc::Twist3d wpi::Protobuf<frc::Twist3d>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufTwist3d*>(&msg);
return frc::Twist3d{
units::meter_t{m->dx()}, units::meter_t{m->dy()},
units::meter_t{m->dz()}, units::radian_t{m->rx()},
units::radian_t{m->ry()}, units::radian_t{m->rz()},
units::meter_t{msg.dx}, units::meter_t{msg.dy}, units::meter_t{msg.dz},
units::radian_t{msg.rx}, units::radian_t{msg.ry}, units::radian_t{msg.rz},
};
}
void wpi::Protobuf<frc::Twist3d>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Twist3d>::Pack(OutputStream& stream,
const frc::Twist3d& value) {
auto m = static_cast<wpi::proto::ProtobufTwist3d*>(msg);
m->set_dx(value.dx.value());
m->set_dy(value.dy.value());
m->set_dz(value.dz.value());
m->set_rx(value.rx.value());
m->set_ry(value.ry.value());
m->set_rz(value.rz.value());
wpi_proto_ProtobufTwist3d msg{
.dx = value.dx.value(),
.dy = value.dy.value(),
.dz = value.dz.value(),
.rx = value.rx.value(),
.ry = value.ry.value(),
.rz = value.rz.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,29 +4,28 @@
#include "frc/kinematics/proto/ChassisSpeedsProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/kinematics.npb.h"
#include "kinematics.pb.h"
std::optional<frc::ChassisSpeeds> wpi::Protobuf<frc::ChassisSpeeds>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufChassisSpeeds msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::ChassisSpeeds>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufChassisSpeeds>(arena);
}
frc::ChassisSpeeds wpi::Protobuf<frc::ChassisSpeeds>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufChassisSpeeds*>(&msg);
return frc::ChassisSpeeds{
units::meters_per_second_t{m->vx()},
units::meters_per_second_t{m->vy()},
units::radians_per_second_t{m->omega()},
units::meters_per_second_t{msg.vx},
units::meters_per_second_t{msg.vy},
units::radians_per_second_t{msg.omega},
};
}
void wpi::Protobuf<frc::ChassisSpeeds>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::ChassisSpeeds>::Pack(OutputStream& stream,
const frc::ChassisSpeeds& value) {
auto m = static_cast<wpi::proto::ProtobufChassisSpeeds*>(msg);
m->set_vx(value.vx.value());
m->set_vy(value.vy.value());
m->set_omega(value.omega.value());
wpi_proto_ProtobufChassisSpeeds msg{
.vx = value.vx.value(),
.vy = value.vy.value(),
.omega = value.omega.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,29 +4,24 @@
#include "frc/kinematics/proto/DifferentialDriveKinematicsProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/kinematics.npb.h"
#include "kinematics.pb.h"
std::optional<frc::DifferentialDriveKinematics>
wpi::Protobuf<frc::DifferentialDriveKinematics>::Unpack(InputStream& stream) {
wpi_proto_ProtobufDifferentialDriveKinematics msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::DifferentialDriveKinematics>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufDifferentialDriveKinematics>(
arena);
}
frc::DifferentialDriveKinematics
wpi::Protobuf<frc::DifferentialDriveKinematics>::Unpack(
const google::protobuf::Message& msg) {
auto m =
static_cast<const wpi::proto::ProtobufDifferentialDriveKinematics*>(&msg);
return frc::DifferentialDriveKinematics{
units::meter_t{m->track_width()},
units::meter_t{msg.track_width},
};
}
void wpi::Protobuf<frc::DifferentialDriveKinematics>::Pack(
google::protobuf::Message* msg,
const frc::DifferentialDriveKinematics& value) {
auto m = static_cast<wpi::proto::ProtobufDifferentialDriveKinematics*>(msg);
m->set_track_width(value.trackWidth.value());
bool wpi::Protobuf<frc::DifferentialDriveKinematics>::Pack(
OutputStream& stream, const frc::DifferentialDriveKinematics& value) {
wpi_proto_ProtobufDifferentialDriveKinematics msg{
.track_width = value.trackWidth.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,33 +4,26 @@
#include "frc/kinematics/proto/DifferentialDriveWheelPositionsProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/kinematics.npb.h"
#include "kinematics.pb.h"
std::optional<frc::DifferentialDriveWheelPositions> wpi::Protobuf<
frc::DifferentialDriveWheelPositions>::Unpack(InputStream& stream) {
wpi_proto_ProtobufDifferentialDriveWheelPositions msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<
frc::DifferentialDriveWheelPositions>::New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<
wpi::proto::ProtobufDifferentialDriveWheelPositions>(arena);
}
frc::DifferentialDriveWheelPositions
wpi::Protobuf<frc::DifferentialDriveWheelPositions>::Unpack(
const google::protobuf::Message& msg) {
auto m =
static_cast<const wpi::proto::ProtobufDifferentialDriveWheelPositions*>(
&msg);
return frc::DifferentialDriveWheelPositions{
units::meter_t{m->left()},
units::meter_t{m->right()},
units::meter_t{msg.left},
units::meter_t{msg.right},
};
}
void wpi::Protobuf<frc::DifferentialDriveWheelPositions>::Pack(
google::protobuf::Message* msg,
const frc::DifferentialDriveWheelPositions& value) {
auto m =
static_cast<wpi::proto::ProtobufDifferentialDriveWheelPositions*>(msg);
m->set_left(value.left.value());
m->set_right(value.right.value());
bool wpi::Protobuf<frc::DifferentialDriveWheelPositions>::Pack(
OutputStream& stream, const frc::DifferentialDriveWheelPositions& value) {
wpi_proto_ProtobufDifferentialDriveWheelPositions msg{
.left = value.left.value(),
.right = value.right.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,31 +4,26 @@
#include "frc/kinematics/proto/DifferentialDriveWheelSpeedsProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/kinematics.npb.h"
#include "kinematics.pb.h"
std::optional<frc::DifferentialDriveWheelSpeeds>
wpi::Protobuf<frc::DifferentialDriveWheelSpeeds>::Unpack(InputStream& stream) {
wpi_proto_ProtobufDifferentialDriveWheelSpeeds msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<
frc::DifferentialDriveWheelSpeeds>::New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufDifferentialDriveWheelSpeeds>(
arena);
}
frc::DifferentialDriveWheelSpeeds
wpi::Protobuf<frc::DifferentialDriveWheelSpeeds>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufDifferentialDriveWheelSpeeds*>(
&msg);
return frc::DifferentialDriveWheelSpeeds{
units::meters_per_second_t{m->left()},
units::meters_per_second_t{m->right()},
units::meters_per_second_t{msg.left},
units::meters_per_second_t{msg.right},
};
}
void wpi::Protobuf<frc::DifferentialDriveWheelSpeeds>::Pack(
google::protobuf::Message* msg,
const frc::DifferentialDriveWheelSpeeds& value) {
auto m = static_cast<wpi::proto::ProtobufDifferentialDriveWheelSpeeds*>(msg);
m->set_left(value.left.value());
m->set_right(value.right.value());
bool wpi::Protobuf<frc::DifferentialDriveWheelSpeeds>::Pack(
OutputStream& stream, const frc::DifferentialDriveWheelSpeeds& value) {
wpi_proto_ProtobufDifferentialDriveWheelSpeeds msg{
.left = value.left.value(),
.right = value.right.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,31 +4,55 @@
#include "frc/kinematics/proto/MecanumDriveKinematicsProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "kinematics.pb.h"
#include "wpimath/protobuf/kinematics.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::MecanumDriveKinematics>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufMecanumDriveKinematics>(arena);
}
std::optional<frc::MecanumDriveKinematics>
wpi::Protobuf<frc::MecanumDriveKinematics>::Unpack(InputStream& stream) {
wpi::UnpackCallback<frc::Translation2d> frontLeft;
wpi::UnpackCallback<frc::Translation2d> frontRight;
wpi::UnpackCallback<frc::Translation2d> rearLeft;
wpi::UnpackCallback<frc::Translation2d> rearRight;
wpi_proto_ProtobufMecanumDriveKinematics msg{
.front_left = frontLeft.Callback(),
.front_right = frontRight.Callback(),
.rear_left = rearLeft.Callback(),
.rear_right = rearRight.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
auto ifrontLeft = frontLeft.Items();
auto ifrontRight = frontRight.Items();
auto irearLeft = rearLeft.Items();
auto irearRight = rearRight.Items();
if (ifrontLeft.empty() || ifrontRight.empty() || irearLeft.empty() ||
irearRight.empty()) {
return {};
}
frc::MecanumDriveKinematics wpi::Protobuf<frc::MecanumDriveKinematics>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufMecanumDriveKinematics*>(&msg);
return frc::MecanumDriveKinematics{
wpi::UnpackProtobuf<frc::Translation2d>(m->wpi_front_left()),
wpi::UnpackProtobuf<frc::Translation2d>(m->wpi_front_right()),
wpi::UnpackProtobuf<frc::Translation2d>(m->wpi_rear_left()),
wpi::UnpackProtobuf<frc::Translation2d>(m->wpi_rear_right()),
ifrontLeft[0],
ifrontRight[0],
irearLeft[0],
irearRight[0],
};
}
void wpi::Protobuf<frc::MecanumDriveKinematics>::Pack(
google::protobuf::Message* msg, const frc::MecanumDriveKinematics& value) {
auto m = static_cast<wpi::proto::ProtobufMecanumDriveKinematics*>(msg);
wpi::PackProtobuf(m->mutable_front_left(), value.GetFrontLeft());
wpi::PackProtobuf(m->mutable_front_right(), value.GetFrontRight());
wpi::PackProtobuf(m->mutable_rear_left(), value.GetRearLeft());
wpi::PackProtobuf(m->mutable_rear_right(), value.GetRearRight());
bool wpi::Protobuf<frc::MecanumDriveKinematics>::Pack(
OutputStream& stream, const frc::MecanumDriveKinematics& value) {
wpi::PackCallback frontLeft{&value.GetFrontLeft()};
wpi::PackCallback frontRight{&value.GetFrontRight()};
wpi::PackCallback rearLeft{&value.GetRearLeft()};
wpi::PackCallback rearRight{&value.GetRearRight()};
wpi_proto_ProtobufMecanumDriveKinematics msg{
.front_left = frontLeft.Callback(),
.front_right = frontRight.Callback(),
.rear_left = rearLeft.Callback(),
.rear_right = rearRight.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,35 +4,30 @@
#include "frc/kinematics/proto/MecanumDriveWheelPositionsProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/kinematics.npb.h"
#include "kinematics.pb.h"
std::optional<frc::MecanumDriveWheelPositions>
wpi::Protobuf<frc::MecanumDriveWheelPositions>::Unpack(InputStream& stream) {
wpi_proto_ProtobufMecanumDriveWheelPositions msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::MecanumDriveWheelPositions>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufMecanumDriveWheelPositions>(
arena);
}
frc::MecanumDriveWheelPositions
wpi::Protobuf<frc::MecanumDriveWheelPositions>::Unpack(
const google::protobuf::Message& msg) {
auto m =
static_cast<const wpi::proto::ProtobufMecanumDriveWheelPositions*>(&msg);
return frc::MecanumDriveWheelPositions{
units::meter_t{m->front_left()},
units::meter_t{m->front_right()},
units::meter_t{m->rear_left()},
units::meter_t{m->rear_right()},
units::meter_t{msg.front_left},
units::meter_t{msg.front_right},
units::meter_t{msg.rear_left},
units::meter_t{msg.rear_right},
};
}
void wpi::Protobuf<frc::MecanumDriveWheelPositions>::Pack(
google::protobuf::Message* msg,
const frc::MecanumDriveWheelPositions& value) {
auto m = static_cast<wpi::proto::ProtobufMecanumDriveWheelPositions*>(msg);
m->set_front_left(value.frontLeft.value());
m->set_front_right(value.frontRight.value());
m->set_rear_left(value.rearLeft.value());
m->set_rear_right(value.rearRight.value());
bool wpi::Protobuf<frc::MecanumDriveWheelPositions>::Pack(
OutputStream& stream, const frc::MecanumDriveWheelPositions& value) {
wpi_proto_ProtobufMecanumDriveWheelPositions msg{
.front_left = value.frontLeft.value(),
.front_right = value.frontRight.value(),
.rear_left = value.rearLeft.value(),
.rear_right = value.rearRight.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,33 +4,30 @@
#include "frc/kinematics/proto/MecanumDriveWheelSpeedsProto.h"
#include <wpi/ProtoHelper.h>
#include "wpimath/protobuf/kinematics.npb.h"
#include "kinematics.pb.h"
std::optional<frc::MecanumDriveWheelSpeeds>
wpi::Protobuf<frc::MecanumDriveWheelSpeeds>::Unpack(InputStream& stream) {
wpi_proto_ProtobufMecanumDriveWheelSpeeds msg;
if (!stream.Decode(msg)) {
return {};
}
google::protobuf::Message* wpi::Protobuf<frc::MecanumDriveWheelSpeeds>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufMecanumDriveWheelSpeeds>(arena);
}
frc::MecanumDriveWheelSpeeds
wpi::Protobuf<frc::MecanumDriveWheelSpeeds>::Unpack(
const google::protobuf::Message& msg) {
auto m =
static_cast<const wpi::proto::ProtobufMecanumDriveWheelSpeeds*>(&msg);
return frc::MecanumDriveWheelSpeeds{
units::meters_per_second_t{m->front_left()},
units::meters_per_second_t{m->front_right()},
units::meters_per_second_t{m->rear_left()},
units::meters_per_second_t{m->rear_right()},
units::meters_per_second_t{msg.front_left},
units::meters_per_second_t{msg.front_right},
units::meters_per_second_t{msg.rear_left},
units::meters_per_second_t{msg.rear_right},
};
}
void wpi::Protobuf<frc::MecanumDriveWheelSpeeds>::Pack(
google::protobuf::Message* msg, const frc::MecanumDriveWheelSpeeds& value) {
auto m = static_cast<wpi::proto::ProtobufMecanumDriveWheelSpeeds*>(msg);
m->set_front_left(value.frontLeft.value());
m->set_front_right(value.frontRight.value());
m->set_rear_left(value.rearLeft.value());
m->set_rear_right(value.rearRight.value());
bool wpi::Protobuf<frc::MecanumDriveWheelSpeeds>::Pack(
OutputStream& stream, const frc::MecanumDriveWheelSpeeds& value) {
wpi_proto_ProtobufMecanumDriveWheelSpeeds msg{
.front_left = value.frontLeft.value(),
.front_right = value.frontRight.value(),
.rear_left = value.rearLeft.value(),
.rear_right = value.rearRight.value(),
};
return stream.Encode(msg);
}

View File

@@ -4,27 +4,39 @@
#include "frc/kinematics/proto/SwerveModulePositionProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "kinematics.pb.h"
#include "wpimath/protobuf/kinematics.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::SwerveModulePosition>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufSwerveModulePosition>(arena);
}
std::optional<frc::SwerveModulePosition>
wpi::Protobuf<frc::SwerveModulePosition>::Unpack(InputStream& stream) {
wpi::UnpackCallback<frc::Rotation2d> angle;
wpi_proto_ProtobufSwerveModulePosition msg{
.distance = 0,
.angle = angle.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
auto iangle = angle.Items();
if (iangle.empty()) {
return {};
}
frc::SwerveModulePosition wpi::Protobuf<frc::SwerveModulePosition>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufSwerveModulePosition*>(&msg);
return frc::SwerveModulePosition{
units::meter_t{m->distance()},
wpi::UnpackProtobuf<frc::Rotation2d>(m->wpi_angle()),
units::meter_t{msg.distance},
iangle[0],
};
}
void wpi::Protobuf<frc::SwerveModulePosition>::Pack(
google::protobuf::Message* msg, const frc::SwerveModulePosition& value) {
auto m = static_cast<wpi::proto::ProtobufSwerveModulePosition*>(msg);
m->set_distance(value.distance.value());
wpi::PackProtobuf(m->mutable_angle(), value.angle);
bool wpi::Protobuf<frc::SwerveModulePosition>::Pack(
OutputStream& stream, const frc::SwerveModulePosition& value) {
wpi::PackCallback angle{&value.angle};
wpi_proto_ProtobufSwerveModulePosition msg{
.distance = value.distance.value(),
.angle = angle.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,27 +4,39 @@
#include "frc/kinematics/proto/SwerveModuleStateProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "kinematics.pb.h"
#include "wpimath/protobuf/kinematics.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::SwerveModuleState>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufSwerveModuleState>(arena);
}
std::optional<frc::SwerveModuleState>
wpi::Protobuf<frc::SwerveModuleState>::Unpack(InputStream& stream) {
wpi::UnpackCallback<frc::Rotation2d> angle;
wpi_proto_ProtobufSwerveModuleState msg{
.speed = 0,
.angle = angle.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
auto iangle = angle.Items();
if (iangle.empty()) {
return {};
}
frc::SwerveModuleState wpi::Protobuf<frc::SwerveModuleState>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufSwerveModuleState*>(&msg);
return frc::SwerveModuleState{
units::meters_per_second_t{m->speed()},
wpi::UnpackProtobuf<frc::Rotation2d>(m->wpi_angle()),
units::meters_per_second_t{msg.speed},
iangle[0],
};
}
void wpi::Protobuf<frc::SwerveModuleState>::Pack(
google::protobuf::Message* msg, const frc::SwerveModuleState& value) {
auto m = static_cast<wpi::proto::ProtobufSwerveModuleState*>(msg);
m->set_speed(value.speed.value());
wpi::PackProtobuf(m->mutable_angle(), value.angle);
bool wpi::Protobuf<frc::SwerveModuleState>::Pack(
OutputStream& stream, const frc::SwerveModuleState& value) {
wpi::PackCallback angle{&value.angle};
wpi_proto_ProtobufSwerveModuleState msg{
.speed = value.speed.value(),
.angle = angle.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,32 +4,50 @@
#include "frc/spline/proto/CubicHermiteSplineProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "spline.pb.h"
#include "wpimath/protobuf/spline.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::CubicHermiteSpline>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufCubicHermiteSpline>(arena);
}
std::optional<frc::CubicHermiteSpline>
wpi::Protobuf<frc::CubicHermiteSpline>::Unpack(InputStream& stream) {
wpi::WpiArrayUnpackCallback<double, 2> xInitial;
wpi::WpiArrayUnpackCallback<double, 2> xFinal;
wpi::WpiArrayUnpackCallback<double, 2> yInitial;
wpi::WpiArrayUnpackCallback<double, 2> yFinal;
wpi_proto_ProtobufCubicHermiteSpline msg{
.x_initial = xInitial.Callback(),
.x_final = xFinal.Callback(),
.y_initial = yInitial.Callback(),
.y_final = yFinal.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
if (!xInitial.IsFull() || !yInitial.IsFull() || !xFinal.IsFull() ||
!yFinal.IsFull()) {
return {};
}
frc::CubicHermiteSpline wpi::Protobuf<frc::CubicHermiteSpline>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufCubicHermiteSpline*>(&msg);
return frc::CubicHermiteSpline{
wpi::UnpackProtobufArray<double, 2>(m->x_initial()),
wpi::UnpackProtobufArray<double, 2>(m->x_final()),
wpi::UnpackProtobufArray<double, 2>(m->y_initial()),
wpi::UnpackProtobufArray<double, 2>(m->y_final())};
xInitial.Array(),
xFinal.Array(),
yInitial.Array(),
yFinal.Array(),
};
}
void wpi::Protobuf<frc::CubicHermiteSpline>::Pack(
google::protobuf::Message* msg, const frc::CubicHermiteSpline& value) {
auto m = static_cast<wpi::proto::ProtobufCubicHermiteSpline*>(msg);
wpi::PackProtobufArray(m->mutable_x_initial(),
value.GetInitialControlVector().x);
wpi::PackProtobufArray(m->mutable_x_final(), value.GetFinalControlVector().x);
wpi::PackProtobufArray(m->mutable_y_initial(),
value.GetInitialControlVector().y);
wpi::PackProtobufArray(m->mutable_y_final(), value.GetFinalControlVector().y);
bool wpi::Protobuf<frc::CubicHermiteSpline>::Pack(
OutputStream& stream, const frc::CubicHermiteSpline& value) {
wpi::PackCallback<double> xInitial{value.GetInitialControlVector().x};
wpi::PackCallback<double> xFinal{value.GetFinalControlVector().x};
wpi::PackCallback<double> yInitial{value.GetInitialControlVector().y};
wpi::PackCallback<double> yFinal{value.GetFinalControlVector().y};
wpi_proto_ProtobufCubicHermiteSpline msg{
.x_initial = xInitial.Callback(),
.x_final = xFinal.Callback(),
.y_initial = yInitial.Callback(),
.y_final = yFinal.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,32 +4,50 @@
#include "frc/spline/proto/QuinticHermiteSplineProto.h"
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "spline.pb.h"
#include "wpimath/protobuf/spline.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::QuinticHermiteSpline>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufQuinticHermiteSpline>(arena);
}
std::optional<frc::QuinticHermiteSpline>
wpi::Protobuf<frc::QuinticHermiteSpline>::Unpack(InputStream& stream) {
wpi::WpiArrayUnpackCallback<double, 3> xInitial;
wpi::WpiArrayUnpackCallback<double, 3> xFinal;
wpi::WpiArrayUnpackCallback<double, 3> yInitial;
wpi::WpiArrayUnpackCallback<double, 3> yFinal;
wpi_proto_ProtobufQuinticHermiteSpline msg{
.x_initial = xInitial.Callback(),
.x_final = xFinal.Callback(),
.y_initial = yInitial.Callback(),
.y_final = yFinal.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
if (!xInitial.IsFull() || !yInitial.IsFull() || !xFinal.IsFull() ||
!yFinal.IsFull()) {
return {};
}
frc::QuinticHermiteSpline wpi::Protobuf<frc::QuinticHermiteSpline>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufQuinticHermiteSpline*>(&msg);
return frc::QuinticHermiteSpline{
wpi::UnpackProtobufArray<double, 3>(m->x_initial()),
wpi::UnpackProtobufArray<double, 3>(m->x_final()),
wpi::UnpackProtobufArray<double, 3>(m->y_initial()),
wpi::UnpackProtobufArray<double, 3>(m->y_final())};
xInitial.Array(),
xFinal.Array(),
yInitial.Array(),
yFinal.Array(),
};
}
void wpi::Protobuf<frc::QuinticHermiteSpline>::Pack(
google::protobuf::Message* msg, const frc::QuinticHermiteSpline& value) {
auto m = static_cast<wpi::proto::ProtobufQuinticHermiteSpline*>(msg);
wpi::PackProtobufArray(m->mutable_x_initial(),
value.GetInitialControlVector().x);
wpi::PackProtobufArray(m->mutable_x_final(), value.GetFinalControlVector().x);
wpi::PackProtobufArray(m->mutable_y_initial(),
value.GetInitialControlVector().y);
wpi::PackProtobufArray(m->mutable_y_final(), value.GetFinalControlVector().y);
bool wpi::Protobuf<frc::QuinticHermiteSpline>::Pack(
OutputStream& stream, const frc::QuinticHermiteSpline& value) {
wpi::PackCallback<double> xInitial{value.GetInitialControlVector().x};
wpi::PackCallback<double> xFinal{value.GetFinalControlVector().x};
wpi::PackCallback<double> yInitial{value.GetInitialControlVector().y};
wpi::PackCallback<double> yFinal{value.GetFinalControlVector().y};
wpi_proto_ProtobufQuinticHermiteSpline msg{
.x_initial = xInitial.Callback(),
.x_final = xFinal.Callback(),
.y_initial = yInitial.Callback(),
.y_final = yFinal.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,33 +4,34 @@
#include "frc/system/plant/proto/DCMotorProto.h"
#include <wpi/ProtoHelper.h>
#include <optional>
#include "plant.pb.h"
#include "wpimath/protobuf/plant.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::DCMotor>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufDCMotor>(arena);
}
std::optional<frc::DCMotor> wpi::Protobuf<frc::DCMotor>::Unpack(
InputStream& stream) {
wpi_proto_ProtobufDCMotor msg;
if (!stream.Decode(msg)) {
return {};
}
frc::DCMotor wpi::Protobuf<frc::DCMotor>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufDCMotor*>(&msg);
return frc::DCMotor{
units::volt_t{m->nominal_voltage()},
units::newton_meter_t{m->stall_torque()},
units::ampere_t{m->stall_current()},
units::ampere_t{m->free_current()},
units::radians_per_second_t{m->free_speed()},
units::volt_t{msg.nominal_voltage},
units::newton_meter_t{msg.stall_torque},
units::ampere_t{msg.stall_current},
units::ampere_t{msg.free_current},
units::radians_per_second_t{msg.free_speed},
};
}
void wpi::Protobuf<frc::DCMotor>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::DCMotor>::Pack(OutputStream& stream,
const frc::DCMotor& value) {
auto m = static_cast<wpi::proto::ProtobufDCMotor*>(msg);
m->set_nominal_voltage(value.nominalVoltage.value());
m->set_stall_torque(value.stallTorque.value());
m->set_stall_current(value.stallCurrent.value());
m->set_free_current(value.freeCurrent.value());
m->set_free_speed(value.freeSpeed.value());
wpi_proto_ProtobufDCMotor msg{
.nominal_voltage = value.nominalVoltage.value(),
.stall_torque = value.stallTorque.value(),
.stall_current = value.stallCurrent.value(),
.free_current = value.freeCurrent.value(),
.free_speed = value.freeSpeed.value(),
};
return stream.Encode(msg);
}

View File

@@ -6,31 +6,28 @@
#include <vector>
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "trajectory.pb.h"
#include "wpimath/protobuf/trajectory.npb.h"
google::protobuf::Message* wpi::Protobuf<frc::Trajectory>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufTrajectory>(arena);
}
frc::Trajectory wpi::Protobuf<frc::Trajectory>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufTrajectory*>(&msg);
std::vector<frc::Trajectory::State> states;
states.reserve(m->states().size());
for (const auto& protoState : m->states()) {
states.push_back(wpi::UnpackProtobuf<frc::Trajectory::State>(protoState));
std::optional<frc::Trajectory> wpi::Protobuf<frc::Trajectory>::Unpack(
InputStream& stream) {
wpi::StdVectorUnpackCallback<frc::Trajectory::State, SIZE_MAX> states;
wpi_proto_ProtobufTrajectory msg{
.states = states.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
return frc::Trajectory{states};
return frc::Trajectory{states.Vec()};
}
void wpi::Protobuf<frc::Trajectory>::Pack(google::protobuf::Message* msg,
bool wpi::Protobuf<frc::Trajectory>::Pack(OutputStream& stream,
const frc::Trajectory& value) {
auto m = static_cast<wpi::proto::ProtobufTrajectory*>(msg);
m->mutable_states()->Reserve(value.States().size());
for (const auto& state : value.States()) {
wpi::PackProtobuf(m->add_states(), state);
}
wpi::PackCallback<frc::Trajectory::State> states{value.States()};
wpi_proto_ProtobufTrajectory msg{
.states = states.Callback(),
};
return stream.Encode(msg);
}

View File

@@ -4,33 +4,46 @@
#include "frc/trajectory/proto/TrajectoryStateProto.h"
#include <wpi/ProtoHelper.h>
#include <utility>
#include "trajectory.pb.h"
#include <wpi/protobuf/ProtobufCallbacks.h>
google::protobuf::Message* wpi::Protobuf<frc::Trajectory::State>::New(
google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufTrajectoryState>(arena);
}
#include "wpimath/protobuf/trajectory.npb.h"
std::optional<frc::Trajectory::State>
wpi::Protobuf<frc::Trajectory::State>::Unpack(InputStream& stream) {
wpi::UnpackCallback<frc::Pose2d> pose;
wpi_proto_ProtobufTrajectoryState msg;
msg.pose = pose.Callback();
if (!stream.Decode(msg)) {
return {};
}
auto ipose = pose.Items();
if (ipose.empty()) {
return {};
}
frc::Trajectory::State wpi::Protobuf<frc::Trajectory::State>::Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufTrajectoryState*>(&msg);
return frc::Trajectory::State{
units::second_t{m->time()},
units::meters_per_second_t{m->velocity()},
units::meters_per_second_squared_t{m->acceleration()},
wpi::UnpackProtobuf<frc::Pose2d>(m->wpi_pose()),
units::curvature_t{m->curvature()},
units::second_t{msg.time},
units::meters_per_second_t{msg.velocity},
units::meters_per_second_squared_t{msg.acceleration},
std::move(ipose[0]),
units::curvature_t{msg.curvature},
};
}
void wpi::Protobuf<frc::Trajectory::State>::Pack(
google::protobuf::Message* msg, const frc::Trajectory::State& value) {
auto m = static_cast<wpi::proto::ProtobufTrajectoryState*>(msg);
m->set_time(value.t.value());
m->set_velocity(value.velocity.value());
m->set_acceleration(value.acceleration.value());
wpi::PackProtobuf(m->mutable_pose(), value.pose);
m->set_curvature(value.curvature.value());
bool wpi::Protobuf<frc::Trajectory::State>::Pack(
OutputStream& stream, const frc::Trajectory::State& value) {
wpi::PackCallback pose{&value.pose};
wpi_proto_ProtobufTrajectoryState msg{
.time = value.t.value(),
.velocity = value.velocity.value(),
.acceleration = value.acceleration.value(),
.pose = pose.Callback(),
.curvature = value.curvature.value(),
};
return stream.Encode(msg);
}

View File

@@ -8,11 +8,14 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/controller/ArmFeedforward.h"
#include "pb.h"
#include "wpimath/protobuf/controller.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::ArmFeedforward> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::ArmFeedforward Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::ArmFeedforward& value);
using MessageStruct = wpi_proto_ProtobufArmFeedforward;
using InputStream = wpi::ProtoInputStream<frc::ArmFeedforward>;
using OutputStream = wpi::ProtoOutputStream<frc::ArmFeedforward>;
static std::optional<frc::ArmFeedforward> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::ArmFeedforward& value);
};

View File

@@ -8,12 +8,17 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/controller/DifferentialDriveFeedforward.h"
#include "pb.h"
#include "wpimath/protobuf/controller.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::DifferentialDriveFeedforward> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::DifferentialDriveFeedforward Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufDifferentialDriveFeedforward;
using InputStream = wpi::ProtoInputStream<frc::DifferentialDriveFeedforward>;
using OutputStream =
wpi::ProtoOutputStream<frc::DifferentialDriveFeedforward>;
static std::optional<frc::DifferentialDriveFeedforward> Unpack(
InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::DifferentialDriveFeedforward& value);
};

View File

@@ -8,12 +8,18 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/controller/DifferentialDriveWheelVoltages.h"
#include "pb.h"
#include "wpimath/protobuf/controller.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::DifferentialDriveWheelVoltages> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::DifferentialDriveWheelVoltages Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufDifferentialDriveWheelVoltages;
using InputStream =
wpi::ProtoInputStream<frc::DifferentialDriveWheelVoltages>;
using OutputStream =
wpi::ProtoOutputStream<frc::DifferentialDriveWheelVoltages>;
static std::optional<frc::DifferentialDriveWheelVoltages> Unpack(
InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::DifferentialDriveWheelVoltages& value);
};

View File

@@ -8,11 +8,14 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/controller/ElevatorFeedforward.h"
#include "pb.h"
#include "wpimath/protobuf/controller.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::ElevatorFeedforward> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::ElevatorFeedforward Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::ElevatorFeedforward& value);
using MessageStruct = wpi_proto_ProtobufElevatorFeedforward;
using InputStream = wpi::ProtoInputStream<frc::ElevatorFeedforward>;
using OutputStream = wpi::ProtoOutputStream<frc::ElevatorFeedforward>;
static std::optional<frc::ElevatorFeedforward> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::ElevatorFeedforward& value);
};

View File

@@ -4,47 +4,55 @@
#pragma once
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/Protobuf.h>
#include "controller.pb.h"
#include "frc/controller/SimpleMotorFeedforward.h"
#include "pb.h"
#include "units/length.h"
#include "wpimath/protobuf/controller.npb.h"
// Everything is converted into units for
// frc::SimpleMotorFeedforward<units::meters>
template <class Distance>
struct wpi::Protobuf<frc::SimpleMotorFeedforward<Distance>> {
static google::protobuf::Message* New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufSimpleMotorFeedforward>(
arena);
}
struct wpi::Protobuf<frc::SimpleMotorFeedforward<Distance>> { // NOLINT
using MessageStruct = wpi_proto_ProtobufSimpleMotorFeedforward;
using InputStream =
wpi::ProtoInputStream<frc::SimpleMotorFeedforward<Distance>>;
using OutputStream =
wpi::ProtoOutputStream<frc::SimpleMotorFeedforward<Distance>>;
static frc::SimpleMotorFeedforward<Distance> Unpack(
const google::protobuf::Message& msg) {
auto m =
static_cast<const wpi::proto::ProtobufSimpleMotorFeedforward*>(&msg);
return {units::volt_t{m->ks()},
units::unit_t<frc::SimpleMotorFeedforward<units::meters>::kv_unit>{
m->kv()},
units::unit_t<frc::SimpleMotorFeedforward<units::meters>::ka_unit>{
m->ka()},
units::second_t{m->dt()}};
}
static std::optional<frc::SimpleMotorFeedforward<Distance>> Unpack(
InputStream& stream) {
wpi_proto_ProtobufSimpleMotorFeedforward msg;
if (!stream.Decode(msg)) {
return {};
}
static void Pack(google::protobuf::Message* msg,
const frc::SimpleMotorFeedforward<Distance>& value) {
auto m = static_cast<wpi::proto::ProtobufSimpleMotorFeedforward*>(msg);
m->set_ks(value.GetKs().value());
m->set_kv(
return frc::SimpleMotorFeedforward<Distance>{
units::volt_t{msg.ks},
units::unit_t<frc::SimpleMotorFeedforward<units::meters>::kv_unit>{
value.GetKv()}
.value());
m->set_ka(
msg.kv},
units::unit_t<frc::SimpleMotorFeedforward<units::meters>::ka_unit>{
value.GetKa()}
.value());
m->set_dt(units::second_t{value.GetDt()}.value());
msg.ka},
units::second_t{msg.dt},
};
}
static bool Pack(OutputStream& stream,
const frc::SimpleMotorFeedforward<Distance>& value) {
wpi_proto_ProtobufSimpleMotorFeedforward msg{
.ks = value.GetKs().value(),
.kv =
units::unit_t<frc::SimpleMotorFeedforward<units::meters>::kv_unit>{
value.GetKv()}
.value(),
.ka =
units::unit_t<frc::SimpleMotorFeedforward<units::meters>::ka_unit>{
value.GetKa()}
.value(),
.dt = units::second_t{value.GetDt()}.value(),
};
return stream.Encode(msg);
}
};

View File

@@ -8,10 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Ellipse2d.h"
#include "wpimath/protobuf/geometry2d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Ellipse2d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Ellipse2d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg, const frc::Ellipse2d& value);
using MessageStruct = wpi_proto_ProtobufEllipse2d;
using InputStream = wpi::ProtoInputStream<frc::Ellipse2d>;
using OutputStream = wpi::ProtoOutputStream<frc::Ellipse2d>;
static std::optional<frc::Ellipse2d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Ellipse2d& value);
};

View File

@@ -8,10 +8,14 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Pose2d.h"
#include "pb.h"
#include "wpimath/protobuf/geometry2d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Pose2d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Pose2d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg, const frc::Pose2d& value);
using MessageStruct = wpi_proto_ProtobufPose2d;
using InputStream = wpi::ProtoInputStream<frc::Pose2d>;
using OutputStream = wpi::ProtoOutputStream<frc::Pose2d>;
static std::optional<frc::Pose2d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Pose2d& value);
};

View File

@@ -8,10 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Pose3d.h"
#include "wpimath/protobuf/geometry3d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Pose3d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Pose3d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg, const frc::Pose3d& value);
using MessageStruct = wpi_proto_ProtobufPose3d;
using InputStream = wpi::ProtoInputStream<frc::Pose3d>;
using OutputStream = wpi::ProtoOutputStream<frc::Pose3d>;
static std::optional<frc::Pose3d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Pose3d& value);
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Quaternion.h"
#include "wpimath/protobuf/geometry3d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Quaternion> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Quaternion Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Quaternion& value);
using MessageStruct = wpi_proto_ProtobufQuaternion;
using InputStream = wpi::ProtoInputStream<frc::Quaternion>;
using OutputStream = wpi::ProtoOutputStream<frc::Quaternion>;
static std::optional<frc::Quaternion> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Quaternion& value);
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Rectangle2d.h"
#include "wpimath/protobuf/geometry2d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Rectangle2d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Rectangle2d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Rectangle2d& value);
using MessageStruct = wpi_proto_ProtobufRectangle2d;
using InputStream = wpi::ProtoInputStream<frc::Rectangle2d>;
using OutputStream = wpi::ProtoOutputStream<frc::Rectangle2d>;
static std::optional<frc::Rectangle2d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Rectangle2d& value);
};

View File

@@ -8,11 +8,14 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Rotation2d.h"
#include "pb.h"
#include "wpimath/protobuf/geometry2d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Rotation2d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Rotation2d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Rotation2d& value);
using MessageStruct = wpi_proto_ProtobufRotation2d;
using InputStream = wpi::ProtoInputStream<frc::Rotation2d>;
using OutputStream = wpi::ProtoOutputStream<frc::Rotation2d>;
static std::optional<frc::Rotation2d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Rotation2d& value);
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Rotation3d.h"
#include "wpimath/protobuf/geometry3d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Rotation3d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Rotation3d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Rotation3d& value);
using MessageStruct = wpi_proto_ProtobufRotation3d;
using InputStream = wpi::ProtoInputStream<frc::Rotation3d>;
using OutputStream = wpi::ProtoOutputStream<frc::Rotation3d>;
static std::optional<frc::Rotation3d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Rotation3d& value);
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Transform2d.h"
#include "wpimath/protobuf/geometry2d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Transform2d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Transform2d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Transform2d& value);
using MessageStruct = wpi_proto_ProtobufTransform2d;
using InputStream = wpi::ProtoInputStream<frc::Transform2d>;
using OutputStream = wpi::ProtoOutputStream<frc::Transform2d>;
static std::optional<frc::Transform2d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Transform2d& value);
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Transform3d.h"
#include "wpimath/protobuf/geometry3d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Transform3d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Transform3d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Transform3d& value);
using MessageStruct = wpi_proto_ProtobufTransform3d;
using InputStream = wpi::ProtoInputStream<frc::Transform3d>;
using OutputStream = wpi::ProtoOutputStream<frc::Transform3d>;
static std::optional<frc::Transform3d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Transform3d& value);
};

View File

@@ -8,11 +8,14 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Translation2d.h"
#include "pb.h"
#include "wpimath/protobuf/geometry2d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Translation2d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Translation2d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Translation2d& value);
using MessageStruct = wpi_proto_ProtobufTranslation2d;
using InputStream = wpi::ProtoInputStream<frc::Translation2d>;
using OutputStream = wpi::ProtoOutputStream<frc::Translation2d>;
static std::optional<frc::Translation2d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Translation2d& value);
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Translation3d.h"
#include "wpimath/protobuf/geometry3d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Translation3d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Translation3d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Translation3d& value);
using MessageStruct = wpi_proto_ProtobufTranslation3d;
using InputStream = wpi::ProtoInputStream<frc::Translation3d>;
using OutputStream = wpi::ProtoOutputStream<frc::Translation3d>;
static std::optional<frc::Translation3d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Translation3d& value);
};

View File

@@ -8,10 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Twist2d.h"
#include "wpimath/protobuf/geometry2d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Twist2d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Twist2d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg, const frc::Twist2d& value);
using MessageStruct = wpi_proto_ProtobufTwist2d;
using InputStream = wpi::ProtoInputStream<frc::Twist2d>;
using OutputStream = wpi::ProtoOutputStream<frc::Twist2d>;
static std::optional<frc::Twist2d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Twist2d& value);
};

View File

@@ -8,10 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/geometry/Twist3d.h"
#include "wpimath/protobuf/geometry3d.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Twist3d> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Twist3d Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg, const frc::Twist3d& value);
using MessageStruct = wpi_proto_ProtobufTwist3d;
using InputStream = wpi::ProtoInputStream<frc::Twist3d>;
using OutputStream = wpi::ProtoOutputStream<frc::Twist3d>;
static std::optional<frc::Twist3d> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Twist3d& value);
};

View File

@@ -24,6 +24,8 @@ template <typename WheelSpeeds, typename WheelPositions>
std::assignable_from<WheelPositions&, const WheelPositions&>
class WPILIB_DLLEXPORT Kinematics {
public:
virtual ~Kinematics() noexcept = default;
/**
* Performs forward kinematics to return the resulting chassis speed from the
* wheel speeds. This method is often used for odometry -- determining the

View File

@@ -429,7 +429,7 @@ class SwerveDriveKinematics
return {result};
}
const wpi::array<Translation2d, NumModules> GetModules() const {
const wpi::array<Translation2d, NumModules>& GetModules() const {
return m_modules;
}

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/ChassisSpeeds.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::ChassisSpeeds> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::ChassisSpeeds Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::ChassisSpeeds& value);
using MessageStruct = wpi_proto_ProtobufChassisSpeeds;
using InputStream = wpi::ProtoInputStream<frc::ChassisSpeeds>;
using OutputStream = wpi::ProtoOutputStream<frc::ChassisSpeeds>;
static std::optional<frc::ChassisSpeeds> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::ChassisSpeeds& value);
};

View File

@@ -8,12 +8,15 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/DifferentialDriveKinematics.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::DifferentialDriveKinematics> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::DifferentialDriveKinematics Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufDifferentialDriveKinematics;
using InputStream = wpi::ProtoInputStream<frc::DifferentialDriveKinematics>;
using OutputStream = wpi::ProtoOutputStream<frc::DifferentialDriveKinematics>;
static std::optional<frc::DifferentialDriveKinematics> Unpack(
InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::DifferentialDriveKinematics& value);
};

View File

@@ -8,12 +8,17 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/DifferentialDriveWheelPositions.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::DifferentialDriveWheelPositions> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::DifferentialDriveWheelPositions Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufDifferentialDriveWheelPositions;
using InputStream =
wpi::ProtoInputStream<frc::DifferentialDriveWheelPositions>;
using OutputStream =
wpi::ProtoOutputStream<frc::DifferentialDriveWheelPositions>;
static std::optional<frc::DifferentialDriveWheelPositions> Unpack(
InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::DifferentialDriveWheelPositions& value);
};

View File

@@ -8,12 +8,16 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/DifferentialDriveWheelSpeeds.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::DifferentialDriveWheelSpeeds> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::DifferentialDriveWheelSpeeds Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufDifferentialDriveWheelSpeeds;
using InputStream = wpi::ProtoInputStream<frc::DifferentialDriveWheelSpeeds>;
using OutputStream =
wpi::ProtoOutputStream<frc::DifferentialDriveWheelSpeeds>;
static std::optional<frc::DifferentialDriveWheelSpeeds> Unpack(
InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::DifferentialDriveWheelSpeeds& value);
};

View File

@@ -8,12 +8,14 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/MecanumDriveKinematics.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::MecanumDriveKinematics> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::MecanumDriveKinematics Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufMecanumDriveKinematics;
using InputStream = wpi::ProtoInputStream<frc::MecanumDriveKinematics>;
using OutputStream = wpi::ProtoOutputStream<frc::MecanumDriveKinematics>;
static std::optional<frc::MecanumDriveKinematics> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::MecanumDriveKinematics& value);
};

View File

@@ -8,12 +8,15 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/MecanumDriveWheelPositions.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::MecanumDriveWheelPositions> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::MecanumDriveWheelPositions Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufMecanumDriveWheelPositions;
using InputStream = wpi::ProtoInputStream<frc::MecanumDriveWheelPositions>;
using OutputStream = wpi::ProtoOutputStream<frc::MecanumDriveWheelPositions>;
static std::optional<frc::MecanumDriveWheelPositions> Unpack(
InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::MecanumDriveWheelPositions& value);
};

View File

@@ -8,12 +8,15 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/MecanumDriveWheelSpeeds.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::MecanumDriveWheelSpeeds> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::MecanumDriveWheelSpeeds Unpack(
const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufMecanumDriveWheelSpeeds;
using InputStream = wpi::ProtoInputStream<frc::MecanumDriveWheelSpeeds>;
using OutputStream = wpi::ProtoOutputStream<frc::MecanumDriveWheelSpeeds>;
static std::optional<frc::MecanumDriveWheelSpeeds> Unpack(
InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::MecanumDriveWheelSpeeds& value);
};

View File

@@ -7,36 +7,40 @@
#include <stdexcept>
#include <fmt/format.h>
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/Protobuf.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "frc/kinematics/SwerveDriveKinematics.h"
#include "kinematics.pb.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <size_t NumModules>
struct wpi::Protobuf<frc::SwerveDriveKinematics<NumModules>> {
static google::protobuf::Message* New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufSwerveDriveKinematics>(arena);
}
using MessageStruct = wpi_proto_ProtobufSwerveDriveKinematics;
using InputStream =
wpi::ProtoInputStream<frc::SwerveDriveKinematics<NumModules>>;
using OutputStream =
wpi::ProtoOutputStream<frc::SwerveDriveKinematics<NumModules>>;
static frc::SwerveDriveKinematics<NumModules> Unpack(
const google::protobuf::Message& msg) {
auto m =
static_cast<const wpi::proto::ProtobufSwerveDriveKinematics*>(&msg);
if (m->modules_size() != NumModules) {
throw std::invalid_argument(fmt::format(
"Tried to unpack message with {} elements in modules into "
"SwerveDriveKinematics with {} modules",
m->modules_size(), NumModules));
static std::optional<frc::SwerveDriveKinematics<NumModules>> Unpack(
InputStream& stream) {
wpi::WpiArrayUnpackCallback<frc::Translation2d, NumModules> modules;
wpi_proto_ProtobufSwerveDriveKinematics msg{
.modules = modules.Callback(),
};
modules.SetLimits(wpi::DecodeLimits::Fail);
if (!stream.Decode(msg)) {
return {};
}
return frc::SwerveDriveKinematics<NumModules>{
wpi::UnpackProtobufArray<wpi::proto::ProtobufTranslation2d,
frc::Translation2d, NumModules>(m->modules())};
return frc::SwerveDriveKinematics<NumModules>{modules.Array()};
}
static void Pack(google::protobuf::Message* msg,
static bool Pack(OutputStream& stream,
const frc::SwerveDriveKinematics<NumModules>& value) {
auto m = static_cast<wpi::proto::ProtobufSwerveDriveKinematics*>(msg);
wpi::PackProtobufArray(m->mutable_modules(), value.GetModules());
wpi::PackCallback<frc::Translation2d> modules{value.GetModules()};
wpi_proto_ProtobufSwerveDriveKinematics msg{
.modules = modules.Callback(),
};
return stream.Encode(msg);
}
};

View File

@@ -8,11 +8,14 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/SwerveModulePosition.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::SwerveModulePosition> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::SwerveModulePosition Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufSwerveModulePosition;
using InputStream = wpi::ProtoInputStream<frc::SwerveModulePosition>;
using OutputStream = wpi::ProtoOutputStream<frc::SwerveModulePosition>;
static std::optional<frc::SwerveModulePosition> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::SwerveModulePosition& value);
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/kinematics/SwerveModuleState.h"
#include "wpimath/protobuf/kinematics.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::SwerveModuleState> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::SwerveModuleState Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::SwerveModuleState& value);
using MessageStruct = wpi_proto_ProtobufSwerveModuleState;
using InputStream = wpi::ProtoInputStream<frc::SwerveModuleState>;
using OutputStream = wpi::ProtoOutputStream<frc::SwerveModuleState>;
static std::optional<frc::SwerveModuleState> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::SwerveModuleState& value);
};

View File

@@ -7,50 +7,65 @@
#include <stdexcept>
#include <fmt/format.h>
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/Protobuf.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "frc/EigenCore.h"
#include "wpimath.pb.h"
#include "wpimath/protobuf/wpimath.npb.h"
template <int Rows, int Cols, int Options, int MaxRows, int MaxCols>
requires(Cols != 1)
struct wpi::Protobuf<frc::Matrixd<Rows, Cols, Options, MaxRows, MaxCols>> {
static google::protobuf::Message* New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufMatrix>(arena);
}
using MessageStruct = wpi_proto_ProtobufMatrix;
using InputStream = wpi::ProtoInputStream<
frc::Matrixd<Rows, Cols, Options, MaxRows, MaxCols>>;
using OutputStream = wpi::ProtoOutputStream<
frc::Matrixd<Rows, Cols, Options, MaxRows, MaxCols>>;
static frc::Matrixd<Rows, Cols, Options, MaxRows, MaxCols> Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufMatrix*>(&msg);
if (m->num_rows() != Rows || m->num_cols() != Cols) {
throw std::invalid_argument(fmt::format(
"Tried to unpack message with {} rows and {} columns into "
"Matrix with {} rows and {} columns",
m->num_rows(), m->num_cols(), Rows, Cols));
static std::optional<frc::Matrixd<Rows, Cols, Options, MaxRows, MaxCols>>
Unpack(InputStream& stream) {
constexpr bool isSmall = Rows * Cols * sizeof(double) < 256;
using UnpackType =
std::conditional_t<isSmall, wpi::UnpackCallback<double, Rows * Cols>,
wpi::StdVectorUnpackCallback<double, Rows * Cols>>;
UnpackType data;
data.Vec().reserve(Rows * Cols);
data.SetLimits(wpi::DecodeLimits::Fail);
wpi_proto_ProtobufMatrix msg;
msg.data = data.Callback();
if (!stream.Decode(msg)) {
return {};
}
if (m->data_size() != Rows * Cols) {
throw std::invalid_argument(
fmt::format("Tried to unpack message with {} elements in data into "
"Matrix with {} elements",
m->data_size(), Rows * Cols));
if (msg.num_rows != Rows || msg.num_cols != Cols) {
return {};
}
auto items = data.Items();
if (items.size() != Rows * Cols) {
return {};
}
frc::Matrixd<Rows, Cols, Options, MaxRows, MaxCols> mat;
for (int i = 0; i < Rows * Cols; i++) {
mat(i) = m->data(i);
mat(i) = items[i];
}
return mat;
}
static void Pack(
google::protobuf::Message* msg,
static bool Pack(
OutputStream& stream,
const frc::Matrixd<Rows, Cols, Options, MaxRows, MaxCols>& value) {
auto m = static_cast<wpi::proto::ProtobufMatrix*>(msg);
m->set_num_rows(Rows);
m->set_num_cols(Cols);
m->clear_data();
for (int i = 0; i < Rows * Cols; i++) {
m->add_data(value(i));
}
std::span<const double> dataSpan{value.data(),
static_cast<size_t>(Rows * Cols)};
wpi::PackCallback<double> data{dataSpan};
wpi_proto_ProtobufMatrix msg{
.num_rows = Rows,
.num_cols = Cols,
.data = data.Callback(),
};
return stream.Encode(msg);
}
};

View File

@@ -7,41 +7,58 @@
#include <stdexcept>
#include <fmt/format.h>
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/Protobuf.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "frc/EigenCore.h"
#include "wpimath.pb.h"
#include "wpimath/protobuf/wpimath.npb.h"
template <int Size, int Options, int MaxRows, int MaxCols>
struct wpi::Protobuf<frc::Matrixd<Size, 1, Options, MaxRows, MaxCols>> {
static google::protobuf::Message* New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufVector>(arena);
}
using MessageStruct = wpi_proto_ProtobufVector;
using InputStream =
wpi::ProtoInputStream<frc::Matrixd<Size, 1, Options, MaxRows, MaxCols>>;
using OutputStream =
wpi::ProtoOutputStream<frc::Matrixd<Size, 1, Options, MaxRows, MaxCols>>;
static frc::Matrixd<Size, 1, Options, MaxRows, MaxCols> Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufVector*>(&msg);
if (m->rows_size() != Size) {
throw std::invalid_argument(
fmt::format("Tried to unpack message with {} elements in rows into "
"Vector with {} rows",
m->rows_size(), Size));
static std::optional<frc::Matrixd<Size, 1, Options, MaxRows, MaxCols>> Unpack(
InputStream& stream) {
constexpr bool isSmall = Size * sizeof(double) < 256;
using UnpackType =
std::conditional_t<isSmall, wpi::UnpackCallback<double, Size>,
wpi::StdVectorUnpackCallback<double, Size>>;
UnpackType rows;
rows.Vec().reserve(Size);
rows.SetLimits(wpi::DecodeLimits::Fail);
wpi_proto_ProtobufVector msg{
.rows = rows.Callback(),
};
if (!stream.Decode(msg)) {
return {};
}
frc::Matrixd<Size, 1, Options, MaxRows, MaxCols> vec;
auto items = rows.Items();
if (items.size() != Size) {
return {};
}
frc::Matrixd<Size, 1, Options, MaxRows, MaxCols> mat;
for (int i = 0; i < Size; i++) {
vec(i) = m->rows(i);
mat(i) = items[i];
}
return vec;
return mat;
}
static void Pack(
google::protobuf::Message* msg,
static bool Pack(
OutputStream& stream,
const frc::Matrixd<Size, 1, Options, MaxRows, MaxCols>& value) {
auto m = static_cast<wpi::proto::ProtobufVector*>(msg);
m->clear_rows();
for (int i = 0; i < Size; i++) {
m->add_rows(value(i));
}
std::span<const double> rowsSpan{value.data(), static_cast<size_t>(Size)};
wpi::PackCallback<double> rows{rowsSpan};
wpi_proto_ProtobufVector msg{
.rows = rows.Callback(),
};
return stream.Encode(msg);
}
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/spline/CubicHermiteSpline.h"
#include "wpimath/protobuf/spline.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::CubicHermiteSpline> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::CubicHermiteSpline Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::CubicHermiteSpline& value);
using MessageStruct = wpi_proto_ProtobufCubicHermiteSpline;
using InputStream = wpi::ProtoInputStream<frc::CubicHermiteSpline>;
using OutputStream = wpi::ProtoOutputStream<frc::CubicHermiteSpline>;
static std::optional<frc::CubicHermiteSpline> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::CubicHermiteSpline& value);
};

View File

@@ -8,11 +8,14 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/spline/QuinticHermiteSpline.h"
#include "wpimath/protobuf/spline.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::QuinticHermiteSpline> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::QuinticHermiteSpline Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
using MessageStruct = wpi_proto_ProtobufQuinticHermiteSpline;
using InputStream = wpi::ProtoInputStream<frc::QuinticHermiteSpline>;
using OutputStream = wpi::ProtoOutputStream<frc::QuinticHermiteSpline>;
static std::optional<frc::QuinticHermiteSpline> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream,
const frc::QuinticHermiteSpline& value);
};

View File

@@ -8,10 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/system/plant/DCMotor.h"
#include "wpimath/protobuf/plant.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::DCMotor> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::DCMotor Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg, const frc::DCMotor& value);
using MessageStruct = wpi_proto_ProtobufDCMotor;
using InputStream = wpi::ProtoInputStream<frc::DCMotor>;
using OutputStream = wpi::ProtoOutputStream<frc::DCMotor>;
static std::optional<frc::DCMotor> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::DCMotor& value);
};

View File

@@ -5,48 +5,84 @@
#pragma once
#include <stdexcept>
#include <utility>
#include <fmt/format.h>
#include <wpi/ProtoHelper.h>
#include <wpi/protobuf/Protobuf.h>
#include <wpi/protobuf/ProtobufCallbacks.h>
#include "frc/proto/MatrixProto.h"
#include "frc/system/LinearSystem.h"
#include "system.pb.h"
#include "wpimath/protobuf/system.npb.h"
template <int States, int Inputs, int Outputs>
struct wpi::Protobuf<frc::LinearSystem<States, Inputs, Outputs>> {
static google::protobuf::Message* New(google::protobuf::Arena* arena) {
return wpi::CreateMessage<wpi::proto::ProtobufLinearSystem>(arena);
}
using MessageStruct = wpi_proto_ProtobufLinearSystem;
using InputStream =
wpi::ProtoInputStream<frc::LinearSystem<States, Inputs, Outputs>>;
using OutputStream =
wpi::ProtoOutputStream<frc::LinearSystem<States, Inputs, Outputs>>;
static frc::LinearSystem<States, Inputs, Outputs> Unpack(
const google::protobuf::Message& msg) {
auto m = static_cast<const wpi::proto::ProtobufLinearSystem*>(&msg);
if (m->num_states() != States || m->num_inputs() != Inputs ||
m->num_outputs() != Outputs) {
throw std::invalid_argument(fmt::format(
"Tried to unpack message with {} states and {} inputs and {} outputs "
"into LinearSystem with {} states and {} inputs and {} outputs",
m->num_states(), m->num_inputs(), m->num_outputs(), States, Inputs,
Outputs));
static std::optional<frc::LinearSystem<States, Inputs, Outputs>> Unpack(
InputStream& stream) {
wpi::UnpackCallback<frc::Matrixd<States, States>> a;
a.SetLimits(wpi::DecodeLimits::Fail);
wpi::UnpackCallback<frc::Matrixd<States, Inputs>> b;
a.SetLimits(wpi::DecodeLimits::Fail);
wpi::UnpackCallback<frc::Matrixd<Outputs, States>> c;
a.SetLimits(wpi::DecodeLimits::Fail);
wpi::UnpackCallback<frc::Matrixd<Outputs, Inputs>> d;
a.SetLimits(wpi::DecodeLimits::Fail);
wpi_proto_ProtobufLinearSystem msg;
msg.a = a.Callback();
msg.b = b.Callback();
msg.c = c.Callback();
msg.d = d.Callback();
if (!stream.Decode(msg)) {
return {};
}
if (msg.num_inputs != Inputs || msg.num_outputs != Outputs ||
msg.num_states != States) {
return {};
}
auto ai = a.Items();
auto bi = b.Items();
auto ci = c.Items();
auto di = d.Items();
if (ai.empty() || bi.empty() || ci.empty() || di.empty()) {
return {};
}
return frc::LinearSystem<States, Inputs, Outputs>{
wpi::UnpackProtobuf<frc::Matrixd<States, States>>(m->wpi_a()),
wpi::UnpackProtobuf<frc::Matrixd<States, Inputs>>(m->wpi_b()),
wpi::UnpackProtobuf<frc::Matrixd<Outputs, States>>(m->wpi_c()),
wpi::UnpackProtobuf<frc::Matrixd<Outputs, Inputs>>(m->wpi_d())};
std::move(ai[0]),
std::move(bi[0]),
std::move(ci[0]),
std::move(di[0]),
};
}
static void Pack(google::protobuf::Message* msg,
static bool Pack(OutputStream& stream,
const frc::LinearSystem<States, Inputs, Outputs>& value) {
auto m = static_cast<wpi::proto::ProtobufLinearSystem*>(msg);
m->set_num_states(States);
m->set_num_inputs(Inputs);
m->set_num_outputs(Outputs);
wpi::PackProtobuf(m->mutable_a(), value.A());
wpi::PackProtobuf(m->mutable_b(), value.B());
wpi::PackProtobuf(m->mutable_c(), value.C());
wpi::PackProtobuf(m->mutable_d(), value.D());
wpi::PackCallback a{&value.A()};
wpi::PackCallback b{&value.B()};
wpi::PackCallback c{&value.C()};
wpi::PackCallback d{&value.D()};
wpi_proto_ProtobufLinearSystem msg{
.num_states = States,
.num_inputs = Inputs,
.num_outputs = Outputs,
.a = a.Callback(),
.b = b.Callback(),
.c = c.Callback(),
.d = d.Callback(),
};
return stream.Encode(msg);
}
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/trajectory/Trajectory.h"
#include "wpimath/protobuf/trajectory.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Trajectory> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Trajectory Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Trajectory& value);
using MessageStruct = wpi_proto_ProtobufTrajectory;
using InputStream = wpi::ProtoInputStream<frc::Trajectory>;
using OutputStream = wpi::ProtoOutputStream<frc::Trajectory>;
static std::optional<frc::Trajectory> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Trajectory& value);
};

View File

@@ -8,11 +8,13 @@
#include <wpi/protobuf/Protobuf.h>
#include "frc/trajectory/Trajectory.h"
#include "wpimath/protobuf/trajectory.npb.h"
template <>
struct WPILIB_DLLEXPORT wpi::Protobuf<frc::Trajectory::State> {
static google::protobuf::Message* New(google::protobuf::Arena* arena);
static frc::Trajectory::State Unpack(const google::protobuf::Message& msg);
static void Pack(google::protobuf::Message* msg,
const frc::Trajectory::State& value);
using MessageStruct = wpi_proto_ProtobufTrajectoryState;
using InputStream = wpi::ProtoInputStream<frc::Trajectory::State>;
using OutputStream = wpi::ProtoOutputStream<frc::Trajectory::State>;
static std::optional<frc::Trajectory::State> Unpack(InputStream& stream);
static bool Pack(OutputStream& stream, const frc::Trajectory::State& value);
};

Some files were not shown because too many files have changed in this diff Show More