Skip to content

Commit

Permalink
Add robotpy-xrp
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Jan 8, 2024
1 parent c2770ca commit 2f84b91
Show file tree
Hide file tree
Showing 18 changed files with 196 additions and 2 deletions.
12 changes: 11 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,14 @@ These are special devices for use with the ROMI product.
.. toctree::
:maxdepth: 1

romi
romi

XRP API
-------

These are special devices for use with the XRP product.

.. toctree::
:maxdepth: 1

xrp
3 changes: 3 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,6 @@

# ROMI
gen_package(root, "romi")

# XRP
gen_package(root, "xrp")
6 changes: 5 additions & 1 deletion rdev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ roborio = false

[subprojects."robotpy-romi"]
min_version = "2024.1.1"
roborio = false
roborio = false

[subprojects."robotpy-xrp"]
min_version = "2024.1.1"
roborio = false
12 changes: 12 additions & 0 deletions subprojects/robotpy-xrp/.gitignore
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions subprojects/robotpy-xrp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
robotpy-xrp
============

RobotPy support for the WPILib XRP vendor library.
15 changes: 15 additions & 0 deletions subprojects/robotpy-xrp/gen/XRPGyro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

classes:
XRPGyro:
methods:
XRPGyro:
GetAngle:
GetRate:
GetRateX:
GetRateY:
GetRateZ:
GetAngleX:
GetAngleY:
GetAngleZ:
Reset:
13 changes: 13 additions & 0 deletions subprojects/robotpy-xrp/gen/XRPMotor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---

classes:
XRPMotor:
methods:
XRPMotor:
Set:
Get:
SetInverted:
GetInverted:
Disable:
StopMotor:
GetDescription:
11 changes: 11 additions & 0 deletions subprojects/robotpy-xrp/gen/XRPOnBoardIO.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

classes:
XRPOnBoardIO:
attributes:
kMessageInterval:
m_nextMessageTime:
methods:
XRPOnBoardIO:
GetUserButtonPressed:
SetLed:
6 changes: 6 additions & 0 deletions subprojects/robotpy-xrp/gen/XRPRangefinder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

classes:
XRPRangefinder:
methods:
GetDistance:
7 changes: 7 additions & 0 deletions subprojects/robotpy-xrp/gen/XRPReflectanceSensor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

classes:
XRPReflectanceSensor:
methods:
GetLeftReflectanceValue:
GetRightReflectanceValue:
10 changes: 10 additions & 0 deletions subprojects/robotpy-xrp/gen/XRPServo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---

classes:
XRPServo:
methods:
XRPServo:
SetAngle:
GetAngle:
SetPosition:
GetPosition:
48 changes: 48 additions & 0 deletions subprojects/robotpy-xrp/pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = "[email protected]"
url = "https://github.com/robotpy/mostrobotpy"
license = "BSD-3-Clause"
install_requires = [
"wpilib~=2024.1.1"
]
5 changes: 5 additions & 0 deletions subprojects/robotpy-xrp/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3

from robotpy_build.setup import setup

setup()
1 change: 1 addition & 0 deletions subprojects/robotpy-xrp/tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
12 changes: 12 additions & 0 deletions subprojects/robotpy-xrp/tests/run_tests.py
Original file line number Diff line number Diff line change
@@ -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"])
5 changes: 5 additions & 0 deletions subprojects/robotpy-xrp/tests/test_xrp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import xrp


def test_xrp():
pass
22 changes: 22 additions & 0 deletions subprojects/robotpy-xrp/xrp/__init__.py
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions subprojects/robotpy-xrp/xrp/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#include <rpygen_wrapper.hpp>

RPYBUILD_PYBIND11_MODULE(m) {
initWrapper(m);
}

0 comments on commit 2f84b91

Please sign in to comment.