Skip to content

Commit

Permalink
Squash
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreiniger committed Jul 9, 2023
1 parent 2fac16a commit 06d31a6
Show file tree
Hide file tree
Showing 734 changed files with 31,473 additions and 101 deletions.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ build_cmake
build-cmake

# Auto generated by vscode
apriltag/bin
cameraserver/bin
cameraserver/multiCameraServer/bin
cscore/bin
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.1
6.2.1
4 changes: 0 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,6 @@ jobs:
with:
name: ${{ matrix.artifact-name }}
path: ${{ matrix.outputs }}
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifact-name }} BUILD OPTIONS
path: "**/build/tmp/**/options.txt"

build-documentation:
name: "Build - Documentation"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upstream-utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ jobs:
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
run: git --no-pager diff --exit-code HEAD ':!*.bazel'
run: git --no-pager diff --exit-code HEAD
1 change: 0 additions & 1 deletion .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ generatedFileExclude {
simulation/gz_msgs/src/include/simulation/gz_msgs/msgs\.h$
fieldImages/src/main/native/resources/
apriltag/src/test/resources/
BUILD.bazel
}

repoRootNameOverride {
Expand Down
2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

exports_files(["requirements_lock.txt"])

# bazel build //:requirements.lock
compile_pip_requirements(
name = "requirements",
Expand Down
83 changes: 62 additions & 21 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,62 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Rules Python
http_archive(
name = "rules_python",
sha256 = "48a838a6e1983e4884b26812b2c748a35ad284fd339eb8e2a6f3adf95307fbcd",
strip_prefix = "rules_python-0.16.2",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.16.2.tar.gz",
sha256 = "94750828b18044533e98a129003b6a68001204038dc4749f40b195b24c38f49f",
strip_prefix = "rules_python-0.21.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.21.0/rules_python-0.21.0.tar.gz",
)

# Download Extra java rules
RULES_JVM_EXTERNAL_TAG = "4.5"

RULES_JVM_EXTERNAL_SHA = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6"

http_archive(
name = "rules_jvm_external",
sha256 = RULES_JVM_EXTERNAL_SHA,
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
url = "https://github.com/bazelbuild/rules_jvm_external/archive/refs/tags/%s.zip" % RULES_JVM_EXTERNAL_TAG,
sha256 = "f86fd42a809e1871ca0aabe89db0d440451219c3ce46c58da240c7dcdc00125f",
strip_prefix = "rules_jvm_external-5.2",
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/5.2/rules_jvm_external-5.2.tar.gz",
)

load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")

rules_jvm_external_deps()

# TODO temporary
http_archive(
name = "rules_bzlmodrio_toolchains",
sha256 = "5cc49c34a56cef8560446146d4ad124b61b3af6e3068a5cdba0df09861eaba97",
strip_prefix = "rules_bzlmodrio_toolchains-8ed5bdadbca20c0f6e7c3c1e8d0f8089fe449706",
url = "https://github.com/bzlmodRio/rules_bzlmodrio_toolchains/archive/8ed5bdadbca20c0f6e7c3c1e8d0f8089fe449706.zip",
)

# local_repository(
# name = "bzlmodRio",
# path = "../bzlmodRio/bzlmodRio",
# path = "../bzlmodRio/monorepo/bzlmodRio",
# )
http_archive(
name = "bzlmodRio",
sha256 = "4d2fab5423f47df9bb7f2b697104f1cf1794823de9b8501e50aa14d4338bd3a4",
strip_prefix = "bzlmodRio-6145f3f8e26590740cce628aba10348c1f64c3bd",
url = "https://github.com/bzlmodRio/bzlmodRio/archive/6145f3f8e26590740cce628aba10348c1f64c3bd.tar.gz",
sha256 = "90928c94a79a715276b2cb9e70c9cabb5e4e9778d782ec381d03a0bba481620b",
strip_prefix = "bzlmodRio-7e05a206c4e123075e1b7b88e03a63e7627fec23",
url = "https://github.com/bzlmodRio/bzlmodRio/archive/7e05a206c4e123075e1b7b88e03a63e7627fec23.tar.gz",
)

load("@bzlmodRio//private/non_bzlmod:download_dependencies.bzl", "download_dependencies")

download_dependencies(
# allwpilib_version = "local",
allwpilib_version = None,
apriltaglib_version = "3.2.0-3",
imgui_version = "1.89.1-1",
libssh_version = "0.95-6",
# navx_version = "local",
local_monorepo_base = "../bzlmodRio/monorepo",
navx_version = None,
ni_version = "2023.3.0",
opencv_version = "4.6.0-4", # TODO different than wpilib
# phoenix_version = "local",
# revlib_version = "local",
rules_bazelrio_version = "0.0.9",
rules_roborio_toolchain_version = "2023-7",
opencv_version = "4.6.0-4",
phoenix_version = None,
revlib_version = None,
rules_bazelrio_version = "0.0.10",
rules_checkstyle_version = None,
rules_pmd_version = None,
rules_spotless_version = None,
rules_toolchains_version = None,
rules_wpi_styleguide_version = None,
rules_wpiformat_version = None,
)

load("@bzlmodRio//private/non_bzlmod:setup_dependencies.bzl", "setup_dependencies")
Expand All @@ -67,3 +77,34 @@ install_deps()
load("@maven//:defs.bzl", "pinned_maven_install")

pinned_maven_install()

http_archive(
name = "pybind11_bazel",
sha256 = "b72c5b44135b90d1ffaba51e08240be0b91707ac60bea08bb4d84b47316211bb",
strip_prefix = "pybind11_bazel-b162c7c88a253e3f6b673df0c621aca27596ce6b",
urls = ["https://github.com/pybind/pybind11_bazel/archive/b162c7c88a253e3f6b673df0c621aca27596ce6b.zip"],
)

# We still require the pybind library.
http_archive(
name = "pybind11",
build_file = "@pybind11_bazel//:pybind11.BUILD",
sha256 = "e8b9202508419fe577b10c8d69483c96af8de2530c48adabd9a4cd2d5785d3e7",
strip_prefix = "pybind11-f1a7573b0c279513e0019b95a99ce8fb6830cd83",
urls = ["https://github.com/pybind/pybind11/archive/f1a7573b0c279513e0019b95a99ce8fb6830cd83.tar.gz"],
)

load("@pybind11_bazel//:python_configure.bzl", "python_configure")
load("@rules_python//python:repositories.bzl", "python_register_toolchains")

python_register_toolchains(
name = "python3_10",
python_version = "3.10.6",
)

load("@python3_10//:defs.bzl", "interpreter")

python_configure(
name = "local_config_python",
python_interpreter_target = interpreter,
)
6 changes: 6 additions & 0 deletions apriltag/src/main/native/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
load("//shared/bazel/rules:cc_rules.bzl", "wpilib_cc_static_and_shared_library")
load("//shared/bazel/rules/jni:cc_jni.bzl", "wpilib_jni_cc_library")

filegroup(
name = "headers",
srcs = glob(["include/**/*"]),
visibility = ["//visibility:public"],
)

wpilib_cc_static_and_shared_library(
name = "apriltag",
srcs = ["//apriltag/src/main/native/resources:generate-resources"] + glob(
Expand Down
48 changes: 48 additions & 0 deletions apriltag/src/main/python/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
load("//shared/bazel/rules/python/pybind_generator:python_wrapper.bzl", "create_python_library", "create_robotpy_project", "generate_robotpy_package")

create_robotpy_project(name = "apriltag")

APRILTAG_GENERATED_PYBIND_FILES = [
"pybind_gen/apriltag/AprilTag.cpp",
"pybind_gen/apriltag/AprilTagDetection.cpp",
"pybind_gen/apriltag/AprilTagDetector.cpp",
"pybind_gen/apriltag/AprilTagFieldLayout.cpp",
"pybind_gen/apriltag/AprilTagFields.cpp",
"pybind_gen/apriltag/AprilTagPoseEstimate.cpp",
"pybind_gen/apriltag/AprilTagPoseEstimator.cpp",
"pybind_gen/apriltag/rpygen_wrapper.hpp",
]

APRILTAG_PYTHON_FILES = [
"apriltag/pkgcfg.py",
"apriltag/_init_apriltag.py",
]

APRILTAG_PYTHON_PACKAGES = [
]

generate_robotpy_package(
name = "apriltag",
config = "config.toml",
generated_pybind_files = [] + APRILTAG_GENERATED_PYBIND_FILES,
generated_python_files = [] + APRILTAG_PYTHON_FILES,
headers = "//apriltag/src/main/native:headers",
pybind_subprojects = ["apriltag"],
)

create_python_library(
name = "apriltag",
cc_deps = [
"//apriltag/src/main/native:apriltag.shared",
"//wpiutil/src/main/python:_wpiutil",
],
generated_pybind_files = APRILTAG_GENERATED_PYBIND_FILES,
headers = "//apriltag/src/main/native:headers",
pybind_extra_includes = [],
pybind_extra_srcs = [],
pybind_main = "apriltag/src/main.cpp",
python_deps = [
"//wpiutil/src/main/python:wpiutil",
],
python_subpackages = APRILTAG_PYTHON_PACKAGES,
)
4 changes: 4 additions & 0 deletions apriltag/src/main/python/apriltag/src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

#include "rpygen_wrapper.hpp"

RPYBUILD_PYBIND11_MODULE(m) { initWrapper(m); }
50 changes: 50 additions & 0 deletions apriltag/src/main/python/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[tool.robotpy-build.metadata]
name = "robotpy-apriltag"
description = "RobotPy bindings for WPILib's AprilTag library"
author = "RobotPy Development Team"
author_email = "robotpy@googlegroups.com"
url = "https://github.com/robotpy/robotpy-cscore"
license = "BSD-3-Clause"
install_requires = [
"robotpy-wpiutil~=2023.4.3",
"robotpy-wpimath~=2023.4.3",
]

[build-system]
requires = [
"robotpy-build<2024.0.0,>=2023.1.1",
"robotpy-wpiutil~=2023.4.3",
"robotpy-wpimath~=2023.4.3",
]

[tool.robotpy-build]
base_package = "apriltag"

[tool.robotpy-build.wrappers."apriltag".maven_lib_download]
artifact_id = "apriltag-cpp"
group_id = "edu.wpi.first.apriltag"
repo_url = "https://frcmaven.wpi.edu/artifactory/release"
version = "2023.4.3"

libs = ["apriltag"]

[tool.robotpy-build.wrappers."apriltag"]
name = "apriltag"

sources = [
"apriltag/src/main.cpp",
]

depends = ["wpiutil"]
generation_data = "gen"

[tool.robotpy-build.wrappers."apriltag".autogen_headers]
# frc/apriltag
AprilTag = "frc/apriltag/AprilTag.h"
AprilTagDetection = "frc/apriltag/AprilTagDetection.h"
AprilTagDetector = "frc/apriltag/AprilTagDetector.h"
# AprilTagDetector_cv = "frc/apriltag/AprilTagDetector_cv.h"
AprilTagFieldLayout = "frc/apriltag/AprilTagFieldLayout.h"
AprilTagFields = "frc/apriltag/AprilTagFields.h"
AprilTagPoseEstimate = "frc/apriltag/AprilTagPoseEstimate.h"
AprilTagPoseEstimator = "frc/apriltag/AprilTagPoseEstimator.h"
14 changes: 14 additions & 0 deletions apriltag/src/main/python/gen/AprilTag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---

functions:
to_json:
ignore: true
from_json:
ignore: true
classes:
AprilTag:
attributes:
ID:
pose:
methods:
operator==:
34 changes: 34 additions & 0 deletions apriltag/src/main/python/gen/AprilTagDetection.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---

extra_includes:
- pybind11/eigen.h

classes:
AprilTagDetection:
methods:
GetFamily:
GetId:
GetHamming:
GetDecisionMargin:
GetHomography:
GetHomographyMatrix:
GetCenter:
GetCorner:
GetCorners:
inline_code: |
.def("__repr__", [](const AprilTagDetection &self) {
return py::str("<AprilTagDetection tag_family={} tag_id={} hamming={} decision_margin={} center={}>")
.format(self.GetFamily(), self.GetId(), self.GetHamming(), self.GetDecisionMargin(), self.GetCenter());
})
AprilTagDetection::Point:
attributes:
x:
y:
inline_code: |
.def(py::init([](double x, double y) {
AprilTagDetection::Point pt{x, y};
return std::make_unique<AprilTagDetection::Point>(std::move(pt));
}), py::arg("x"), py::arg("y"))
.def("__repr__", [](const AprilTagDetection::Point &self) {
return py::str("Point(x={}, y={})").format(self.x, self.y);
})
Loading

0 comments on commit 06d31a6

Please sign in to comment.