From 2f84b91715c68f36af368ce8af8d19afeb21eba5 Mon Sep 17 00:00:00 2001 From: Dustin Spicuzza Date: Sun, 7 Jan 2024 20:53:32 -0500 Subject: [PATCH] Add robotpy-xrp --- docs/api.rst | 12 ++++- docs/conf.py | 3 ++ rdev.toml | 6 ++- subprojects/robotpy-xrp/.gitignore | 12 +++++ subprojects/robotpy-xrp/README.md | 4 ++ subprojects/robotpy-xrp/gen/XRPGyro.yml | 15 ++++++ subprojects/robotpy-xrp/gen/XRPMotor.yml | 13 +++++ subprojects/robotpy-xrp/gen/XRPOnBoardIO.yml | 11 +++++ .../robotpy-xrp/gen/XRPRangefinder.yml | 6 +++ .../robotpy-xrp/gen/XRPReflectanceSensor.yml | 7 +++ subprojects/robotpy-xrp/gen/XRPServo.yml | 10 ++++ subprojects/robotpy-xrp/pyproject.toml | 48 +++++++++++++++++++ subprojects/robotpy-xrp/setup.py | 5 ++ .../robotpy-xrp/tests/requirements.txt | 1 + subprojects/robotpy-xrp/tests/run_tests.py | 12 +++++ subprojects/robotpy-xrp/tests/test_xrp.py | 5 ++ subprojects/robotpy-xrp/xrp/__init__.py | 22 +++++++++ subprojects/robotpy-xrp/xrp/src/main.cpp | 6 +++ 18 files changed, 196 insertions(+), 2 deletions(-) create mode 100644 subprojects/robotpy-xrp/.gitignore create mode 100644 subprojects/robotpy-xrp/README.md create mode 100644 subprojects/robotpy-xrp/gen/XRPGyro.yml create mode 100644 subprojects/robotpy-xrp/gen/XRPMotor.yml create mode 100644 subprojects/robotpy-xrp/gen/XRPOnBoardIO.yml create mode 100644 subprojects/robotpy-xrp/gen/XRPRangefinder.yml create mode 100644 subprojects/robotpy-xrp/gen/XRPReflectanceSensor.yml create mode 100644 subprojects/robotpy-xrp/gen/XRPServo.yml create mode 100644 subprojects/robotpy-xrp/pyproject.toml create mode 100644 subprojects/robotpy-xrp/setup.py create mode 100644 subprojects/robotpy-xrp/tests/requirements.txt create mode 100755 subprojects/robotpy-xrp/tests/run_tests.py create mode 100644 subprojects/robotpy-xrp/tests/test_xrp.py create mode 100644 subprojects/robotpy-xrp/xrp/__init__.py create mode 100644 subprojects/robotpy-xrp/xrp/src/main.cpp diff --git a/docs/api.rst b/docs/api.rst index db8942b7..e9070d3c 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -134,4 +134,14 @@ These are special devices for use with the ROMI product. .. toctree:: :maxdepth: 1 - romi \ No newline at end of file + romi + +XRP API +------- + +These are special devices for use with the XRP product. + +.. toctree:: + :maxdepth: 1 + + xrp diff --git a/docs/conf.py b/docs/conf.py index 620d61c0..3287484e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -108,3 +108,6 @@ # ROMI gen_package(root, "romi") + +# XRP +gen_package(root, "xrp") diff --git a/rdev.toml b/rdev.toml index 097d52d1..e0281914 100644 --- a/rdev.toml +++ b/rdev.toml @@ -71,4 +71,8 @@ roborio = false [subprojects."robotpy-romi"] min_version = "2024.1.1" -roborio = false \ No newline at end of file +roborio = false + +[subprojects."robotpy-xrp"] +min_version = "2024.1.1" +roborio = false diff --git a/subprojects/robotpy-xrp/.gitignore b/subprojects/robotpy-xrp/.gitignore new file mode 100644 index 00000000..ca5b76cd --- /dev/null +++ b/subprojects/robotpy-xrp/.gitignore @@ -0,0 +1,12 @@ +*.py[cod] +*.so +*.dll +*.egg-info + +/build + +/xrp/include +/xrp/lib +/xrp/_init_xrp.py +/xrp/pkgcfg.py +/xrp/version.py \ No newline at end of file diff --git a/subprojects/robotpy-xrp/README.md b/subprojects/robotpy-xrp/README.md new file mode 100644 index 00000000..b34966d3 --- /dev/null +++ b/subprojects/robotpy-xrp/README.md @@ -0,0 +1,4 @@ +robotpy-xrp +============ + +RobotPy support for the WPILib XRP vendor library. diff --git a/subprojects/robotpy-xrp/gen/XRPGyro.yml b/subprojects/robotpy-xrp/gen/XRPGyro.yml new file mode 100644 index 00000000..efaf441c --- /dev/null +++ b/subprojects/robotpy-xrp/gen/XRPGyro.yml @@ -0,0 +1,15 @@ +--- + +classes: + XRPGyro: + methods: + XRPGyro: + GetAngle: + GetRate: + GetRateX: + GetRateY: + GetRateZ: + GetAngleX: + GetAngleY: + GetAngleZ: + Reset: diff --git a/subprojects/robotpy-xrp/gen/XRPMotor.yml b/subprojects/robotpy-xrp/gen/XRPMotor.yml new file mode 100644 index 00000000..e607adc5 --- /dev/null +++ b/subprojects/robotpy-xrp/gen/XRPMotor.yml @@ -0,0 +1,13 @@ +--- + +classes: + XRPMotor: + methods: + XRPMotor: + Set: + Get: + SetInverted: + GetInverted: + Disable: + StopMotor: + GetDescription: diff --git a/subprojects/robotpy-xrp/gen/XRPOnBoardIO.yml b/subprojects/robotpy-xrp/gen/XRPOnBoardIO.yml new file mode 100644 index 00000000..73453276 --- /dev/null +++ b/subprojects/robotpy-xrp/gen/XRPOnBoardIO.yml @@ -0,0 +1,11 @@ +--- + +classes: + XRPOnBoardIO: + attributes: + kMessageInterval: + m_nextMessageTime: + methods: + XRPOnBoardIO: + GetUserButtonPressed: + SetLed: diff --git a/subprojects/robotpy-xrp/gen/XRPRangefinder.yml b/subprojects/robotpy-xrp/gen/XRPRangefinder.yml new file mode 100644 index 00000000..40781220 --- /dev/null +++ b/subprojects/robotpy-xrp/gen/XRPRangefinder.yml @@ -0,0 +1,6 @@ +--- + +classes: + XRPRangefinder: + methods: + GetDistance: diff --git a/subprojects/robotpy-xrp/gen/XRPReflectanceSensor.yml b/subprojects/robotpy-xrp/gen/XRPReflectanceSensor.yml new file mode 100644 index 00000000..746b6842 --- /dev/null +++ b/subprojects/robotpy-xrp/gen/XRPReflectanceSensor.yml @@ -0,0 +1,7 @@ +--- + +classes: + XRPReflectanceSensor: + methods: + GetLeftReflectanceValue: + GetRightReflectanceValue: diff --git a/subprojects/robotpy-xrp/gen/XRPServo.yml b/subprojects/robotpy-xrp/gen/XRPServo.yml new file mode 100644 index 00000000..0f59b49f --- /dev/null +++ b/subprojects/robotpy-xrp/gen/XRPServo.yml @@ -0,0 +1,10 @@ +--- + +classes: + XRPServo: + methods: + XRPServo: + SetAngle: + GetAngle: + SetPosition: + GetPosition: diff --git a/subprojects/robotpy-xrp/pyproject.toml b/subprojects/robotpy-xrp/pyproject.toml new file mode 100644 index 00000000..91d45262 --- /dev/null +++ b/subprojects/robotpy-xrp/pyproject.toml @@ -0,0 +1,48 @@ +[build-system] +requires = [ + "robotpy-build<2025.0.0,~=2024.0.0", + "wpilib~=2024.1.1" +] + +[tool.robotpy-build] +base_package = "xrp" + +[tool.robotpy-build.wrappers."xrp"] +name = "xrp" +sources = ["xrp/src/main.cpp"] +generation_data = "gen" +depends = [ + "wpilib_core", "wpilibc_interfaces", "wpilibc", + "wpimath_cpp", "wpimath_geometry", + "wpiHal", "wpiutil", "ntcore", +] + +[tool.robotpy-build.wrappers."xrp".autogen_headers] +# frc/xrp +XRPGyro = "frc/xrp/XRPGyro.h" +XRPMotor = "frc/xrp/XRPMotor.h" +XRPOnBoardIO = "frc/xrp/XRPOnBoardIO.h" +XRPRangefinder = "frc/xrp/XRPRangefinder.h" +XRPReflectanceSensor = "frc/xrp/XRPReflectanceSensor.h" +XRPServo = "frc/xrp/XRPServo.h" + + +[tool.robotpy-build.wrappers."xrp".maven_lib_download] +artifact_id = "xrpVendordep-cpp" +group_id = "edu.wpi.first.xrpVendordep" +# repo_url = "https://frcmaven.wpi.edu/artifactory/release" +repo_url = "https://frcmaven.wpi.edu/artifactory/release" +version = "2024.1.1" +libs = ["xrpVendordep"] + + +[tool.robotpy-build.metadata] +name = "robotpy-xrp" +description = "Binary wrapper for WPILib XRP Vendor library" +author = "RobotPy Development Team" +author_email = "robotpy@googlegroups.com" +url = "https://github.com/robotpy/mostrobotpy" +license = "BSD-3-Clause" +install_requires = [ + "wpilib~=2024.1.1" +] diff --git a/subprojects/robotpy-xrp/setup.py b/subprojects/robotpy-xrp/setup.py new file mode 100644 index 00000000..3542d0c9 --- /dev/null +++ b/subprojects/robotpy-xrp/setup.py @@ -0,0 +1,5 @@ +#!/usr/bin/env python3 + +from robotpy_build.setup import setup + +setup() diff --git a/subprojects/robotpy-xrp/tests/requirements.txt b/subprojects/robotpy-xrp/tests/requirements.txt new file mode 100644 index 00000000..e079f8a6 --- /dev/null +++ b/subprojects/robotpy-xrp/tests/requirements.txt @@ -0,0 +1 @@ +pytest diff --git a/subprojects/robotpy-xrp/tests/run_tests.py b/subprojects/robotpy-xrp/tests/run_tests.py new file mode 100755 index 00000000..2ffc6595 --- /dev/null +++ b/subprojects/robotpy-xrp/tests/run_tests.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 + +import os +from os.path import abspath, dirname +import sys +import subprocess + +if __name__ == "__main__": + root = abspath(dirname(__file__)) + os.chdir(root) + + subprocess.check_call([sys.executable, "-m", "pytest"]) diff --git a/subprojects/robotpy-xrp/tests/test_xrp.py b/subprojects/robotpy-xrp/tests/test_xrp.py new file mode 100644 index 00000000..f1013a1d --- /dev/null +++ b/subprojects/robotpy-xrp/tests/test_xrp.py @@ -0,0 +1,5 @@ +import xrp + + +def test_xrp(): + pass diff --git a/subprojects/robotpy-xrp/xrp/__init__.py b/subprojects/robotpy-xrp/xrp/__init__.py new file mode 100644 index 00000000..3afe5275 --- /dev/null +++ b/subprojects/robotpy-xrp/xrp/__init__.py @@ -0,0 +1,22 @@ +from . import _init_xrp + +# autogenerated by 'robotpy-build create-imports xrp' +from ._xrp import ( + XRPGyro, + XRPMotor, + XRPOnBoardIO, + XRPRangefinder, + XRPReflectanceSensor, + XRPServo, +) + +__all__ = [ + "XRPGyro", + "XRPMotor", + "XRPOnBoardIO", + "XRPRangefinder", + "XRPReflectanceSensor", + "XRPServo", +] + +del _init_xrp diff --git a/subprojects/robotpy-xrp/xrp/src/main.cpp b/subprojects/robotpy-xrp/xrp/src/main.cpp new file mode 100644 index 00000000..52548d81 --- /dev/null +++ b/subprojects/robotpy-xrp/xrp/src/main.cpp @@ -0,0 +1,6 @@ + +#include + +RPYBUILD_PYBIND11_MODULE(m) { + initWrapper(m); +} \ No newline at end of file