diff --git a/.github/workflows/pregen_all.py b/.github/workflows/pregen_all.py index 278e5c84cd8..581abe86834 100755 --- a/.github/workflows/pregen_all.py +++ b/.github/workflows/pregen_all.py @@ -19,6 +19,13 @@ def main(): subprocess.run( [sys.executable, f"{REPO_ROOT}/hal/generate_usage_reporting.py"], check=True ) + subprocess.run( + [ + sys.executable, + f"{REPO_ROOT}/hal/generate_nanopb.py", + ], + check=True, + ) subprocess.run( [sys.executable, f"{REPO_ROOT}/ntcore/generate_topics.py"], check=True ) diff --git a/cscore/build.gradle b/cscore/build.gradle index 9cbf42ff857..35cf43c7c96 100644 --- a/cscore/build.gradle +++ b/cscore/build.gradle @@ -187,7 +187,7 @@ model { lib project: ':wpigui', library: 'wpigui', linkage: 'static' lib library: 'cscore', linkage: 'shared' lib project: ':thirdparty:imgui_suite', library: 'imgui', linkage: 'static' - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/datalogtool/build.gradle b/datalogtool/build.gradle index 7ebfffe8cca..b35bffde1e7 100644 --- a/datalogtool/build.gradle +++ b/datalogtool/build.gradle @@ -93,7 +93,7 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/developerRobot/build.gradle b/developerRobot/build.gradle index 7d8a627b232..150fbe3ba16 100644 --- a/developerRobot/build.gradle +++ b/developerRobot/build.gradle @@ -64,30 +64,22 @@ def simProjects = ['halsim_gui'] deploy { targets { - roborio(RemoteTarget) { - directory = '/home/lvuser' + systemcore(RemoteTarget) { + directory = '/home/systemcore' maxChannels = 4 locations { ssh(SshDeployLocation) { - address = "172.22.11.2" - user = 'admin' - password = '' + address = "robot.local" + user = 'systemcore' + password = 'systemcorerules2027' ipv6 = false } } def remote = it - artifacts.registerFactory(WPIJREArtifact) { - return objects.newInstance(WPIJREArtifact, it, remote) - } - artifacts { all { - predeploy << { ctx -> - ctx.execute('. /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t 2> /dev/null') - ctx.execute("sed -i -e 's/\"exec /\"/' /usr/local/frc/bin/frcRunRobot.sh") - } postdeploy << { ctx -> ctx.execute("sync") ctx.execute("ldconfig") @@ -95,43 +87,40 @@ deploy { } developerRobotCpp(NativeExecutableArtifact) { - libraryDirectory = '/usr/local/frc/third-party/lib' + libraryDirectory = '/home/systemcore/frc/third-party/lib' def excludes = getLibraryFilter().getExcludes() excludes.add('**/*.so.debug') excludes.add('**/*.so.*.debug') postdeploy << { ctx -> - ctx.execute("echo '/home/lvuser/developerRobotCpp' > /home/lvuser/robotCommand") - ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand") - ctx.execute("setcap cap_sys_nice+eip \"/home/lvuser/developerRobotCpp\"") + ctx.execute("echo '/home/systemcore/developerRobotCpp' > /home/systemcore/robotCommand") + ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand") + ctx.execute("setcap cap_sys_nice+eip \"/home/systemcore/developerRobotCpp\"") ctx.execute('chmod +x developerRobotCpp') } } developerRobotCppStatic(NativeExecutableArtifact) { - libraryDirectory = '/usr/local/frc/third-party/lib' + libraryDirectory = '/home/systemcore/frc/third-party/lib' postdeploy << { ctx -> - ctx.execute("echo '/home/lvuser/developerRobotCppStatic' > /home/lvuser/robotCommand") - ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand") - ctx.execute("setcap cap_sys_nice+eip \"/home/lvuser/developerRobotCppStatic\"") + ctx.execute("echo '/home/systemcore/developerRobotCppStatic' > /home/systemcore/robotCommand") + ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand") + ctx.execute("setcap cap_sys_nice+eip \"/home/systemcore/developerRobotCppStatic\"") ctx.execute('chmod +x developerRobotCppStatic') } } developerRobotCppJava(NativeExecutableArtifact) { - libraryDirectory = '/usr/local/frc/third-party/lib' + libraryDirectory = '/home/systemcore/frc/third-party/lib' def excludes = getLibraryFilter().getExcludes() excludes.add('**/*.so.debug') excludes.add('**/*.so.*.debug') } - jre(WPIJREArtifact) { - } - developerRobotJava(JavaArtifact) { jarTask = shadowJar postdeploy << { ctx -> - ctx.execute("echo '/usr/local/frc/JRE/bin/java -XX:+UseSerialGC -Djava.library.path=/usr/local/frc/third-party/lib -Djava.lang.invoke.stringConcat=BC_SB -jar /home/lvuser/developerRobot-all.jar' > /home/lvuser/robotCommand") - ctx.execute("chmod +x /home/lvuser/robotCommand; chown lvuser /home/lvuser/robotCommand") + ctx.execute("echo '/usr/bin/java -XX:+UseG1GC -Djava.library.path=/home/systemcore/frc/third-party/lib -jar /home/systemcore/developerRobot-all.jar' > /home/systemcore/robotCommand") + ctx.execute("chmod +x /home/systemcore/robotCommand; chown systemcore /home/systemcore/robotCommand") } } } @@ -141,23 +130,23 @@ deploy { tasks.register('deployJava') { try { - dependsOn tasks.named('deployjreroborio') - dependsOn tasks.named('deploydeveloperRobotJavaroborio') - dependsOn tasks.named('deploydeveloperRobotCppJavaroborio') // Deploying shared C++ is how to get the Java shared libraries. + dependsOn tasks.named('deployjresystemcore') + dependsOn tasks.named('deploydeveloperRobotJavasystemcore') + dependsOn tasks.named('deploydeveloperRobotCppJavasystemcore') // Deploying shared C++ is how to get the Java shared libraries. } catch (ignored) { } } tasks.register('deployShared') { try { - dependsOn tasks.named('deploydeveloperRobotCpproborio') + dependsOn tasks.named('deploydeveloperRobotCppsystemcore') } catch (ignored) { } } tasks.register('deployStatic') { try { - dependsOn tasks.named('deploydeveloperRobotCppStaticroborio') + dependsOn tasks.named('deploydeveloperRobotCppStaticsystemcore') } catch (ignored) { } } @@ -179,10 +168,10 @@ model { } } binaries.all { binary -> - if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (binary.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { if (binary.buildType.name == 'debug') { - deploy.targets.roborio.artifacts.developerRobotCpp.binary = binary - deploy.targets.roborio.artifacts.developerRobotCppJava.binary = binary + deploy.targets.systemcore.artifacts.developerRobotCpp.binary = binary + deploy.targets.systemcore.artifacts.developerRobotCppJava.binary = binary } } lib project: ':apriltag', library: 'apriltag', linkage: 'shared' @@ -201,14 +190,10 @@ model { project(':hal').addHalJniDependency(binary) lib project: ':wpinet', library: 'wpinet', linkage: 'shared' lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' - if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') - } else { - def systemArch = getCurrentArch() - if (binary.targetPlatform.name == systemArch) { - simProjects.each { - lib project: ":simulation:$it", library: it, linkage: 'shared' - } + def systemArch = getCurrentArch() + if (binary.targetPlatform.name == systemArch) { + simProjects.each { + lib project: ":simulation:$it", library: it, linkage: 'shared' } } } @@ -229,9 +214,9 @@ model { } } binaries.all { binary -> - if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (binary.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { if (binary.buildType.name == 'debug') { - deploy.targets.roborio.artifacts.developerRobotCppStatic.binary = binary + deploy.targets.systemcore.artifacts.developerRobotCppStatic.binary = binary } } lib project: ':apriltag', library: 'apriltag', linkage: 'static' @@ -244,9 +229,6 @@ model { project(':hal').addHalDependency(binary, 'static') lib project: ':wpinet', library: 'wpinet', linkage: 'static' lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' - if (binary.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { - nativeUtils.useRequiredLibrary(binary, 'ni_link_libraries', 'ni_runtime_libraries') - } } } } @@ -302,20 +284,6 @@ model { } } } - installAthena(Task) { - $.binaries.each { - if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'developerRobotCpp') { - dependsOn it.tasks.install - } - } - } - installAthenaStatic(Task) { - $.binaries.each { - if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.roborio && it.component.name == 'developerRobotCppStatic') { - dependsOn it.tasks.install - } - } - } installSystemCore(Task) { $.binaries.each { @@ -324,6 +292,7 @@ model { } } } + installSystemCoreStatic(Task) { $.binaries.each { if (it in NativeExecutableBinarySpec && it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore && it.component.name == 'developerRobotCppStatic') { diff --git a/glass/build.gradle b/glass/build.gradle index 2b7a6105178..bbe40c00a52 100644 --- a/glass/build.gradle +++ b/glass/build.gradle @@ -85,7 +85,7 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } @@ -112,7 +112,7 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } @@ -153,7 +153,7 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/hal/.styleguide b/hal/.styleguide index 82c085c0894..b6fabcc27f8 100644 --- a/hal/.styleguide +++ b/hal/.styleguide @@ -17,6 +17,7 @@ generatedFileExclude { hal/src/main/native/systemcore/ctre/ hal/src/main/native/systemcore/rev/ UsageReporting\.h$ + src/generated/main/native/cpp } modifiableFileExclude { diff --git a/hal/BUILD.bazel b/hal/BUILD.bazel index 340a74c65e0..f0f54b1e1d4 100644 --- a/hal/BUILD.bazel +++ b/hal/BUILD.bazel @@ -9,6 +9,22 @@ cc_library( visibility = ["//hal:__subpackages__"], ) +cc_library( + name = "mrc_cc_headers", + hdrs = glob(["src/mrc/include/**"]), + includes = ["src/mrc/include"], + strip_include_prefix = "src/mrc/include", + visibility = ["//hal:__subpackages__"], +) + +cc_library( + name = "generated_mrc_cc_headers", + hdrs = glob(["src/generated/main/native/cpp/mrc/protobuf/**"]), + includes = ["src/generated/main/native/cpp/mrc/protobuf"], + strip_include_prefix = "src/generated/main/native/cpp/mrc/protobuf", + visibility = ["//hal:__subpackages__"], +) + filegroup( name = "generated_java", srcs = glob(["src/generated/main/java/**/*.java"]), @@ -39,7 +55,10 @@ filegroup( cc_library( name = "wpiHal.static", srcs = [":platform-srcs"] + glob( - ["src/main/native/cpp/**"], + [ + "src/main/native/cpp/**", + "src/generated/main/native/cpp/**", + ], exclude = ["src/main/native/cpp/jni/**"], ), hdrs = glob(["src/main/native/include/**/*"]), @@ -48,6 +67,8 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":generated_cc_headers", + ":mrc_cc_headers", + ":generated_mrc_cc_headers", "//wpiutil:wpiutil.static", ] + HAL_DEPS, ) diff --git a/hal/build.gradle b/hal/build.gradle index 60b8b5ca8f9..fbf581cceff 100644 --- a/hal/build.gradle +++ b/hal/build.gradle @@ -36,10 +36,11 @@ ext { exportedHeaders { srcDir 'src/main/native/include' srcDir generatedHeaders + srcDir 'src/mrc/include' } } } - } else { + } else { it.sources { simCpp(CppSourceSet) { source { @@ -49,10 +50,22 @@ ext { exportedHeaders { srcDir 'src/main/native/include' srcDir generatedHeaders + srcDir 'src/mrc/include' } } } } + it.sources { + nanopbCpp(CppSourceSet) { + source { + srcDirs 'src/generated/main/native/cpp' + include '**/*.cpp' + } + exportedHeaders { + srcDirs 'src/generated/main/native/cpp' + } + } + } } exeSplitSetup = { if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { @@ -107,3 +120,32 @@ model { } } } + +model { + components { + all { + it.sources.each { + it.exportedHeaders { + srcDirs 'src/mrc/include', + 'src/generated/main/native/cpp/mrc/protobuf' + } + } + } + } + binaries { + all { + if (!it.buildable || !(it instanceof NativeBinarySpec)) { + return + } + if (it.component.name == "${nativeName}JNI") { + project(':ntcore').addNtcoreDependency(it, 'static') + lib project: ':wpinet', library: 'wpinet', linkage: 'static' + lib project: ':wpiutil', library: 'wpiutil', linkage: 'static' + } else { + project(':ntcore').addNtcoreDependency(it, 'shared') + lib project: ':wpinet', library: 'wpinet', linkage: 'shared' + lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' + } + } + } +} diff --git a/hal/generate_nanopb.py b/hal/generate_nanopb.py new file mode 100644 index 00000000000..47e9898f750 --- /dev/null +++ b/hal/generate_nanopb.py @@ -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/mrc/protobuf", + type=Path, + ) + parser.add_argument( + "--proto_directory", + help="Optional. If set, will use this directory to glob for protobuf files", + default=dirname / "src/mrc/proto", + type=Path, + ) + args = parser.parse_args() + + generate_nanopb(args.nanopb, args.output_directory, args.proto_directory) + + +if __name__ == "__main__": + main() diff --git a/hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.cpp b/hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.cpp new file mode 100644 index 00000000000..01e15ceb2ee --- /dev/null +++ b/hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.cpp @@ -0,0 +1,305 @@ +// 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 "MrcComm.npb.h" +#if PB_PROTO_HEADER_VERSION != 40 +#error Regenerate this file with the current version of nanopb generator. +#endif + +#include +#include +static const uint8_t file_descriptor[] { +0x0a,0x0d,0x4d,0x72,0x63,0x43,0x6f,0x6d,0x6d,0x2e, +0x70,0x72,0x6f,0x74,0x6f,0x12,0x09,0x6d,0x72,0x63, +0x2e,0x70,0x72,0x6f,0x74,0x6f,0x22,0x7a,0x0a,0x14, +0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f, +0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x61,0x74,0x61, +0x12,0x20,0x0a,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e, +0x43,0x6f,0x75,0x6e,0x74,0x18,0x01,0x20,0x01,0x28, +0x0d,0x52,0x0b,0x42,0x75,0x74,0x74,0x6f,0x6e,0x43, +0x6f,0x75,0x6e,0x74,0x12,0x18,0x0a,0x07,0x42,0x75, +0x74,0x74,0x6f,0x6e,0x73,0x18,0x02,0x20,0x01,0x28, +0x07,0x52,0x07,0x42,0x75,0x74,0x74,0x6f,0x6e,0x73, +0x12,0x12,0x0a,0x04,0x41,0x78,0x65,0x73,0x18,0x03, +0x20,0x03,0x28,0x02,0x52,0x04,0x41,0x78,0x65,0x73, +0x12,0x12,0x0a,0x04,0x50,0x4f,0x56,0x73,0x18,0x04, +0x20,0x03,0x28,0x11,0x52,0x04,0x50,0x4f,0x56,0x73, +0x22,0xac,0x01,0x0a,0x13,0x50,0x72,0x6f,0x74,0x6f, +0x62,0x75,0x66,0x43,0x6f,0x6e,0x74,0x72,0x6f,0x6c, +0x44,0x61,0x74,0x61,0x12,0x20,0x0a,0x0b,0x43,0x6f, +0x6e,0x74,0x72,0x6f,0x6c,0x57,0x6f,0x72,0x64,0x18, +0x01,0x20,0x01,0x28,0x0d,0x52,0x0b,0x43,0x6f,0x6e, +0x74,0x72,0x6f,0x6c,0x57,0x6f,0x72,0x64,0x12,0x1c, +0x0a,0x09,0x4d,0x61,0x74,0x63,0x68,0x54,0x69,0x6d, +0x65,0x18,0x02,0x20,0x01,0x28,0x02,0x52,0x09,0x4d, +0x61,0x74,0x63,0x68,0x54,0x69,0x6d,0x65,0x12,0x3d, +0x0a,0x09,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b, +0x73,0x18,0x03,0x20,0x03,0x28,0x0b,0x32,0x1f,0x2e, +0x6d,0x72,0x63,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x2e, +0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f, +0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x61,0x74,0x61, +0x52,0x09,0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b, +0x73,0x12,0x16,0x0a,0x06,0x4f,0x70,0x4d,0x6f,0x64, +0x65,0x18,0x04,0x20,0x01,0x28,0x09,0x52,0x06,0x4f, +0x70,0x4d,0x6f,0x64,0x65,0x22,0xd8,0x01,0x0a,0x1a, +0x50,0x72,0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f, +0x79,0x73,0x74,0x69,0x63,0x6b,0x44,0x65,0x73,0x63, +0x72,0x69,0x70,0x74,0x6f,0x72,0x12,0x22,0x0a,0x0c, +0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,0x61, +0x6d,0x65,0x18,0x01,0x20,0x01,0x28,0x09,0x52,0x0c, +0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x4e,0x61, +0x6d,0x65,0x12,0x1c,0x0a,0x09,0x41,0x78,0x69,0x73, +0x54,0x79,0x70,0x65,0x73,0x18,0x02,0x20,0x03,0x28, +0x05,0x52,0x09,0x41,0x78,0x69,0x73,0x54,0x79,0x70, +0x65,0x73,0x12,0x16,0x0a,0x06,0x49,0x73,0x58,0x62, +0x6f,0x78,0x18,0x03,0x20,0x01,0x28,0x08,0x52,0x06, +0x49,0x73,0x58,0x62,0x6f,0x78,0x12,0x22,0x0a,0x0c, +0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x54,0x79, +0x70,0x65,0x18,0x04,0x20,0x01,0x28,0x05,0x52,0x0c, +0x4a,0x6f,0x79,0x73,0x74,0x69,0x63,0x6b,0x54,0x79, +0x70,0x65,0x12,0x20,0x0a,0x0b,0x42,0x75,0x74,0x74, +0x6f,0x6e,0x43,0x6f,0x75,0x6e,0x74,0x18,0x05,0x20, +0x01,0x28,0x05,0x52,0x0b,0x42,0x75,0x74,0x74,0x6f, +0x6e,0x43,0x6f,0x75,0x6e,0x74,0x12,0x1a,0x0a,0x08, +0x50,0x6f,0x76,0x43,0x6f,0x75,0x6e,0x74,0x18,0x06, +0x20,0x01,0x28,0x05,0x52,0x08,0x50,0x6f,0x76,0x43, +0x6f,0x75,0x6e,0x74,0x22,0x7e,0x0a,0x1a,0x50,0x72, +0x6f,0x74,0x6f,0x62,0x75,0x66,0x4a,0x6f,0x79,0x73, +0x74,0x69,0x63,0x6b,0x4f,0x75,0x74,0x70,0x75,0x74, +0x44,0x61,0x74,0x61,0x12,0x1e,0x0a,0x0a,0x48,0x69, +0x64,0x4f,0x75,0x74,0x70,0x75,0x74,0x73,0x18,0x01, +0x20,0x01,0x28,0x07,0x52,0x0a,0x48,0x69,0x64,0x4f, +0x75,0x74,0x70,0x75,0x74,0x73,0x12,0x1e,0x0a,0x0a, +0x4c,0x65,0x66,0x74,0x52,0x75,0x6d,0x62,0x6c,0x65, +0x18,0x02,0x20,0x01,0x28,0x02,0x52,0x0a,0x4c,0x65, +0x66,0x74,0x52,0x75,0x6d,0x62,0x6c,0x65,0x12,0x20, +0x0a,0x0b,0x52,0x69,0x67,0x68,0x74,0x52,0x75,0x6d, +0x62,0x6c,0x65,0x18,0x03,0x20,0x01,0x28,0x02,0x52, +0x0b,0x52,0x69,0x67,0x68,0x74,0x52,0x75,0x6d,0x62, +0x6c,0x65,0x22,0x5f,0x0a,0x13,0x50,0x72,0x6f,0x74, +0x6f,0x62,0x75,0x66,0x56,0x65,0x72,0x73,0x69,0x6f, +0x6e,0x49,0x6e,0x66,0x6f,0x12,0x1a,0x0a,0x08,0x44, +0x65,0x76,0x69,0x63,0x65,0x49,0x64,0x18,0x01,0x20, +0x01,0x28,0x07,0x52,0x08,0x44,0x65,0x76,0x69,0x63, +0x65,0x49,0x64,0x12,0x12,0x0a,0x04,0x4e,0x61,0x6d, +0x65,0x18,0x02,0x20,0x01,0x28,0x09,0x52,0x04,0x4e, +0x61,0x6d,0x65,0x12,0x18,0x0a,0x07,0x56,0x65,0x72, +0x73,0x69,0x6f,0x6e,0x18,0x03,0x20,0x01,0x28,0x09, +0x52,0x07,0x56,0x65,0x72,0x73,0x69,0x6f,0x6e,0x22, +0x95,0x01,0x0a,0x11,0x50,0x72,0x6f,0x74,0x6f,0x62, +0x75,0x66,0x4d,0x61,0x74,0x63,0x68,0x49,0x6e,0x66, +0x6f,0x12,0x1c,0x0a,0x09,0x45,0x76,0x65,0x6e,0x74, +0x4e,0x61,0x6d,0x65,0x18,0x01,0x20,0x01,0x28,0x09, +0x52,0x09,0x45,0x76,0x65,0x6e,0x74,0x4e,0x61,0x6d, +0x65,0x12,0x20,0x0a,0x0b,0x4d,0x61,0x74,0x63,0x68, +0x4e,0x75,0x6d,0x62,0x65,0x72,0x18,0x02,0x20,0x01, +0x28,0x05,0x52,0x0b,0x4d,0x61,0x74,0x63,0x68,0x4e, +0x75,0x6d,0x62,0x65,0x72,0x12,0x22,0x0a,0x0c,0x52, +0x65,0x70,0x6c,0x61,0x79,0x4e,0x75,0x6d,0x62,0x65, +0x72,0x18,0x03,0x20,0x01,0x28,0x05,0x52,0x0c,0x52, +0x65,0x70,0x6c,0x61,0x79,0x4e,0x75,0x6d,0x62,0x65, +0x72,0x12,0x1c,0x0a,0x09,0x4d,0x61,0x74,0x63,0x68, +0x54,0x79,0x70,0x65,0x18,0x04,0x20,0x01,0x28,0x05, +0x52,0x09,0x4d,0x61,0x74,0x63,0x68,0x54,0x79,0x70, +0x65,0x42,0x0f,0x0a,0x0d,0x63,0x6f,0x6d,0x2e,0x6d, +0x72,0x63,0x2e,0x70,0x72,0x6f,0x74,0x6f,0x4a,0xa1, +0x0c,0x0a,0x06,0x12,0x04,0x00,0x00,0x2e,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,0x26,0x0a, +0x09,0x0a,0x02,0x08,0x01,0x12,0x03,0x04,0x00,0x26, +0x0a,0x0a,0x0a,0x02,0x04,0x00,0x12,0x04,0x06,0x00, +0x0b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x00,0x01,0x12, +0x03,0x06,0x08,0x1c,0x0a,0x0b,0x0a,0x04,0x04,0x00, +0x02,0x00,0x12,0x03,0x07,0x04,0x1b,0x0a,0x0c,0x0a, +0x05,0x04,0x00,0x02,0x00,0x05,0x12,0x03,0x07,0x04, +0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x00,0x01, +0x12,0x03,0x07,0x0b,0x16,0x0a,0x0c,0x0a,0x05,0x04, +0x00,0x02,0x00,0x03,0x12,0x03,0x07,0x19,0x1a,0x0a, +0x0b,0x0a,0x04,0x04,0x00,0x02,0x01,0x12,0x03,0x08, +0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01, +0x05,0x12,0x03,0x08,0x04,0x0b,0x0a,0x0c,0x0a,0x05, +0x04,0x00,0x02,0x01,0x01,0x12,0x03,0x08,0x0c,0x13, +0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x01,0x03,0x12, +0x03,0x08,0x16,0x17,0x0a,0x0b,0x0a,0x04,0x04,0x00, +0x02,0x02,0x12,0x03,0x09,0x04,0x1c,0x0a,0x0c,0x0a, +0x05,0x04,0x00,0x02,0x02,0x04,0x12,0x03,0x09,0x04, +0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x05, +0x12,0x03,0x09,0x0d,0x12,0x0a,0x0c,0x0a,0x05,0x04, +0x00,0x02,0x02,0x01,0x12,0x03,0x09,0x13,0x17,0x0a, +0x0c,0x0a,0x05,0x04,0x00,0x02,0x02,0x03,0x12,0x03, +0x09,0x1a,0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x00,0x02, +0x03,0x12,0x03,0x0a,0x04,0x1d,0x0a,0x0c,0x0a,0x05, +0x04,0x00,0x02,0x03,0x04,0x12,0x03,0x0a,0x04,0x0c, +0x0a,0x0c,0x0a,0x05,0x04,0x00,0x02,0x03,0x05,0x12, +0x03,0x0a,0x0d,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x00, +0x02,0x03,0x01,0x12,0x03,0x0a,0x14,0x18,0x0a,0x0c, +0x0a,0x05,0x04,0x00,0x02,0x03,0x03,0x12,0x03,0x0a, +0x1b,0x1c,0x0a,0x0a,0x0a,0x02,0x04,0x01,0x12,0x04, +0x0d,0x00,0x12,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x01, +0x01,0x12,0x03,0x0d,0x08,0x1b,0x0a,0x0b,0x0a,0x04, +0x04,0x01,0x02,0x00,0x12,0x03,0x0e,0x04,0x1b,0x0a, +0x0c,0x0a,0x05,0x04,0x01,0x02,0x00,0x05,0x12,0x03, +0x0e,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02, +0x00,0x01,0x12,0x03,0x0e,0x0b,0x16,0x0a,0x0c,0x0a, +0x05,0x04,0x01,0x02,0x00,0x03,0x12,0x03,0x0e,0x19, +0x1a,0x0a,0x0b,0x0a,0x04,0x04,0x01,0x02,0x01,0x12, +0x03,0x0f,0x04,0x18,0x0a,0x0c,0x0a,0x05,0x04,0x01, +0x02,0x01,0x05,0x12,0x03,0x0f,0x04,0x09,0x0a,0x0c, +0x0a,0x05,0x04,0x01,0x02,0x01,0x01,0x12,0x03,0x0f, +0x0a,0x13,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x01, +0x03,0x12,0x03,0x0f,0x16,0x17,0x0a,0x0b,0x0a,0x04, +0x04,0x01,0x02,0x02,0x12,0x03,0x10,0x04,0x30,0x0a, +0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x04,0x12,0x03, +0x10,0x04,0x0c,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02, +0x02,0x06,0x12,0x03,0x10,0x0d,0x21,0x0a,0x0c,0x0a, +0x05,0x04,0x01,0x02,0x02,0x01,0x12,0x03,0x10,0x22, +0x2b,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x02,0x03, +0x12,0x03,0x10,0x2e,0x2f,0x0a,0x0b,0x0a,0x04,0x04, +0x01,0x02,0x03,0x12,0x03,0x11,0x04,0x16,0x0a,0x0c, +0x0a,0x05,0x04,0x01,0x02,0x03,0x05,0x12,0x03,0x11, +0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x01,0x02,0x03, +0x01,0x12,0x03,0x11,0x0b,0x11,0x0a,0x0c,0x0a,0x05, +0x04,0x01,0x02,0x03,0x03,0x12,0x03,0x11,0x14,0x15, +0x0a,0x0a,0x0a,0x02,0x04,0x02,0x12,0x04,0x14,0x00, +0x1b,0x01,0x0a,0x0a,0x0a,0x03,0x04,0x02,0x01,0x12, +0x03,0x14,0x08,0x22,0x0a,0x0b,0x0a,0x04,0x04,0x02, +0x02,0x00,0x12,0x03,0x15,0x04,0x1c,0x0a,0x0c,0x0a, +0x05,0x04,0x02,0x02,0x00,0x05,0x12,0x03,0x15,0x04, +0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x00,0x01, +0x12,0x03,0x15,0x0b,0x17,0x0a,0x0c,0x0a,0x05,0x04, +0x02,0x02,0x00,0x03,0x12,0x03,0x15,0x1a,0x1b,0x0a, +0x0b,0x0a,0x04,0x04,0x02,0x02,0x01,0x12,0x03,0x16, +0x04,0x21,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01, +0x04,0x12,0x03,0x16,0x04,0x0c,0x0a,0x0c,0x0a,0x05, +0x04,0x02,0x02,0x01,0x05,0x12,0x03,0x16,0x0d,0x12, +0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x01,0x01,0x12, +0x03,0x16,0x13,0x1c,0x0a,0x0c,0x0a,0x05,0x04,0x02, +0x02,0x01,0x03,0x12,0x03,0x16,0x1f,0x20,0x0a,0x0b, +0x0a,0x04,0x04,0x02,0x02,0x02,0x12,0x03,0x17,0x04, +0x14,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x05, +0x12,0x03,0x17,0x04,0x08,0x0a,0x0c,0x0a,0x05,0x04, +0x02,0x02,0x02,0x01,0x12,0x03,0x17,0x09,0x0f,0x0a, +0x0c,0x0a,0x05,0x04,0x02,0x02,0x02,0x03,0x12,0x03, +0x17,0x12,0x13,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02, +0x03,0x12,0x03,0x18,0x04,0x1b,0x0a,0x0c,0x0a,0x05, +0x04,0x02,0x02,0x03,0x05,0x12,0x03,0x18,0x04,0x09, +0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x03,0x01,0x12, +0x03,0x18,0x0a,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x02, +0x02,0x03,0x03,0x12,0x03,0x18,0x19,0x1a,0x0a,0x0b, +0x0a,0x04,0x04,0x02,0x02,0x04,0x12,0x03,0x19,0x04, +0x1a,0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x05, +0x12,0x03,0x19,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04, +0x02,0x02,0x04,0x01,0x12,0x03,0x19,0x0a,0x15,0x0a, +0x0c,0x0a,0x05,0x04,0x02,0x02,0x04,0x03,0x12,0x03, +0x19,0x18,0x19,0x0a,0x0b,0x0a,0x04,0x04,0x02,0x02, +0x05,0x12,0x03,0x1a,0x04,0x17,0x0a,0x0c,0x0a,0x05, +0x04,0x02,0x02,0x05,0x05,0x12,0x03,0x1a,0x04,0x09, +0x0a,0x0c,0x0a,0x05,0x04,0x02,0x02,0x05,0x01,0x12, +0x03,0x1a,0x0a,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x02, +0x02,0x05,0x03,0x12,0x03,0x1a,0x15,0x16,0x0a,0x0a, +0x0a,0x02,0x04,0x03,0x12,0x04,0x1d,0x00,0x21,0x01, +0x0a,0x0a,0x0a,0x03,0x04,0x03,0x01,0x12,0x03,0x1d, +0x08,0x22,0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x00, +0x12,0x03,0x1e,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04, +0x03,0x02,0x00,0x05,0x12,0x03,0x1e,0x04,0x0b,0x0a, +0x0c,0x0a,0x05,0x04,0x03,0x02,0x00,0x01,0x12,0x03, +0x1e,0x0c,0x16,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02, +0x00,0x03,0x12,0x03,0x1e,0x19,0x1a,0x0a,0x0b,0x0a, +0x04,0x04,0x03,0x02,0x01,0x12,0x03,0x1f,0x04,0x19, +0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02,0x01,0x05,0x12, +0x03,0x1f,0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x03, +0x02,0x01,0x01,0x12,0x03,0x1f,0x0a,0x14,0x0a,0x0c, +0x0a,0x05,0x04,0x03,0x02,0x01,0x03,0x12,0x03,0x1f, +0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04,0x03,0x02,0x02, +0x12,0x03,0x20,0x04,0x1a,0x0a,0x0c,0x0a,0x05,0x04, +0x03,0x02,0x02,0x05,0x12,0x03,0x20,0x04,0x09,0x0a, +0x0c,0x0a,0x05,0x04,0x03,0x02,0x02,0x01,0x12,0x03, +0x20,0x0a,0x15,0x0a,0x0c,0x0a,0x05,0x04,0x03,0x02, +0x02,0x03,0x12,0x03,0x20,0x18,0x19,0x0a,0x0a,0x0a, +0x02,0x04,0x04,0x12,0x04,0x23,0x00,0x27,0x01,0x0a, +0x0a,0x0a,0x03,0x04,0x04,0x01,0x12,0x03,0x23,0x08, +0x1b,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x00,0x12, +0x03,0x24,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x04, +0x02,0x00,0x05,0x12,0x03,0x24,0x04,0x0b,0x0a,0x0c, +0x0a,0x05,0x04,0x04,0x02,0x00,0x01,0x12,0x03,0x24, +0x0c,0x14,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x00, +0x03,0x12,0x03,0x24,0x17,0x18,0x0a,0x0b,0x0a,0x04, +0x04,0x04,0x02,0x01,0x12,0x03,0x25,0x04,0x14,0x0a, +0x0c,0x0a,0x05,0x04,0x04,0x02,0x01,0x05,0x12,0x03, +0x25,0x04,0x0a,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02, +0x01,0x01,0x12,0x03,0x25,0x0b,0x0f,0x0a,0x0c,0x0a, +0x05,0x04,0x04,0x02,0x01,0x03,0x12,0x03,0x25,0x12, +0x13,0x0a,0x0b,0x0a,0x04,0x04,0x04,0x02,0x02,0x12, +0x03,0x26,0x04,0x17,0x0a,0x0c,0x0a,0x05,0x04,0x04, +0x02,0x02,0x05,0x12,0x03,0x26,0x04,0x0a,0x0a,0x0c, +0x0a,0x05,0x04,0x04,0x02,0x02,0x01,0x12,0x03,0x26, +0x0b,0x12,0x0a,0x0c,0x0a,0x05,0x04,0x04,0x02,0x02, +0x03,0x12,0x03,0x26,0x15,0x16,0x0a,0x0a,0x0a,0x02, +0x04,0x05,0x12,0x04,0x29,0x00,0x2e,0x01,0x0a,0x0a, +0x0a,0x03,0x04,0x05,0x01,0x12,0x03,0x29,0x08,0x19, +0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x00,0x12,0x03, +0x2a,0x04,0x19,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02, +0x00,0x05,0x12,0x03,0x2a,0x04,0x0a,0x0a,0x0c,0x0a, +0x05,0x04,0x05,0x02,0x00,0x01,0x12,0x03,0x2a,0x0b, +0x14,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x00,0x03, +0x12,0x03,0x2a,0x17,0x18,0x0a,0x0b,0x0a,0x04,0x04, +0x05,0x02,0x01,0x12,0x03,0x2b,0x04,0x1a,0x0a,0x0c, +0x0a,0x05,0x04,0x05,0x02,0x01,0x05,0x12,0x03,0x2b, +0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x01, +0x01,0x12,0x03,0x2b,0x0a,0x15,0x0a,0x0c,0x0a,0x05, +0x04,0x05,0x02,0x01,0x03,0x12,0x03,0x2b,0x18,0x19, +0x0a,0x0b,0x0a,0x04,0x04,0x05,0x02,0x02,0x12,0x03, +0x2c,0x04,0x1b,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02, +0x02,0x05,0x12,0x03,0x2c,0x04,0x09,0x0a,0x0c,0x0a, +0x05,0x04,0x05,0x02,0x02,0x01,0x12,0x03,0x2c,0x0a, +0x16,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x02,0x03, +0x12,0x03,0x2c,0x19,0x1a,0x0a,0x0b,0x0a,0x04,0x04, +0x05,0x02,0x03,0x12,0x03,0x2d,0x04,0x18,0x0a,0x0c, +0x0a,0x05,0x04,0x05,0x02,0x03,0x05,0x12,0x03,0x2d, +0x04,0x09,0x0a,0x0c,0x0a,0x05,0x04,0x05,0x02,0x03, +0x01,0x12,0x03,0x2d,0x0a,0x13,0x0a,0x0c,0x0a,0x05, +0x04,0x05,0x02,0x03,0x03,0x12,0x03,0x2d,0x16,0x17, +0x62,0x06,0x70,0x72,0x6f,0x74,0x6f,0x33, +}; +static const char file_name[] = "MrcComm.proto"; +static const char mrc_proto_ProtobufJoystickData_name[] = "mrc.proto.ProtobufJoystickData"; +std::string_view mrc_proto_ProtobufJoystickData::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickData_name; } +pb_filedesc_t mrc_proto_ProtobufJoystickData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } +PB_BIND(mrc_proto_ProtobufJoystickData, mrc_proto_ProtobufJoystickData, AUTO) + + +static const char mrc_proto_ProtobufControlData_name[] = "mrc.proto.ProtobufControlData"; +std::string_view mrc_proto_ProtobufControlData::msg_name(void) noexcept { return mrc_proto_ProtobufControlData_name; } +pb_filedesc_t mrc_proto_ProtobufControlData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } +PB_BIND(mrc_proto_ProtobufControlData, mrc_proto_ProtobufControlData, AUTO) + + +static const char mrc_proto_ProtobufJoystickDescriptor_name[] = "mrc.proto.ProtobufJoystickDescriptor"; +std::string_view mrc_proto_ProtobufJoystickDescriptor::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickDescriptor_name; } +pb_filedesc_t mrc_proto_ProtobufJoystickDescriptor::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } +PB_BIND(mrc_proto_ProtobufJoystickDescriptor, mrc_proto_ProtobufJoystickDescriptor, AUTO) + + +static const char mrc_proto_ProtobufJoystickOutputData_name[] = "mrc.proto.ProtobufJoystickOutputData"; +std::string_view mrc_proto_ProtobufJoystickOutputData::msg_name(void) noexcept { return mrc_proto_ProtobufJoystickOutputData_name; } +pb_filedesc_t mrc_proto_ProtobufJoystickOutputData::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } +PB_BIND(mrc_proto_ProtobufJoystickOutputData, mrc_proto_ProtobufJoystickOutputData, AUTO) + + +static const char mrc_proto_ProtobufVersionInfo_name[] = "mrc.proto.ProtobufVersionInfo"; +std::string_view mrc_proto_ProtobufVersionInfo::msg_name(void) noexcept { return mrc_proto_ProtobufVersionInfo_name; } +pb_filedesc_t mrc_proto_ProtobufVersionInfo::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } +PB_BIND(mrc_proto_ProtobufVersionInfo, mrc_proto_ProtobufVersionInfo, AUTO) + + +static const char mrc_proto_ProtobufMatchInfo_name[] = "mrc.proto.ProtobufMatchInfo"; +std::string_view mrc_proto_ProtobufMatchInfo::msg_name(void) noexcept { return mrc_proto_ProtobufMatchInfo_name; } +pb_filedesc_t mrc_proto_ProtobufMatchInfo::file_descriptor(void) noexcept { return {::file_name, ::file_descriptor}; } +PB_BIND(mrc_proto_ProtobufMatchInfo, mrc_proto_ProtobufMatchInfo, AUTO) + + + diff --git a/hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.h b/hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.h new file mode 100644 index 00000000000..8818758c1e1 --- /dev/null +++ b/hal/src/generated/main/native/cpp/mrc/protobuf/MrcComm.npb.h @@ -0,0 +1,185 @@ +// 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_MRC_PROTO_MRCCOMM_NPB_H_INCLUDED +#define PB_MRC_PROTO_MRCCOMM_NPB_H_INCLUDED +#include +#include +#include + +#if PB_PROTO_HEADER_VERSION != 40 +#error Regenerate this file with the current version of nanopb generator. +#endif + +/* Struct definitions */ +typedef struct _mrc_proto_ProtobufJoystickData { + 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 ButtonCount; + uint32_t Buttons; + pb_callback_t Axes; + pb_callback_t POVs; +} mrc_proto_ProtobufJoystickData; + +typedef struct _mrc_proto_ProtobufControlData { + 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 ControlWord; + float MatchTime; + pb_callback_t Joysticks; + pb_callback_t OpMode; +} mrc_proto_ProtobufControlData; + +typedef struct _mrc_proto_ProtobufJoystickDescriptor { + 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 JoystickName; + pb_callback_t AxisTypes; + bool IsXbox; + int32_t JoystickType; + int32_t ButtonCount; + int32_t PovCount; +} mrc_proto_ProtobufJoystickDescriptor; + +typedef struct _mrc_proto_ProtobufJoystickOutputData { + 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 HidOutputs; + float LeftRumble; + float RightRumble; +} mrc_proto_ProtobufJoystickOutputData; + +typedef struct _mrc_proto_ProtobufVersionInfo { + 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 DeviceId; + pb_callback_t Name; + pb_callback_t Version; +} mrc_proto_ProtobufVersionInfo; + +typedef struct _mrc_proto_ProtobufMatchInfo { + 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 EventName; + int32_t MatchNumber; + int32_t ReplayNumber; + int32_t MatchType; +} mrc_proto_ProtobufMatchInfo; + + +/* Initializer values for message structs */ +#define mrc_proto_ProtobufJoystickData_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}} +#define mrc_proto_ProtobufControlData_init_default {0, 0, {{NULL}, NULL}, {{NULL}, NULL}} +#define mrc_proto_ProtobufJoystickDescriptor_init_default {{{NULL}, NULL}, {{NULL}, NULL}, 0, 0, 0, 0} +#define mrc_proto_ProtobufJoystickOutputData_init_default {0, 0, 0} +#define mrc_proto_ProtobufVersionInfo_init_default {0, {{NULL}, NULL}, {{NULL}, NULL}} +#define mrc_proto_ProtobufMatchInfo_init_default {{{NULL}, NULL}, 0, 0, 0} +#define mrc_proto_ProtobufJoystickData_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}} +#define mrc_proto_ProtobufControlData_init_zero {0, 0, {{NULL}, NULL}, {{NULL}, NULL}} +#define mrc_proto_ProtobufJoystickDescriptor_init_zero {{{NULL}, NULL}, {{NULL}, NULL}, 0, 0, 0, 0} +#define mrc_proto_ProtobufJoystickOutputData_init_zero {0, 0, 0} +#define mrc_proto_ProtobufVersionInfo_init_zero {0, {{NULL}, NULL}, {{NULL}, NULL}} +#define mrc_proto_ProtobufMatchInfo_init_zero {{{NULL}, NULL}, 0, 0, 0} + +/* Field tags (for use in manual encoding/decoding) */ +#define mrc_proto_ProtobufJoystickData_ButtonCount_tag 1 +#define mrc_proto_ProtobufJoystickData_Buttons_tag 2 +#define mrc_proto_ProtobufJoystickData_Axes_tag 3 +#define mrc_proto_ProtobufJoystickData_POVs_tag 4 +#define mrc_proto_ProtobufControlData_ControlWord_tag 1 +#define mrc_proto_ProtobufControlData_MatchTime_tag 2 +#define mrc_proto_ProtobufControlData_Joysticks_tag 3 +#define mrc_proto_ProtobufControlData_OpMode_tag 4 +#define mrc_proto_ProtobufJoystickDescriptor_JoystickName_tag 1 +#define mrc_proto_ProtobufJoystickDescriptor_AxisTypes_tag 2 +#define mrc_proto_ProtobufJoystickDescriptor_IsXbox_tag 3 +#define mrc_proto_ProtobufJoystickDescriptor_JoystickType_tag 4 +#define mrc_proto_ProtobufJoystickDescriptor_ButtonCount_tag 5 +#define mrc_proto_ProtobufJoystickDescriptor_PovCount_tag 6 +#define mrc_proto_ProtobufJoystickOutputData_HidOutputs_tag 1 +#define mrc_proto_ProtobufJoystickOutputData_LeftRumble_tag 2 +#define mrc_proto_ProtobufJoystickOutputData_RightRumble_tag 3 +#define mrc_proto_ProtobufVersionInfo_DeviceId_tag 1 +#define mrc_proto_ProtobufVersionInfo_Name_tag 2 +#define mrc_proto_ProtobufVersionInfo_Version_tag 3 +#define mrc_proto_ProtobufMatchInfo_EventName_tag 1 +#define mrc_proto_ProtobufMatchInfo_MatchNumber_tag 2 +#define mrc_proto_ProtobufMatchInfo_ReplayNumber_tag 3 +#define mrc_proto_ProtobufMatchInfo_MatchType_tag 4 + +/* Struct field encoding specification for nanopb */ +#define mrc_proto_ProtobufJoystickData_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, ButtonCount, 1) \ +X(a, STATIC, SINGULAR, FIXED32, Buttons, 2) \ +X(a, CALLBACK, REPEATED, FLOAT, Axes, 3) \ +X(a, CALLBACK, REPEATED, SINT32, POVs, 4) +#define mrc_proto_ProtobufJoystickData_CALLBACK pb_default_field_callback +#define mrc_proto_ProtobufJoystickData_DEFAULT NULL + +#define mrc_proto_ProtobufControlData_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, UINT32, ControlWord, 1) \ +X(a, STATIC, SINGULAR, FLOAT, MatchTime, 2) \ +X(a, CALLBACK, REPEATED, MESSAGE, Joysticks, 3) \ +X(a, CALLBACK, SINGULAR, STRING, OpMode, 4) +#define mrc_proto_ProtobufControlData_CALLBACK pb_default_field_callback +#define mrc_proto_ProtobufControlData_DEFAULT NULL +#define mrc_proto_ProtobufControlData_Joysticks_MSGTYPE mrc_proto_ProtobufJoystickData + +#define mrc_proto_ProtobufJoystickDescriptor_FIELDLIST(X, a) \ +X(a, CALLBACK, SINGULAR, STRING, JoystickName, 1) \ +X(a, CALLBACK, REPEATED, INT32, AxisTypes, 2) \ +X(a, STATIC, SINGULAR, BOOL, IsXbox, 3) \ +X(a, STATIC, SINGULAR, INT32, JoystickType, 4) \ +X(a, STATIC, SINGULAR, INT32, ButtonCount, 5) \ +X(a, STATIC, SINGULAR, INT32, PovCount, 6) +#define mrc_proto_ProtobufJoystickDescriptor_CALLBACK pb_default_field_callback +#define mrc_proto_ProtobufJoystickDescriptor_DEFAULT NULL + +#define mrc_proto_ProtobufJoystickOutputData_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, FIXED32, HidOutputs, 1) \ +X(a, STATIC, SINGULAR, FLOAT, LeftRumble, 2) \ +X(a, STATIC, SINGULAR, FLOAT, RightRumble, 3) +#define mrc_proto_ProtobufJoystickOutputData_CALLBACK NULL +#define mrc_proto_ProtobufJoystickOutputData_DEFAULT NULL + +#define mrc_proto_ProtobufVersionInfo_FIELDLIST(X, a) \ +X(a, STATIC, SINGULAR, FIXED32, DeviceId, 1) \ +X(a, CALLBACK, SINGULAR, STRING, Name, 2) \ +X(a, CALLBACK, SINGULAR, STRING, Version, 3) +#define mrc_proto_ProtobufVersionInfo_CALLBACK pb_default_field_callback +#define mrc_proto_ProtobufVersionInfo_DEFAULT NULL + +#define mrc_proto_ProtobufMatchInfo_FIELDLIST(X, a) \ +X(a, CALLBACK, SINGULAR, STRING, EventName, 1) \ +X(a, STATIC, SINGULAR, INT32, MatchNumber, 2) \ +X(a, STATIC, SINGULAR, INT32, ReplayNumber, 3) \ +X(a, STATIC, SINGULAR, INT32, MatchType, 4) +#define mrc_proto_ProtobufMatchInfo_CALLBACK pb_default_field_callback +#define mrc_proto_ProtobufMatchInfo_DEFAULT NULL + +/* Maximum encoded size of messages (where known) */ +/* mrc_proto_ProtobufJoystickData_size depends on runtime parameters */ +/* mrc_proto_ProtobufControlData_size depends on runtime parameters */ +/* mrc_proto_ProtobufJoystickDescriptor_size depends on runtime parameters */ +/* mrc_proto_ProtobufVersionInfo_size depends on runtime parameters */ +/* mrc_proto_ProtobufMatchInfo_size depends on runtime parameters */ +#define MRC_PROTO_MRCCOMM_NPB_H_MAX_SIZE mrc_proto_ProtobufJoystickOutputData_size +#define mrc_proto_ProtobufJoystickOutputData_size 15 + + +#endif diff --git a/hal/src/main/native/cpp/proto/ControlDataProto.cpp b/hal/src/main/native/cpp/proto/ControlDataProto.cpp new file mode 100644 index 00000000000..372f020a744 --- /dev/null +++ b/hal/src/main/native/cpp/proto/ControlDataProto.cpp @@ -0,0 +1,163 @@ +// 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. + +#include +#include + +#include + +#include "hal/proto/ControlData.h" + +static_assert(sizeof(mrc::ControlFlags) == sizeof(uint32_t)); + +namespace { +constexpr uint32_t EnabledMask = 0x1; +constexpr uint32_t EStopMask = 0x8; +constexpr uint32_t FmsConnectedMask = 0x10; +constexpr uint32_t DsConnectedMask = 0x20; +constexpr uint32_t WatchdogActiveMask = 0x40; +constexpr uint32_t AllianceMask = 0x1F80; + +constexpr uint32_t EnabledShift = 0; +constexpr uint32_t EStopShift = 3; +constexpr uint32_t FmsConnectedShift = 4; +constexpr uint32_t DsConnectedShift = 5; +constexpr uint32_t WatchdogActiveShift = 6; +constexpr uint32_t AllianceShift = 7; + +#define WORD_TO_INT(Name) Ret |= (Word.Name << Name##Shift) + +constexpr uint32_t FromControlWord(mrc::ControlFlags Word) { + uint32_t Ret = 0; + WORD_TO_INT(Enabled); + WORD_TO_INT(EStop); + WORD_TO_INT(FmsConnected); + WORD_TO_INT(DsConnected); + WORD_TO_INT(WatchdogActive); + WORD_TO_INT(Alliance); + return Ret; +} + +#undef WORD_TO_INT + +#define INT_TO_WORD(Name) Ret.Name = ((Word & Name##Mask) >> Name##Shift) + +constexpr mrc::ControlFlags ToControlWord(uint32_t Word) { + mrc::ControlFlags Ret = {}; + INT_TO_WORD(Enabled); + INT_TO_WORD(EStop); + INT_TO_WORD(FmsConnected); + INT_TO_WORD(DsConnected); + INT_TO_WORD(WatchdogActive); + INT_TO_WORD(Alliance); + return Ret; +} + +} // namespace + +std::optional wpi::Protobuf::Unpack( + InputStream& Stream) { + wpi::UnpackCallback JoystickCb; + wpi::UnpackCallback OpModeCb; + + mrc_proto_ProtobufControlData Msg{ + .ControlWord = 0, + .MatchTime = 0, + .Joysticks = JoystickCb.Callback(), + .OpMode = OpModeCb.Callback(), + }; + + if (!Stream.Decode(Msg)) { + return {}; + } + + auto Joysticks = JoystickCb.Items(); + auto OpMode = OpModeCb.Items(); + + mrc::ControlData ControlData; + + if (!OpMode.empty()) { + ControlData.MoveOpMode(std::move(OpMode[0])); + } + + ControlData.ControlWord = ToControlWord(Msg.ControlWord); + ControlData.MatchTime = Msg.MatchTime; + ControlData.SetJoystickCount(Joysticks.size()); + + for (size_t i = 0; i < ControlData.GetJoystickCount(); i++) { + ControlData.Joysticks()[i] = Joysticks[i]; + } + + return ControlData; +} + +bool wpi::Protobuf::Pack(OutputStream& Stream, + const mrc::ControlData& Value) { + std::string_view OpMode = Value.GetOpMode(); + wpi::PackCallback OpModeCb{&OpMode}; + std::span Sticks = Value.Joysticks(); + wpi::PackCallback Joysticks{Sticks}; + + mrc_proto_ProtobufControlData Msg{ + .ControlWord = FromControlWord(Value.ControlWord), + .MatchTime = Value.MatchTime, + .Joysticks = Joysticks.Callback(), + .OpMode = OpModeCb.Callback(), + }; + + return Stream.Encode(Msg); +} + +std::optional wpi::Protobuf::Unpack( + InputStream& Stream) { + wpi::UnpackCallback AxesCb; + wpi::UnpackCallback PovsCb; + + mrc_proto_ProtobufJoystickData Msg{ + .ButtonCount = 0, + .Buttons = 0, + .Axes = AxesCb.Callback(), + .POVs = PovsCb.Callback(), + }; + + if (!Stream.Decode(Msg)) { + return {}; + } + + auto Axes = AxesCb.Items(); + auto Povs = PovsCb.Items(); + + mrc::Joystick Joystick; + Joystick.Axes.SetCount(Axes.size()); + + for (size_t i = 0; i < Joystick.Axes.GetCount(); i++) { + Joystick.Axes.Axes()[i] = Axes[i]; + } + + Joystick.Povs.SetCount(Povs.size()); + + for (size_t i = 0; i < Joystick.Povs.GetCount(); i++) { + Joystick.Povs.Povs()[i] = Povs[i]; + } + + Joystick.Buttons.SetCount(Msg.ButtonCount); + Joystick.Buttons.Buttons = Msg.Buttons; + + return Joystick; +} + +bool wpi::Protobuf::Pack(OutputStream& Stream, + const mrc::Joystick& Value) { + wpi::PackCallback AxesCb{Value.Axes.Axes()}; + wpi::PackCallback PovsCb{Value.Povs.Povs()}; + + mrc_proto_ProtobufJoystickData Msg{ + .ButtonCount = static_cast(Value.Buttons.GetCount()), + .Buttons = Value.Buttons.Buttons, + .Axes = AxesCb.Callback(), + .POVs = PovsCb.Callback(), + }; + + return Stream.Encode(Msg); +} diff --git a/hal/src/main/native/cpp/proto/JoystickDescriptorProto.cpp b/hal/src/main/native/cpp/proto/JoystickDescriptorProto.cpp new file mode 100644 index 00000000000..15aef89139e --- /dev/null +++ b/hal/src/main/native/cpp/proto/JoystickDescriptorProto.cpp @@ -0,0 +1,68 @@ +// 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. + +#include +#include + +#include + +#include "hal/proto/JoystickDescriptor.h" + +std::optional +wpi::Protobuf::Unpack(InputStream& Stream) { + wpi::UnpackCallback JoystickNameCb; + wpi::UnpackCallback AxisTypesCb; + + mrc_proto_ProtobufJoystickDescriptor Msg; + Msg.JoystickName = JoystickNameCb.Callback(); + Msg.AxisTypes = AxisTypesCb.Callback(); + + if (!Stream.Decode(Msg)) { + return {}; + } + + auto JoystickName = JoystickNameCb.Items(); + auto AxisTypes = AxisTypesCb.Items(); + + if (JoystickName.empty()) { + return {}; + } + + mrc::JoystickDescriptor OutputData; + OutputData.MoveName(std::move(JoystickName[0])); + + OutputData.SetAxesCount(AxisTypes.size()); + + for (size_t i = 0; i < OutputData.GetAxesCount(); i++) { + OutputData.AxesTypes()[i] = AxisTypes[i]; + } + + OutputData.SetPovsCount(Msg.PovCount); + OutputData.SetButtonsCount(Msg.ButtonCount); + + OutputData.IsXbox = Msg.IsXbox ? 1 : 0; + OutputData.Type = Msg.JoystickType; + + return OutputData; +} + +bool wpi::Protobuf::Pack( + OutputStream& Stream, const mrc::JoystickDescriptor& Value) { + std::string_view JoystickName = Value.GetName(); + wpi::PackCallback JoystickNameCb{&JoystickName}; + + std::span AxisTypes = Value.AxesTypes(); + wpi::PackCallback AxisTypesCb{AxisTypes}; + + mrc_proto_ProtobufJoystickDescriptor Msg{ + .JoystickName = JoystickNameCb.Callback(), + .AxisTypes = AxisTypesCb.Callback(), + .IsXbox = Value.IsXbox ? true : false, + .JoystickType = Value.Type, + .ButtonCount = static_cast(Value.GetButtonsCount()), + .PovCount = static_cast(Value.GetPovsCount()), + }; + + return Stream.Encode(Msg); +} diff --git a/hal/src/main/native/cpp/proto/JoystickOutputDataProto.cpp b/hal/src/main/native/cpp/proto/JoystickOutputDataProto.cpp new file mode 100644 index 00000000000..cd6a3d70b26 --- /dev/null +++ b/hal/src/main/native/cpp/proto/JoystickOutputDataProto.cpp @@ -0,0 +1,33 @@ +// 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. + +#include + +#include "hal/proto/JoystickOutputData.h" + +std::optional +wpi::Protobuf::Unpack(InputStream& Stream) { + mrc_proto_ProtobufJoystickOutputData Msg; + + if (!Stream.Decode(Msg)) { + return {}; + } + + return mrc::JoystickOutputData{ + .HidOutputs = Msg.HidOutputs, + .LeftRumble = Msg.LeftRumble, + .RightRumble = Msg.RightRumble, + }; +} + +bool wpi::Protobuf::Pack( + OutputStream& Stream, const mrc::JoystickOutputData& Value) { + mrc_proto_ProtobufJoystickOutputData Msg{ + .HidOutputs = Value.HidOutputs, + .LeftRumble = Value.LeftRumble, + .RightRumble = Value.RightRumble, + }; + + return Stream.Encode(Msg); +} diff --git a/hal/src/main/native/cpp/proto/MatchInfoProto.cpp b/hal/src/main/native/cpp/proto/MatchInfoProto.cpp new file mode 100644 index 00000000000..537655477db --- /dev/null +++ b/hal/src/main/native/cpp/proto/MatchInfoProto.cpp @@ -0,0 +1,52 @@ +// 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. + +#include +#include + +#include + +#include "hal/proto/MatchInfo.h" + +std::optional wpi::Protobuf::Unpack( + InputStream& Stream) { + wpi::UnpackCallback NameCb; + + mrc_proto_ProtobufMatchInfo Msg; + Msg.EventName = NameCb.Callback(); + + if (!Stream.Decode(Msg)) { + return {}; + } + + auto Name = NameCb.Items(); + + if (Name.empty()) { + return {}; + } + + mrc::MatchInfo OutputData; + OutputData.MoveEventName(std::move(Name[0])); + + OutputData.MatchNumber = Msg.MatchNumber; + OutputData.ReplayNumber = Msg.ReplayNumber; + OutputData.Type = static_cast(Msg.MatchType); + + return OutputData; +} + +bool wpi::Protobuf::Pack(OutputStream& Stream, + const mrc::MatchInfo& Value) { + std::string_view EventNameStr = Value.GetEventName(); + wpi::PackCallback EventName{&EventNameStr}; + + mrc_proto_ProtobufMatchInfo Msg{ + .EventName = EventName.Callback(), + .MatchNumber = Value.MatchNumber, + .ReplayNumber = Value.ReplayNumber, + .MatchType = static_cast(Value.Type), + }; + + return Stream.Encode(Msg); +} diff --git a/hal/src/main/native/cpp/proto/VersionInfoProto.cpp b/hal/src/main/native/cpp/proto/VersionInfoProto.cpp new file mode 100644 index 00000000000..200029ea2ed --- /dev/null +++ b/hal/src/main/native/cpp/proto/VersionInfoProto.cpp @@ -0,0 +1,56 @@ +// 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. + +#include +#include + +#include + +#include "hal/proto/VersionInfo.h" + +std::optional wpi::Protobuf::Unpack( + InputStream& Stream) { + wpi::UnpackCallback NameCb; + wpi::UnpackCallback VersionCb; + + mrc_proto_ProtobufVersionInfo Msg{ + .DeviceId = 0, + .Name = NameCb.Callback(), + .Version = VersionCb.Callback(), + }; + + if (!Stream.Decode(Msg)) { + return {}; + } + + auto Name = NameCb.Items(); + auto Version = VersionCb.Items(); + + if (Name.empty() || Version.empty()) { + return {}; + } + + mrc::VersionInfo ToRet; + + ToRet.DeviceId = Msg.DeviceId; + ToRet.MoveName(std::move(Name[0])); + ToRet.MoveVersion(std::move(Version[0])); + + return ToRet; +} + +bool wpi::Protobuf::Pack(OutputStream& Stream, + const mrc::VersionInfo& Value) { + std::string_view NameView = Value.GetName(); + std::string_view VersionView = Value.GetVersion(); + wpi::PackCallback NameCb{&NameView}; + wpi::PackCallback VersionCb{&VersionView}; + + mrc_proto_ProtobufVersionInfo Msg{ + .DeviceId = Value.DeviceId, + .Name = NameCb.Callback(), + .Version = VersionCb.Callback(), + }; + return Stream.Encode(Msg); +} diff --git a/hal/src/main/native/include/hal/proto/ControlData.h b/hal/src/main/native/include/hal/proto/ControlData.h new file mode 100644 index 00000000000..e5039a233df --- /dev/null +++ b/hal/src/main/native/include/hal/proto/ControlData.h @@ -0,0 +1,30 @@ +// 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. + +#pragma once + +#include + +#include + +#include "MrcComm.npb.h" +#include "mrc/NetComm.h" + +template <> +struct wpi::Protobuf { + using MessageStruct = mrc_proto_ProtobufControlData; + using InputStream = wpi::ProtoInputStream; + using OutputStream = wpi::ProtoOutputStream; + static std::optional Unpack(InputStream& Stream); + static bool Pack(OutputStream& Stream, const mrc::ControlData& Value); +}; + +template <> +struct wpi::Protobuf { + using MessageStruct = mrc_proto_ProtobufJoystickData; + using InputStream = wpi::ProtoInputStream; + using OutputStream = wpi::ProtoOutputStream; + static std::optional Unpack(InputStream& Stream); + static bool Pack(OutputStream& Stream, const mrc::Joystick& Value); +}; diff --git a/hal/src/main/native/include/hal/proto/JoystickDescriptor.h b/hal/src/main/native/include/hal/proto/JoystickDescriptor.h new file mode 100644 index 00000000000..42a5eeceae0 --- /dev/null +++ b/hal/src/main/native/include/hal/proto/JoystickDescriptor.h @@ -0,0 +1,21 @@ +// 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. + +#pragma once + +#include + +#include + +#include "MrcComm.npb.h" +#include "mrc/NetComm.h" + +template <> +struct wpi::Protobuf { + using MessageStruct = mrc_proto_ProtobufJoystickDescriptor; + using InputStream = wpi::ProtoInputStream; + using OutputStream = wpi::ProtoOutputStream; + static std::optional Unpack(InputStream& Stream); + static bool Pack(OutputStream& Stream, const mrc::JoystickDescriptor& Value); +}; diff --git a/hal/src/main/native/include/hal/proto/JoystickOutputData.h b/hal/src/main/native/include/hal/proto/JoystickOutputData.h new file mode 100644 index 00000000000..8dc4c4eab4f --- /dev/null +++ b/hal/src/main/native/include/hal/proto/JoystickOutputData.h @@ -0,0 +1,21 @@ +// 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. + +#pragma once + +#include + +#include + +#include "MrcComm.npb.h" +#include "mrc/NetComm.h" + +template <> +struct wpi::Protobuf { + using MessageStruct = mrc_proto_ProtobufJoystickOutputData; + using InputStream = wpi::ProtoInputStream; + using OutputStream = wpi::ProtoOutputStream; + static std::optional Unpack(InputStream& Stream); + static bool Pack(OutputStream& Stream, const mrc::JoystickOutputData& Value); +}; diff --git a/hal/src/main/native/include/hal/proto/MatchInfo.h b/hal/src/main/native/include/hal/proto/MatchInfo.h new file mode 100644 index 00000000000..ccb806750e7 --- /dev/null +++ b/hal/src/main/native/include/hal/proto/MatchInfo.h @@ -0,0 +1,21 @@ +// 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. + +#pragma once + +#include + +#include + +#include "MrcComm.npb.h" +#include "mrc/NetComm.h" + +template <> +struct wpi::Protobuf { + using MessageStruct = mrc_proto_ProtobufMatchInfo; + using InputStream = wpi::ProtoInputStream; + using OutputStream = wpi::ProtoOutputStream; + static std::optional Unpack(InputStream& Stream); + static bool Pack(OutputStream& Stream, const mrc::MatchInfo& Value); +}; diff --git a/hal/src/main/native/include/hal/proto/VersionInfo.h b/hal/src/main/native/include/hal/proto/VersionInfo.h new file mode 100644 index 00000000000..6a835bf8848 --- /dev/null +++ b/hal/src/main/native/include/hal/proto/VersionInfo.h @@ -0,0 +1,21 @@ +// 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. + +#pragma once + +#include + +#include + +#include "MrcComm.npb.h" +#include "mrc/NetComm.h" + +template <> +struct wpi::Protobuf { + using MessageStruct = mrc_proto_ProtobufVersionInfo; + using InputStream = wpi::ProtoInputStream; + using OutputStream = wpi::ProtoOutputStream; + static std::optional Unpack(InputStream& Stream); + static bool Pack(OutputStream& Stream, const mrc::VersionInfo& Value); +}; diff --git a/hal/src/main/native/systemcore/HAL.cpp b/hal/src/main/native/systemcore/HAL.cpp index a58581b8042..72b6da25211 100644 --- a/hal/src/main/native/systemcore/HAL.cpp +++ b/hal/src/main/native/systemcore/HAL.cpp @@ -27,11 +27,11 @@ #include "HALInitializer.h" #include "HALInternal.h" +#include "SystemServer.h" #include "hal/DriverStation.h" #include "hal/Errors.h" #include "hal/Notifier.h" #include "hal/handles/HandlesInternal.h" -#include "hal/roborio/HMB.h" using namespace hal; @@ -337,6 +337,8 @@ HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) { prctl(PR_SET_PDEATHSIG, SIGTERM); + hal::InitializeSystemServer(); + // // Return false if program failed to kill an existing program // if (!killExistingProgram(timeout, mode)) { // return false; diff --git a/hal/src/main/native/systemcore/SystemServer.cpp b/hal/src/main/native/systemcore/SystemServer.cpp new file mode 100644 index 00000000000..584643e71b3 --- /dev/null +++ b/hal/src/main/native/systemcore/SystemServer.cpp @@ -0,0 +1,35 @@ +// 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. + +#include "SystemServer.h" + +#include "mrc/NtNetComm.h" + +namespace hal { + +static nt::NetworkTableInstance ServerInstance; + +void InitializeSystemServer() { + if (ServerInstance) { + return; + } + ServerInstance = nt::NetworkTableInstance::Create(); + ServerInstance.SetServer("localhost", ROBOT_SYSTEM_SERVER_NT_PORT); + ServerInstance.StartClient4("RobotProgram"); +} + +void ShutdownSystemServer() { + if (!ServerInstance) { + return; + } + + ServerInstance.StopClient(); + nt::NetworkTableInstance::Destroy(ServerInstance); +} + +nt::NetworkTableInstance GetSystemServer() { + return ServerInstance; +} + +} // namespace hal diff --git a/hal/src/main/native/systemcore/SystemServer.h b/hal/src/main/native/systemcore/SystemServer.h new file mode 100644 index 00000000000..258687fef93 --- /dev/null +++ b/hal/src/main/native/systemcore/SystemServer.h @@ -0,0 +1,13 @@ +// 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. + +#pragma once + +#include + +namespace hal { +void InitializeSystemServer(); +void ShutdownSystemServer(); +nt::NetworkTableInstance GetSystemServer(); +} // namespace hal diff --git a/hal/src/mrc/include/mrc/NetComm.h b/hal/src/mrc/include/mrc/NetComm.h new file mode 100644 index 00000000000..b859e53c97f --- /dev/null +++ b/hal/src/mrc/include/mrc/NetComm.h @@ -0,0 +1,308 @@ +// 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. + +#pragma once + +#include + +#include +#include +#include +#include +#include + +#include "mrc/NtNetComm.h" + +namespace mrc { + +struct ControlFlags { + uint32_t Enabled : 1; + uint32_t ModeReserved : 2; + uint32_t EStop : 1; + uint32_t FmsConnected : 1; + uint32_t DsConnected : 1; + uint32_t WatchdogActive : 1; + uint32_t Alliance : 6; + uint32_t Reserved : 19; +}; + +struct JoystickAxes { + public: + std::span Axes() { return std::span{AxesStore.data(), GetCount()}; } + + std::span Axes() const { + return std::span{AxesStore.data(), GetCount()}; + } + + void SetCount(uint8_t NewCount) { + Count = (std::min)(NewCount, static_cast(MRC_MAX_NUM_AXES)); + } + + size_t GetCount() const { return Count; } + + private: + std::array AxesStore; + uint8_t Count{0}; +}; + +struct JoystickPovs { + public: + std::span Povs() { return std::span{PovsStore.data(), GetCount()}; } + + std::span Povs() const { + return std::span{PovsStore.data(), GetCount()}; + } + + void SetCount(uint8_t NewCount) { + Count = (std::min)(NewCount, static_cast(MRC_MAX_NUM_POVS)); + } + + size_t GetCount() const { return Count; } + + private: + std::array PovsStore; + uint8_t Count{0}; +}; + +struct JoystickButtons { + uint32_t Buttons; + + void SetCount(uint8_t NewCount) { + Count = (std::min)(NewCount, static_cast(MRC_MAX_NUM_BUTTONS)); + } + + size_t GetCount() const { return Count; } + + private: + uint8_t Count{0}; +}; + +struct Joystick { + JoystickAxes Axes; + JoystickPovs Povs; + JoystickButtons Buttons; +}; + +struct ControlData { + ControlFlags ControlWord; + float MatchTime; + + std::span Joysticks() { + return std::span{JoysticksStore.data(), GetJoystickCount()}; + } + + std::span Joysticks() const { + return std::span{JoysticksStore.data(), GetJoystickCount()}; + } + + size_t GetJoystickCount() const { return JoystickCount; } + + void SetJoystickCount(uint8_t NewCount) { + JoystickCount = + (std::min)(NewCount, static_cast(MRC_MAX_NUM_JOYSTICKS)); + } + + void SetOpMode(std::string_view Mode) { + if (Mode.size() > MRC_MAX_OPMODE_LEN) { + Mode = Mode.substr(0, MRC_MAX_OPMODE_LEN); + } + OpMode = Mode; + } + + void MoveOpMode(std::string&& Mode) { + OpMode = std::move(Mode); + if (OpMode.size() > MRC_MAX_OPMODE_LEN) { + OpMode.resize(MRC_MAX_OPMODE_LEN); + } + } + + std::string_view GetOpMode() const { return OpMode; } + + std::span WritableOpModeBuffer(size_t Len) { + if (Len > MRC_MAX_OPMODE_LEN) { + Len = MRC_MAX_OPMODE_LEN; + } + OpMode.resize(Len); + return std::span{reinterpret_cast(OpMode.data()), + OpMode.size()}; + } + + private: + std::array JoysticksStore; + uint8_t JoystickCount{0}; + std::string OpMode; +}; + +struct JoystickOutputData { + uint32_t HidOutputs{0}; + float LeftRumble{0}; + float RightRumble{0}; +}; + +enum class MatchType : uint8_t { + None = 0, + Practice = 1, + Qualification = 2, + Playoff = 3, + Test = 4, +}; + +struct MatchInfo { + uint16_t MatchNumber{0}; + uint8_t ReplayNumber{0}; + MatchType Type{MatchType::None}; + + void SetEventName(std::string_view Name) { + if (Name.size() > MRC_MAX_EVENT_NAME_LEN) { + Name = Name.substr(0, MRC_MAX_EVENT_NAME_LEN); + } + EventName = Name; + } + + void MoveEventName(std::string&& Name) { + EventName = std::move(Name); + if (EventName.size() > MRC_MAX_EVENT_NAME_LEN) { + EventName.resize(MRC_MAX_EVENT_NAME_LEN); + } + } + + std::string_view GetEventName() const { return EventName; } + + std::span WritableNameBuffer(size_t Len) { + if (Len > MRC_MAX_EVENT_NAME_LEN) { + Len = MRC_MAX_EVENT_NAME_LEN; + } + EventName.resize(Len); + return std::span{reinterpret_cast(EventName.data()), + EventName.size()}; + } + + private: + std::string EventName; +}; + +struct JoystickDescriptor { + public: + bool IsXbox{0}; + uint8_t Type{0}; + + std::span AxesTypes() { + return std::span{AxesTypesStore.data(), GetAxesCount()}; + } + + std::span AxesTypes() const { + return std::span{AxesTypesStore.data(), GetAxesCount()}; + } + + void SetAxesCount(uint8_t NewCount) { + AxesCount = (std::min)(NewCount, static_cast(MRC_MAX_NUM_AXES)); + } + + size_t GetAxesCount() const { return AxesCount; } + + void SetPovsCount(uint8_t NewCount) { + PovCount = (std::min)(NewCount, static_cast(MRC_MAX_NUM_POVS)); + } + + size_t GetPovsCount() const { return PovCount; } + + void SetButtonsCount(uint8_t NewCount) { + ButtonCount = + (std::min)(NewCount, static_cast(MRC_MAX_NUM_BUTTONS)); + } + + size_t GetButtonsCount() const { return ButtonCount; } + + void SetName(std::string_view Name) { + if (Name.size() > MRC_MAX_JOYSTICK_NAME_LEN) { + Name = Name.substr(0, MRC_MAX_JOYSTICK_NAME_LEN); + } + JoystickName = Name; + } + + void MoveName(std::string&& Name) { + JoystickName = std::move(Name); + if (JoystickName.size() > MRC_MAX_JOYSTICK_NAME_LEN) { + JoystickName.resize(MRC_MAX_JOYSTICK_NAME_LEN); + } + } + + std::string_view GetName() const { return JoystickName; } + + std::span WritableNameBuffer(size_t Len) { + if (Len > MRC_MAX_JOYSTICK_NAME_LEN) { + Len = MRC_MAX_JOYSTICK_NAME_LEN; + } + JoystickName.resize(Len); + return std::span{reinterpret_cast(JoystickName.data()), + JoystickName.size()}; + } + + private: + std::string JoystickName; + std::array AxesTypesStore; + uint8_t AxesCount{0}; + uint8_t ButtonCount{0}; + uint8_t PovCount{0}; +}; + +struct VersionInfo { + uint32_t DeviceId{0}; + + void SetName(std::string_view NewName) { + if (NewName.size() > MRC_MAX_VERSION_SIZE) { + NewName = NewName.substr(0, MRC_MAX_VERSION_SIZE); + } + Name = NewName; + } + + void MoveName(std::string&& NewName) { + Name = std::move(NewName); + if (Name.size() > MRC_MAX_VERSION_SIZE) { + Name.resize(MRC_MAX_VERSION_SIZE); + } + } + + std::string_view GetName() const { return Name; } + + std::span WritableNameBuffer(size_t Len) { + if (Len > MRC_MAX_VERSION_SIZE) { + Len = MRC_MAX_VERSION_SIZE; + } + Name.resize(Len); + return std::span{reinterpret_cast(Name.data()), + Name.size()}; + } + + void SetVersion(std::string_view NewVersion) { + if (NewVersion.size() > MRC_MAX_VERSION_SIZE) { + NewVersion = NewVersion.substr(0, MRC_MAX_VERSION_SIZE); + } + Version = NewVersion; + } + + void MoveVersion(std::string&& NewVersion) { + Version = std::move(NewVersion); + if (Version.size() > MRC_MAX_VERSION_SIZE) { + Version.resize(MRC_MAX_VERSION_SIZE); + } + } + + std::string_view GetVersion() const { return Version; } + + std::span WritableVersionBuffer(size_t Len) { + if (Len > MRC_MAX_VERSION_SIZE) { + Len = MRC_MAX_VERSION_SIZE; + } + Version.resize(Len); + return std::span{reinterpret_cast(Version.data()), + Version.size()}; + } + + private: + std::string Name; + std::string Version; +}; + +} // namespace mrc diff --git a/hal/src/mrc/include/mrc/NtNetComm.h b/hal/src/mrc/include/mrc/NtNetComm.h new file mode 100644 index 00000000000..faa306a1bd6 --- /dev/null +++ b/hal/src/mrc/include/mrc/NtNetComm.h @@ -0,0 +1,60 @@ +// 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. + +#pragma once + +#define ROBOT_SYSTEM_SERVER_NT_PORT 6810 + +#define ROBOT_CONTROL_DATA_PREFIX "/Netcomm/Control/" + +#define ROBOT_WATCHDOG_ACTIVE_PATH (ROBOT_CONTROL_DATA_PREFIX "WatchdogActive") +#define ROBOT_CONTROL_DATA_PATH (ROBOT_CONTROL_DATA_PREFIX "ControlData") +#define ROBOT_GAME_SPECIFIC_MESSAGE_PATH \ + (ROBOT_CONTROL_DATA_PREFIX "GameSpecificMessage") +#define ROBOT_MATCH_INFO_PATH (ROBOT_CONTROL_DATA_PREFIX "MatchInfo") +#define ROBOT_JOYSTICK_DESCRIPTORS_PATH \ + (ROBOT_CONTROL_DATA_PREFIX "JoystickDescriptors/") + +#define ROBOT_STATUS_DATA_PREFIX "/Netcomm/Status/" + +#define ROBOT_NEW_ROBOT_PROGRAM_PATH \ + (ROBOT_STATUS_DATA_PREFIX "NewRobotProgram") +#define ROBOT_CODE_STARTED_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeStarted") +#define ROBOT_DISABLED_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeDisabled") +#define ROBOT_AUTON_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeAutonomous") +#define ROBOT_TELEOP_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeTeleop") +#define ROBOT_TEST_TRACE_PATH (ROBOT_STATUS_DATA_PREFIX "UserCodeTest") + +#define ROBOT_OUTPUTS_DATA_PREFIX "/Netcomm/Outputs/" +#define ROBOT_JOYSTICK_OUTPUTS_PATH (ROBOT_OUTPUTS_DATA_PREFIX "Joysticks/") + +#define ROBOT_CONSOLE_DATA_PREFIX "/Netcomm/Console/" +#define ROBOT_CONSOLE_LINE_PATH (ROBOT_CONSOLE_DATA_PREFIX "ConsoleLine") + +#define ROBOT_REPORTING_DATA_PREFIX "/Netcomm/Reporting/" +#define ROBOT_LIB_VERSION_PATH (ROBOT_REPORTING_DATA_PREFIX "LibVersion") +#define ROBOT_USER_REPORTING_PATH (ROBOT_REPORTING_DATA_PREFIX "User") + +#define ROBOT_MODES_PREFIX "/Netcomm/Modes/" +#define ROBOT_AVAILABLE_OP_MODES_PATH (ROBOT_MODES_PREFIX "AvailableOpModes") + +#define ROBOT_SYSTEM_SERVER_PREFIX "/sys/" +#define ROBOT_BATTERY_VOLTAGE_PATH (ROBOT_SYSTEM_SERVER_PREFIX "battery") +#define ROBOT_RAM_USED_PATH (ROBOT_SYSTEM_SERVER_PREFIX "ram") +#define ROBOT_RAM_BYTES_PATH (ROBOT_SYSTEM_SERVER_PREFIX "ramtotal") +#define ROBOT_STORAGE_USED_PATH (ROBOT_SYSTEM_SERVER_PREFIX "storage") +#define ROBOT_STORAGE_BYTES_PATH (ROBOT_SYSTEM_SERVER_PREFIX "storagetotal") +#define ROBOT_CPU_PATH (ROBOT_SYSTEM_SERVER_PREFIX "cpu") +#define ROBOT_CAN_BW_PATH (ROBOT_SYSTEM_SERVER_PREFIX "canbusban") +#define ROBOT_TEAM_PATH (ROBOT_SYSTEM_SERVER_PREFIX "team") + +#define MRC_MAX_NUM_JOYSTICKS 6 +#define MRC_MAX_NUM_AXES 12 +#define MRC_MAX_NUM_POVS 12 +#define MRC_MAX_NUM_BUTTONS 32 +#define MRC_MAX_OPMODE_LEN 32 +#define MRC_MAX_GAME_SPECIFIC_MESSAGE_LEN 128 +#define MRC_MAX_EVENT_NAME_LEN 64 +#define MRC_MAX_JOYSTICK_NAME_LEN 256 +#define MRC_MAX_VERSION_SIZE 256 diff --git a/hal/src/mrc/proto/MrcComm.proto b/hal/src/mrc/proto/MrcComm.proto new file mode 100644 index 00000000000..7db585663fb --- /dev/null +++ b/hal/src/mrc/proto/MrcComm.proto @@ -0,0 +1,47 @@ +syntax = "proto3"; + +package mrc.proto; + +option java_package = "com.mrc.proto"; + +message ProtobufJoystickData { + uint32 ButtonCount = 1; + fixed32 Buttons = 2; + repeated float Axes = 3; + repeated sint32 POVs = 4; +} + +message ProtobufControlData { + uint32 ControlWord = 1; + float MatchTime = 2; + repeated ProtobufJoystickData Joysticks = 3; + string OpMode = 4; +} + +message ProtobufJoystickDescriptor { + string JoystickName = 1; + repeated int32 AxisTypes = 2; + bool IsXbox = 3; + int32 JoystickType = 4; + int32 ButtonCount = 5; + int32 PovCount = 6; +} + +message ProtobufJoystickOutputData { + fixed32 HidOutputs = 1; + float LeftRumble = 2; + float RightRumble = 3; +} + +message ProtobufVersionInfo { + fixed32 DeviceId = 1; + string Name = 2; + string Version = 3; +} + +message ProtobufMatchInfo { + string EventName = 1; + int32 MatchNumber = 2; + int32 ReplayNumber = 3; + int32 MatchType = 4; +} diff --git a/outlineviewer/build.gradle b/outlineviewer/build.gradle index 0538767d704..6544873877e 100644 --- a/outlineviewer/build.gradle +++ b/outlineviewer/build.gradle @@ -91,7 +91,7 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/processstarter/build.gradle b/processstarter/build.gradle index 00788a5ca4b..240f24e236c 100644 --- a/processstarter/build.gradle +++ b/processstarter/build.gradle @@ -33,7 +33,7 @@ model { "${nativeName}"(NativeExecutableSpec) { baseName = 'processstarter' binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/roborioteamnumbersetter/build.gradle b/roborioteamnumbersetter/build.gradle index 7831565f655..e8e9a0072a1 100644 --- a/roborioteamnumbersetter/build.gradle +++ b/roborioteamnumbersetter/build.gradle @@ -93,7 +93,7 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/simulation/halsim_ds_socket/build.gradle b/simulation/halsim_ds_socket/build.gradle index 60148d7b18b..7bc0878e28c 100644 --- a/simulation/halsim_ds_socket/build.gradle +++ b/simulation/halsim_ds_socket/build.gradle @@ -42,11 +42,13 @@ model { } binaries { all { + project(':ntcore').addNtcoreDependency(it, 'shared') lib project: ':wpinet', library: 'wpinet', linkage: 'shared' lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' } withType(GoogleTestTestSuiteBinarySpec) { project(':hal').addHalDependency(it, 'shared') + project(':ntcore').addNtcoreDependency(it, 'shared') lib project: ':wpinet', library: 'wpinet', linkage: 'shared' lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib library: pluginName, linkage: 'shared' diff --git a/simulation/halsim_gui/build.gradle b/simulation/halsim_gui/build.gradle index e346002c5e8..0bc04c4f123 100644 --- a/simulation/halsim_gui/build.gradle +++ b/simulation/halsim_gui/build.gradle @@ -32,7 +32,7 @@ model { lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib project: ':fieldImages', library: 'fieldImages', linkage: 'static' lib project: ':thirdparty:imgui_suite', library: 'imgui', linkage: 'static' - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/simulation/halsim_ws_client/build.gradle b/simulation/halsim_ws_client/build.gradle index 0bd66437e80..fb074e5fbef 100644 --- a/simulation/halsim_ws_client/build.gradle +++ b/simulation/halsim_ws_client/build.gradle @@ -23,7 +23,7 @@ apply from: "${rootDir}/shared/plugins/setupBuild.gradle" model { binaries { all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/simulation/halsim_ws_core/build.gradle b/simulation/halsim_ws_core/build.gradle index 30f2d5b5c15..a4fa586f42e 100644 --- a/simulation/halsim_ws_core/build.gradle +++ b/simulation/halsim_ws_core/build.gradle @@ -41,6 +41,7 @@ model { } binaries.all { project(':hal').addHalDependency(it, 'shared') + project(':ntcore').addNtcoreDependency(it, 'shared') lib project: ':wpinet', library: 'wpinet', linkage: 'shared' lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' } @@ -49,7 +50,7 @@ model { } binaries { all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/simulation/halsim_ws_server/build.gradle b/simulation/halsim_ws_server/build.gradle index 0a4e32c2646..7a265d4a397 100644 --- a/simulation/halsim_ws_server/build.gradle +++ b/simulation/halsim_ws_server/build.gradle @@ -44,17 +44,19 @@ model { binaries { all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } + project(':ntcore').addNtcoreDependency(it, 'shared') lib project: ':wpinet', library: 'wpinet', linkage: 'shared' lib project: ":simulation:halsim_ws_core", library: "halsim_ws_core", linkage: "static" } withType(GoogleTestTestSuiteBinarySpec) { project(':hal').addHalDependency(it, 'shared') + project(':ntcore').addNtcoreDependency(it, 'shared') lib project: ':wpiutil', library: 'wpiutil', linkage: 'shared' lib library: pluginName, linkage: 'shared' if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { diff --git a/simulation/halsim_xrp/build.gradle b/simulation/halsim_xrp/build.gradle index 21457efba3b..b8d7b6a6b71 100644 --- a/simulation/halsim_xrp/build.gradle +++ b/simulation/halsim_xrp/build.gradle @@ -23,11 +23,12 @@ apply from: "${rootDir}/shared/plugins/setupBuild.gradle" model { binaries { all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } + project(':ntcore').addNtcoreDependency(it, 'shared') lib project: ':wpinet', library: 'wpinet', linkage: 'shared' lib project: ":simulation:halsim_ws_core", library: "halsim_ws_core", linkage: "static" } diff --git a/sysid/build.gradle b/sysid/build.gradle index 851be251914..dbe238e6cba 100644 --- a/sysid/build.gradle +++ b/sysid/build.gradle @@ -92,7 +92,7 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } @@ -131,7 +131,7 @@ model { include "**/*.cpp" } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/thirdparty/imgui_suite/build.gradle b/thirdparty/imgui_suite/build.gradle index 1a695cb0b3f..653498e78e9 100644 --- a/thirdparty/imgui_suite/build.gradle +++ b/thirdparty/imgui_suite/build.gradle @@ -49,7 +49,7 @@ model { } } binaries.all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } diff --git a/wpigui/build.gradle b/wpigui/build.gradle index 48e78103a96..fca27e7b55e 100644 --- a/wpigui/build.gradle +++ b/wpigui/build.gradle @@ -36,7 +36,7 @@ model { } binaries.all { lib project: ':thirdparty:imgui_suite', library: 'imgui', linkage: 'static' - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return } @@ -105,7 +105,7 @@ model { } binaries { all { - if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) { + if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.systemcore) { it.buildable = false return }