mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Compare commits
117 Commits
v2025.1.1-
...
v2025.3.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1efaaefd78 | ||
|
|
71b6e8ec58 | ||
|
|
1a835fec01 | ||
|
|
0ad595c33c | ||
|
|
93bf6c70ba | ||
|
|
a7ae22d764 | ||
|
|
822457d45b | ||
|
|
75321f1d84 | ||
|
|
cd6fee7fea | ||
|
|
517344fe80 | ||
|
|
b0e588fd49 | ||
|
|
0f0e93722e | ||
|
|
f9307de04c | ||
|
|
15dcdebe21 | ||
|
|
0c3c2c1fda | ||
|
|
c898853b4d | ||
|
|
bd2211119f | ||
|
|
13626063dc | ||
|
|
7e6077c546 | ||
|
|
4d126b158c | ||
|
|
e22f76ce73 | ||
|
|
e648b9c86d | ||
|
|
23658a8c62 | ||
|
|
155b3d45e7 | ||
|
|
d62ab12855 | ||
|
|
1921d7b79a | ||
|
|
9dbb0c8c3d | ||
|
|
b2584c6bdf | ||
|
|
53df127535 | ||
|
|
d2611d4ad5 | ||
|
|
b60b2b64bd | ||
|
|
a0976a1fd9 | ||
|
|
b3b515e1dd | ||
|
|
296986397b | ||
|
|
18321e5551 | ||
|
|
b31fd17d05 | ||
|
|
b44a80c07a | ||
|
|
25d11524e8 | ||
|
|
d86a2ec83b | ||
|
|
0690d3d832 | ||
|
|
304b98c0c9 | ||
|
|
72541c10e6 | ||
|
|
00445f4f27 | ||
|
|
8fc3767b30 | ||
|
|
5ab0409c15 | ||
|
|
4caa16e254 | ||
|
|
e52f400687 | ||
|
|
a9f3fc6b2c | ||
|
|
a14545102f | ||
|
|
25e6549398 | ||
|
|
cd92b07321 | ||
|
|
fc9e413ce1 | ||
|
|
007526089e | ||
|
|
c5f7a2b4ac | ||
|
|
638d265b33 | ||
|
|
6125227836 | ||
|
|
e37c35746a | ||
|
|
995bc98ccf | ||
|
|
2de03c9601 | ||
|
|
8e459a4f2a | ||
|
|
58d7c07343 | ||
|
|
9b08f0244c | ||
|
|
7032de3d5d | ||
|
|
159e18ce05 | ||
|
|
257d0e0824 | ||
|
|
b65f159c3f | ||
|
|
11a0c36737 | ||
|
|
17a03514ba | ||
|
|
9ebc4b32ae | ||
|
|
ce60bd5035 | ||
|
|
468a3c6d95 | ||
|
|
4350ea769c | ||
|
|
83397392f4 | ||
|
|
786d22049b | ||
|
|
86137c49f5 | ||
|
|
4edf52d3b6 | ||
|
|
a41fb460a9 | ||
|
|
d4985b8ba0 | ||
|
|
1538370034 | ||
|
|
eef1bf33de | ||
|
|
78b6d61e88 | ||
|
|
e7dd5dca82 | ||
|
|
a27df8ec24 | ||
|
|
85507a6c65 | ||
|
|
b74f84f876 | ||
|
|
54e9c76e03 | ||
|
|
203487a6aa | ||
|
|
57344ef3b2 | ||
|
|
46d401553e | ||
|
|
9e63dcfb16 | ||
|
|
934bf7bf05 | ||
|
|
fe49cbe429 | ||
|
|
0470e51569 | ||
|
|
72fdca3507 | ||
|
|
dee50bf500 | ||
|
|
939a9ceee1 | ||
|
|
b670a59b5b | ||
|
|
9b12ddb595 | ||
|
|
76625fa0f9 | ||
|
|
bb130b67b8 | ||
|
|
469bb3290d | ||
|
|
02a0adc653 | ||
|
|
0c99073b94 | ||
|
|
d631fa8e4b | ||
|
|
19d385d149 | ||
|
|
d0cc7e4eca | ||
|
|
807dffed35 | ||
|
|
f46c81cfe3 | ||
|
|
9ccd73108b | ||
|
|
38d8929f48 | ||
|
|
cc73236a06 | ||
|
|
f8720a628c | ||
|
|
156bd71fef | ||
|
|
6e44187ff6 | ||
|
|
e2cbdf9718 | ||
|
|
66cce1835c | ||
|
|
6fe5da7289 |
6
.bazelrc
6
.bazelrc
@@ -16,9 +16,15 @@ import shared/bazel/compiler_flags/base_linux_flags.rc
|
||||
import shared/bazel/compiler_flags/linux_flags.rc
|
||||
import shared/bazel/compiler_flags/osx_flags.rc
|
||||
import shared/bazel/compiler_flags/roborio_flags.rc
|
||||
import shared/bazel/compiler_flags/systemcore_flags.rc
|
||||
import shared/bazel/compiler_flags/windows_flags.rc
|
||||
import shared/bazel/compiler_flags/coverage_flags.rc
|
||||
|
||||
# Alias toolchain names to what wpilibsuite uses for CI/Artifact naming
|
||||
build:athena --config=roborio
|
||||
build:linuxarm32 --config=raspibookworm32
|
||||
build:linuxarm64 --config=bookworm64
|
||||
|
||||
build:build_java --test_tag_filters=allwpilib-build-java --build_tag_filters=allwpilib-build-java
|
||||
build:build_cpp --test_tag_filters=+allwpilib-build-cpp --build_tag_filters=+allwpilib-build-cpp
|
||||
build:no_example --test_tag_filters=-wpi-example --build_tag_filters=-wpi-example
|
||||
|
||||
65
.github/actions/pregen/action.yml
vendored
Normal file
65
.github/actions/pregen/action.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
name: 'Setup and run pregeneration'
|
||||
description: 'Sets up the dependencies needed to generate generated files and runs all generation scripts'
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install jinja and protobuf
|
||||
run: python -m pip install jinja2 protobuf grpcio-tools
|
||||
shell: bash
|
||||
- name: Install protobuf and perl dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y protobuf-compiler liblist-moreutils-perl
|
||||
wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.3/protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
|
||||
chmod +x protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
|
||||
shell: bash
|
||||
- name: Regenerate hal
|
||||
run: ./hal/generate_usage_reporting.py
|
||||
shell: bash
|
||||
|
||||
- name: Regenerate ntcore
|
||||
run: ./ntcore/generate_topics.py
|
||||
shell: bash
|
||||
|
||||
- name: Regenerate imgui
|
||||
run: |
|
||||
./thirdparty/imgui_suite/generate_fonts.sh
|
||||
./thirdparty/imgui_suite/generate_gl3w.py
|
||||
shell: bash
|
||||
|
||||
- name: Regenerate HIDs
|
||||
run: |
|
||||
./wpilibc/generate_hids.py
|
||||
./wpilibj/generate_hids.py
|
||||
./wpilibNewCommands/generate_hids.py
|
||||
shell: bash
|
||||
|
||||
- name: Regenerate PWM motor controllers
|
||||
run: |
|
||||
./wpilibc/generate_pwm_motor_controllers.py
|
||||
./wpilibj/generate_pwm_motor_controllers.py
|
||||
shell: bash
|
||||
|
||||
- name: Regenerate mrcal minimath
|
||||
run: ./wpical/generate_mrcal.py
|
||||
shell: bash
|
||||
|
||||
- name: Regenerate wpimath
|
||||
run: |
|
||||
./wpimath/generate_nanopb.py
|
||||
./wpimath/generate_numbers.py
|
||||
./wpimath/generate_quickbuf.py --quickbuf_plugin protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
|
||||
shell: bash
|
||||
|
||||
- name: Regenerate wpiunits
|
||||
run: ./wpiunits/generate_units.py
|
||||
shell: bash
|
||||
|
||||
- name: Regenerate wpiutil nanopb
|
||||
run: ./wpiutil/generate_nanopb.py
|
||||
shell: bash
|
||||
9
.github/labeler.yml
vendored
9
.github/labeler.yml
vendored
@@ -54,3 +54,12 @@
|
||||
'component: wpiutil':
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: wpiutil/**
|
||||
'component: wpical':
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: wpical/**
|
||||
'component: usage reporting':
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: hal/src/generate/**
|
||||
'attn: NI':
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: hal/src/generate/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{
|
||||
"aql": {
|
||||
"items.find": {
|
||||
"repo": "wpilib-mvn-development",
|
||||
"repo": "wpilib-mvn-development-local",
|
||||
"path": { "$nmatch":"*edu/wpi/first/thirdparty*" },
|
||||
"$or":[
|
||||
{
|
||||
|
||||
101
.github/workflows/comment-command.yml
vendored
101
.github/workflows/comment-command.yml
vendored
@@ -1,101 +0,0 @@
|
||||
name: Comment Commands
|
||||
on:
|
||||
issue_comment:
|
||||
types: [ created ]
|
||||
|
||||
jobs:
|
||||
format:
|
||||
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/format')
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: React Rocket
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const {owner, repo} = context.issue
|
||||
github.rest.reactions.createForIssueComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: context.payload.comment.id,
|
||||
content: "rocket",
|
||||
});
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}
|
||||
- name: Fetch all history and metadata
|
||||
run: |
|
||||
git checkout -b pr
|
||||
git branch -f main origin/main
|
||||
- name: Checkout PR
|
||||
run: |
|
||||
gh pr checkout $NUMBER
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}"
|
||||
NUMBER: ${{ github.event.issue.number }}
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Install wpiformat
|
||||
run: pip3 install wpiformat==2024.50
|
||||
- name: Run wpiformat
|
||||
run: wpiformat
|
||||
- name: Run spotlessApply
|
||||
run: ./gradlew spotlessApply
|
||||
- name: Commit
|
||||
run: |
|
||||
# Set credentials
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
# Commit
|
||||
git commit -am "Formatting fixes"
|
||||
git push
|
||||
|
||||
pregen:
|
||||
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '/pregen')
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: React Rocket
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const {owner, repo} = context.issue
|
||||
github.rest.reactions.createForIssueComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: context.payload.comment.id,
|
||||
content: "rocket",
|
||||
});
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}
|
||||
- name: Checkout PR
|
||||
run: |
|
||||
gh pr checkout $NUMBER
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}"
|
||||
NUMBER: ${{ github.event.issue.number }}
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install jinja
|
||||
run: python -m pip install jinja2
|
||||
- name: Install protobuf dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler && wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.3/protoc-gen-quickbuf-1.3.3-linux-x86_64.exe && chmod +x protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
|
||||
- name: Regenerate all
|
||||
run: ./.github/workflows/pregen_all.py --quickbuf_plugin=protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
|
||||
- name: Commit
|
||||
run: |
|
||||
# Set credentials
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
# Commit
|
||||
git commit -am "Regenerate pregenerated files"
|
||||
git push
|
||||
1
.github/workflows/documentation.yml
vendored
1
.github/workflows/documentation.yml
vendored
@@ -20,6 +20,7 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- uses: gradle/actions/wrapper-validation@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
|
||||
5
.github/workflows/fix_compile_commands.py
vendored
5
.github/workflows/fix_compile_commands.py
vendored
@@ -18,9 +18,9 @@ def main():
|
||||
for obj in data:
|
||||
out_args = []
|
||||
|
||||
# Filter out -isystem flags that cause false positives
|
||||
iter_args = iter(obj["arguments"])
|
||||
for arg in iter_args:
|
||||
# Filter out -isystem flags that cause false positives
|
||||
if arg == "-isystem":
|
||||
next_arg = next(iter_args)
|
||||
|
||||
@@ -28,6 +28,9 @@ def main():
|
||||
# error: conflicting types for '_mm_prefetch' [clang-diagnostic-error]
|
||||
if not next_arg.startswith("/usr/lib/gcc/"):
|
||||
out_args += ["-isystem", next_arg]
|
||||
# Replace GCC warning argument with one Clang recognizes
|
||||
elif arg == "-Wno-maybe-uninitialized":
|
||||
out_args.append("-Wno-uninitialized")
|
||||
else:
|
||||
out_args.append(arg)
|
||||
|
||||
|
||||
14
.github/workflows/gradle-wrapper-validation.yml
vendored
14
.github/workflows/gradle-wrapper-validation.yml
vendored
@@ -1,14 +0,0 @@
|
||||
name: "Validate Gradle Wrapper"
|
||||
on: [pull_request, push]
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
name: "Validation"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: gradle/actions/wrapper-validation@v3
|
||||
10
.github/workflows/gradle.yml
vendored
10
.github/workflows/gradle.yml
vendored
@@ -7,6 +7,13 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
name: "Validation"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: gradle/actions/wrapper-validation@v4
|
||||
|
||||
build-docker:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -26,6 +33,7 @@ jobs:
|
||||
build-options: "-Ponlylinuxx86-64"
|
||||
name: "Build - ${{ matrix.artifact-name }}"
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [validation]
|
||||
steps:
|
||||
- name: Free Disk Space
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
@@ -109,6 +117,7 @@ jobs:
|
||||
outputs: "ntcoreffi/build/outputs"
|
||||
name: "Build - ${{ matrix.artifact-name }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: [validation]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -181,6 +190,7 @@ jobs:
|
||||
build-documentation:
|
||||
name: "Build - Documentation"
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [validation]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
6
.github/workflows/labeler.yml
vendored
6
.github/workflows/labeler.yml
vendored
@@ -1,6 +1,6 @@
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
- pull_request_target
|
||||
|
||||
jobs:
|
||||
labeler:
|
||||
@@ -9,4 +9,6 @@ jobs:
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v5
|
||||
- uses: actions/labeler@v5
|
||||
with:
|
||||
sync-labels: true
|
||||
|
||||
26
.github/workflows/lint-format.yml
vendored
26
.github/workflows/lint-format.yml
vendored
@@ -11,6 +11,13 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
name: "Validation"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: gradle/actions/wrapper-validation@v4
|
||||
|
||||
wpiformat:
|
||||
name: "wpiformat"
|
||||
runs-on: ubuntu-22.04
|
||||
@@ -27,9 +34,11 @@ jobs:
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install wpiformat
|
||||
run: pip3 install wpiformat==2024.50
|
||||
run: |
|
||||
python -m venv ${{ runner.temp }}/wpiformat
|
||||
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2024.51
|
||||
- name: Run
|
||||
run: wpiformat
|
||||
run: ${{ runner.temp }}/wpiformat/bin/wpiformat
|
||||
- name: Check output
|
||||
run: git --no-pager diff --exit-code HEAD
|
||||
- name: Generate diff
|
||||
@@ -51,6 +60,7 @@ jobs:
|
||||
tidy:
|
||||
name: "clang-tidy"
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [validation]
|
||||
container: wpilib/ubuntu-base:22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -66,21 +76,24 @@ jobs:
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install wpiformat
|
||||
run: pip3 install wpiformat==2024.50
|
||||
run: |
|
||||
python -m venv ${{ runner.temp }}/wpiformat
|
||||
${{ runner.temp }}/wpiformat/bin/pip3 install wpiformat==2024.51
|
||||
- name: Create compile_commands.json
|
||||
run: |
|
||||
./gradlew generateCompileCommands -Ptoolchain-optional-roboRio
|
||||
./.github/workflows/fix_compile_commands.py build/TargetedCompileCommands/linuxx86-64release/compile_commands.json
|
||||
./.github/workflows/fix_compile_commands.py build/TargetedCompileCommands/linuxx86-64debug/compile_commands.json
|
||||
- name: List changed files
|
||||
run: wpiformat -list-changed-files
|
||||
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -list-changed-files
|
||||
- name: Run clang-tidy release
|
||||
run: wpiformat -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64release -vv
|
||||
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64release -vv
|
||||
- name: Run clang-tidy debug
|
||||
run: wpiformat -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64debug -vv
|
||||
run: ${{ runner.temp }}/wpiformat/bin/wpiformat -no-format -tidy-changed -compile-commands=build/TargetedCompileCommands/linuxx86-64debug -vv
|
||||
javaformat:
|
||||
name: "Java format"
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [validation]
|
||||
container: wpilib/ubuntu-base:22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@@ -114,6 +127,7 @@ jobs:
|
||||
documentation:
|
||||
name: "Documentation"
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [validation]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
78
.github/workflows/pregen_all.py
vendored
78
.github/workflows/pregen_all.py
vendored
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
script_path = Path(__file__).resolve()
|
||||
REPO_ROOT = script_path.parent.parent.parent
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument(
|
||||
"--quickbuf_plugin",
|
||||
help="Path to the quickbuf protoc plugin",
|
||||
required=True,
|
||||
)
|
||||
args = parser.parse_args()
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/hal/generate_usage_reporting.py"], check=True
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/ntcore/generate_topics.py"], check=True
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/wpimath/generate_numbers.py"], check=True
|
||||
)
|
||||
subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
f"{REPO_ROOT}/wpimath/generate_quickbuf.py",
|
||||
f"--quickbuf_plugin={args.quickbuf_plugin}",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
f"{REPO_ROOT}/wpimath/generate_nanopb.py",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/wpiunits/generate_units.py"], check=True
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/wpilibc/generate_hids.py"], check=True
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/wpilibj/generate_hids.py"], check=True
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/wpilibNewCommands/generate_hids.py"], check=True
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/wpilibc/generate_pwm_motor_controllers.py"],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/wpilibj/generate_pwm_motor_controllers.py"],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run(
|
||||
[
|
||||
sys.executable,
|
||||
f"{REPO_ROOT}/wpiutil/generate_nanopb.py",
|
||||
],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run(
|
||||
[sys.executable, f"{REPO_ROOT}/thirdparty/imgui_suite/generate_gl3w.py"],
|
||||
check=True,
|
||||
)
|
||||
subprocess.run(f"{REPO_ROOT}/thirdparty/imgui_suite/generate_fonts.sh", check=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
12
.github/workflows/pregenerate.yml
vendored
12
.github/workflows/pregenerate.yml
vendored
@@ -18,16 +18,8 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Set up Python 3.12
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
- name: Install jinja and protobuf
|
||||
run: python -m pip install jinja2 protobuf grpcio-tools
|
||||
- name: Install protobuf dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler && wget https://github.com/HebiRobotics/QuickBuffers/releases/download/1.3.3/protoc-gen-quickbuf-1.3.3-linux-x86_64.exe && chmod +x protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
|
||||
- name: Regenerate all
|
||||
run: python ./.github/workflows/pregen_all.py --quickbuf_plugin protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
|
||||
- name: Run pregen
|
||||
uses: ./.github/actions/pregen
|
||||
- name: Add untracked files to index so they count as changes
|
||||
run: git add -A
|
||||
- name: Check output
|
||||
|
||||
8
.github/workflows/sanitizers.yml
vendored
8
.github/workflows/sanitizers.yml
vendored
@@ -29,11 +29,11 @@ jobs:
|
||||
ctest-env: ""
|
||||
ctest-flags: ""
|
||||
name: "${{ matrix.name }}"
|
||||
runs-on: ubuntu-22.04
|
||||
container: wpilib/roborio-cross-ubuntu:2025-22.04
|
||||
runs-on: ubuntu-24.04
|
||||
container: wpilib/roborio-cross-ubuntu:2025-24.04
|
||||
steps:
|
||||
- name: Install Dependencies
|
||||
run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv4.5-java clang-14 libprotobuf-dev protobuf-compiler ninja-build
|
||||
run: sudo apt-get update && sudo apt-get install -y libopencv-dev libopencv-java clang-17 libprotobuf-dev protobuf-compiler ninja-build
|
||||
|
||||
- name: Install sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.5
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: configure
|
||||
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang-14 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++-14 -DWITH_JAVA=OFF ${{ matrix.cmake-flags }} ..
|
||||
run: mkdir build && cd build && cmake -G Ninja -DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER:FILEPATH=/usr/bin/clang-17 -DCMAKE_CXX_COMPILER:FILEPATH=/usr/bin/clang++-17 -DWITH_JAVA=OFF ${{ matrix.cmake-flags }} ..
|
||||
env:
|
||||
SCCACHE_WEBDAV_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
|
||||
SCCACHE_WEBDAV_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
|
||||
9
.github/workflows/sentinel-build.yml
vendored
9
.github/workflows/sentinel-build.yml
vendored
@@ -10,6 +10,13 @@ concurrency:
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
validation:
|
||||
name: "Validation"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: gradle/actions/wrapper-validation@v4
|
||||
|
||||
build-docker:
|
||||
if: (github.repository_owner == 'wpilibsuite' && github.ref == 'refs/heads/main') || github.event_name != 'schedule'
|
||||
strategy:
|
||||
@@ -30,6 +37,7 @@ jobs:
|
||||
build-options: "-Ponlylinuxx86-64"
|
||||
name: "Build - ${{ matrix.artifact-name }}"
|
||||
runs-on: ubuntu-22.04
|
||||
needs: [validation]
|
||||
steps:
|
||||
- name: Free Disk Space
|
||||
uses: jlumbroso/free-disk-space@main
|
||||
@@ -101,6 +109,7 @@ jobs:
|
||||
outputs: "ntcoreffi/build/outputs"
|
||||
name: "Build - ${{ matrix.artifact-name }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: [validation]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
|
||||
58
.github/workflows/tools.yml
vendored
58
.github/workflows/tools.yml
vendored
@@ -29,12 +29,13 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: gradle/actions/wrapper-validation@v4
|
||||
- name: Build WPILib with Gradle
|
||||
uses: addnab/docker-run-action@v3
|
||||
with:
|
||||
image: wpilib/roborio-cross-ubuntu:2025-22.04
|
||||
options: -v ${{ github.workspace }}:/work -w /work -e GITHUB_REF -e CI -e DISPLAY
|
||||
run: df . && rm -f semicolon_delimited_script && ./gradlew :wpilibc:publish :wpilibj:publish :wpilibNewCommands:publish :hal:publish :cameraserver:publish :ntcore:publish :cscore:publish :wpimath:publish :wpinet:publish :wpiutil:publish :apriltag:publish :wpiunits:publish :simulation:halsim_gui:publish :simulation:halsim_ds_socket:publish :fieldImages:publish :epilogue-processor:publish :epilogue-runtime:publish :thirdparty:googletest:publish -x test -x Javadoc -x doxygen --build-cache && cp -r /root/releases/maven/development /work
|
||||
run: df . && rm -f semicolon_delimited_script && ./gradlew :wpilibc:publish :wpilibj:publish :wpilibNewCommands:publish :hal:publish :cameraserver:publish :ntcore:publish :cscore:publish :wpimath:publish :wpinet:publish :wpiutil:publish :apriltag:publish :wpiunits:publish :simulation:halsim_gui:publish :simulation:halsim_ds_socket:publish :simulation:halsim_ws_server:publish :simulation:halsim_ws_client:publish :simulation:halsim_xrp:publish :fieldImages:publish :romiVendordep:publish :xrpVendordep:publish :epilogue-processor:publish :epilogue-runtime:publish :thirdparty:googletest:publish -x test -x Javadoc -x doxygen --build-cache && cp -r /root/releases/maven/development /work
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: MavenArtifacts
|
||||
@@ -148,3 +149,58 @@ jobs:
|
||||
path: |
|
||||
build/allOutputs/
|
||||
retention-days: 7
|
||||
|
||||
Robotpy:
|
||||
name: "Build - Robotpy"
|
||||
needs: [build-artifacts]
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: robotpy/mostrobotpy
|
||||
fetch-depth: 0
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: MavenArtifacts
|
||||
- name: Move artifacts
|
||||
run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: 3.13
|
||||
|
||||
#
|
||||
# Setup build caching
|
||||
#
|
||||
|
||||
- name: Set ccache size
|
||||
shell: bash
|
||||
id: ccache
|
||||
run: echo "MAX_SIZE=500M" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Setup ccache
|
||||
# uses: hendrikmuhs/ccache-action@v1.2.10
|
||||
uses: robotpy/ccache-action@fork
|
||||
with:
|
||||
key: ubuntu-22.04-3.13
|
||||
variant: ccache
|
||||
max-size: ${{ steps.ccache.outputs.max_size }}
|
||||
|
||||
- name: Install deps
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip --disable-pip-version-check install -r rdev_requirements.txt
|
||||
|
||||
- name: Install numpy (needed for stubgen but broken in raspbian CI)
|
||||
shell: bash
|
||||
run: |
|
||||
python -m pip --disable-pip-version-check install numpy
|
||||
- name: Patch RobotPy rdev to use local development
|
||||
run: git config user.name github-actions && git config user.email github-actions@github.com && set -- ~/releases/maven/development/edu/wpi/first/wpiutil/wpiutil-cpp/*/ ; wpilibversion=$(basename $1) && echo $wpilibversion && sed --regexp-extended -i 's@(wpilib_bin_url =).*@\1 \"file:\/\/'"$HOME"'\/releases\/maven\/development"@' rdev.toml && sed --regexp-extended -i 's/(wpilib_bin_version =).*/\1 \"'"$wpilibversion"'\"/' rdev.toml && ./rdev.sh update-pyproject --commit
|
||||
- name: Build + test wheels
|
||||
shell: bash
|
||||
run: |
|
||||
./rdev.sh ci run
|
||||
env:
|
||||
RPYBUILD_STRIP_LIBPYTHON: "1"
|
||||
RPYBUILD_CC_LAUNCHER: ccache
|
||||
|
||||
6
.github/workflows/upstream-utils.yml
vendored
6
.github/workflows/upstream-utils.yml
vendored
@@ -120,12 +120,6 @@ jobs:
|
||||
./mpack.py clone
|
||||
./mpack.py copy-src
|
||||
./mpack.py format-patch
|
||||
- name: Run stack_walker.py
|
||||
run: |
|
||||
cd upstream_utils
|
||||
./stack_walker.py clone
|
||||
./stack_walker.py copy-src
|
||||
./stack_walker.py format-patch
|
||||
- name: Run memory.py
|
||||
run: |
|
||||
cd upstream_utils
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -255,3 +255,6 @@ bazel_auth.rc
|
||||
|
||||
# ctest
|
||||
/Testing/
|
||||
|
||||
# Meson
|
||||
.meson-subproject*
|
||||
|
||||
@@ -76,6 +76,7 @@ cmake_dependent_option(
|
||||
)
|
||||
option(WITH_CSCORE "Build cscore (needs OpenCV)" ON)
|
||||
option(WITH_NTCORE "Build ntcore" ON)
|
||||
option(WITH_WPICAL "Build wpical" OFF)
|
||||
option(WITH_WPIMATH "Build wpimath" ON)
|
||||
cmake_dependent_option(
|
||||
WITH_WPIUNITS
|
||||
@@ -142,6 +143,11 @@ if(WITH_DOCS)
|
||||
include(AddDoxygenDocs)
|
||||
add_doxygen_docs()
|
||||
endif()
|
||||
|
||||
if(WITH_WPICAL)
|
||||
find_package(Ceres CONFIG REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(LIBSSH CONFIG 0.7.1)
|
||||
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
|
||||
@@ -314,6 +320,9 @@ if(WITH_GUI)
|
||||
add_subdirectory(glass)
|
||||
add_subdirectory(outlineviewer)
|
||||
add_subdirectory(sysid)
|
||||
if(WITH_WPICAL)
|
||||
add_subdirectory(wpical)
|
||||
endif()
|
||||
if(LIBSSH_FOUND)
|
||||
add_subdirectory(roborioteamnumbersetter)
|
||||
add_subdirectory(datalogtool)
|
||||
|
||||
@@ -1,69 +1,47 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
# Contributor Community Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
As members, contributors, and leaders, we commit to fostering a community where everyone feels safe, respected, and valued. We are dedicated to ensuring that participation in this community is harassment-free, inclusive, and welcoming, regardless of age, body type, abilities (visible or invisible), ethnicity, gender identity or expression, sexual orientation, socioeconomic background, education, nationality, personal appearance, race, or religion.
|
||||
|
||||
Above all, we pledge to act with integrity, kindness, and empathy—striving to be not only good participants but also good humans.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
Positive and respectful behavior is essential to creating a thriving community. This includes:
|
||||
|
||||
* Exhibiting Gracious Professionalism® at all times. Gracious Professionalism
|
||||
* Practicing **Gracious Professionalism®** at all times. Gracious Professionalism
|
||||
is a way of doing things that encourages high-quality work, emphasizes the
|
||||
value of others, and respects individuals and the community.
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
* Showing empathy, kindness, and patience.
|
||||
* Respecting diverse perspectives and experiences.
|
||||
* Giving and receiving constructive feedback with openness and humility.
|
||||
* Owning mistakes, apologizing when necessary, and learning from them.
|
||||
* Prioritizing the well-being and success of the entire community over individual interests.
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
Unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Using sexualized language, imagery, or making inappropriate advances
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
* Harassment in any form, whether public or private.
|
||||
* Sharing private information (e.g., email or physical addresses) without explicit consent.
|
||||
|
||||
* Any behavior that is unprofessional, harmful, or exclusionary.
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
Community leaders are responsible for maintaining these standards and will take appropriate action to address any behavior deemed harmful, threatening, or inappropriate. Actions may include removing content, issuing warnings, or, when necessary, banning individuals. Moderation decisions will be communicated transparently where appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
This Code of Conduct applies to all community spaces, events, and instances where individuals represent the community (e.g., official email accounts, social media posts, or in-person/virtual events).
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
[conduct@wpilib.org](mailto:conduct@wpilib.org).
|
||||
[wpilib@wpi.edu](mailto:wpilib@wpi.edu).
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
@@ -115,6 +93,9 @@ individual, or aggression toward or disparagement of classes of individuals.
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## A Note on Kindness
|
||||
Building a community isn’t just about rules—it’s about connection. Every interaction is an opportunity to be understanding, compassionate, and supportive. Being a good human is the key to our ethos.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
|
||||
@@ -80,7 +80,7 @@ xₖ₊₁ = Axₖ + Buₖ
|
||||
|
||||
Changes should be submitted as a Pull Request against the main branch of WPILib. For most changes, commits will be squashed upon merge. For particularly large changes, multiple commits are ok, but assume one commit unless asked otherwise. We may ask you to break a PR into multiple standalone PRs or commits for rebase within one PR to separate unrelated changes. No change will be merged unless it is up to date with the current main branch. We do this to make sure that the git history isn't too cluttered.
|
||||
|
||||
During the build season, breaking changes or other changes intended for the next season can be created as a pull request against the development branch of WPILib. After the season is over, the changes in the development branch will be merged into main.
|
||||
Particularly large and/or breaking changes should be targeted to the 2027 branch, which targets the [SystemCore Robot Controller](https://community.firstinspires.org/introducing-the-future-mobile-robot-controller). The intent is minimize changes for 2026, to allow development to focus on preparing for 2027.
|
||||
|
||||
### Merge Process
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2009-2024 FIRST and other WPILib contributors
|
||||
Copyright (c) 2009-2025 FIRST and other WPILib contributors
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -59,6 +59,8 @@ Using Gradle makes building WPILib very straightforward. It only has a few depen
|
||||
|
||||
On macOS ARM, run `softwareupdate --install-rosetta`. This is necessary to be able to use the macOS x86 roboRIO toolchain on ARM.
|
||||
|
||||
On linux, run `sudo apt install gfortran`. This is necessary to be able to build WPIcal on linux platforms.
|
||||
|
||||
## Setup
|
||||
|
||||
Clone the WPILib repository and follow the instructions above for installing any required tooling. The build process uses versioning information from git. Downloading the source is not sufficient to run the build.
|
||||
@@ -134,6 +136,9 @@ If you have installed the FRC Toolchain to a directory other than the default, o
|
||||
|
||||
Once a PR has been submitted, formatting can be run in CI by commenting `/format` on the PR. A new commit will be pushed with the formatting changes.
|
||||
|
||||
> [!NOTE]
|
||||
> The `/format` action has been temporarily disabled. The individual formatting commands can be run locally as shown below. Alternately, the Lint and Format action for a PR will upload a patch file that can be downloaded and applied manually.
|
||||
|
||||
#### wpiformat
|
||||
|
||||
wpiformat can be executed anywhere in the repository via `py -3 -m wpiformat` on Windows or `python3 -m wpiformat` on other platforms.
|
||||
|
||||
@@ -15,7 +15,8 @@ licenses, and/or restrictions:
|
||||
|
||||
Program Locations
|
||||
------- ---------
|
||||
Google Test gtest
|
||||
Google Test thirdparty/googletest/include
|
||||
thirdparty/googletest/src
|
||||
LLVM wpiutil/src/main/native/thirdparty/llvm
|
||||
wpiutil/src/test/native/cpp/llvm/
|
||||
JSON for Modern C++ wpiutil/src/main/native/thirdparty/json
|
||||
@@ -32,18 +33,29 @@ jQuery wpinet/src/main/native/resources/jquery-*
|
||||
popper.js wpinet/src/main/native/resources/popper-*
|
||||
units wpimath/src/main/native/include/units/
|
||||
Eigen wpimath/src/main/native/thirdparty/eigen/include/
|
||||
StackWalker wpiutil/src/main/native/windows/StackWalker.*
|
||||
GHC filesystem wpiutil/src/main/native/thirdparty/include/wpi/ghc/
|
||||
Team 254 Library wpilibj/src/main/java/edu/wpi/first/wpilibj/spline/SplineParameterizer.java
|
||||
wpilibj/src/main/java/edu/wpi/first/wpilibj/trajectory/TrajectoryParameterizer.java
|
||||
wpilibc/src/main/native/include/spline/SplineParameterizer.h
|
||||
wpilibc/src/main/native/include/trajectory/TrajectoryParameterizer.h
|
||||
wpilibc/src/main/native/cpp/trajectory/TrajectoryParameterizer.cpp
|
||||
Team 254 Library wpimath/src/main/java/edu/wpi/first/math/spline/SplineParameterizer.java
|
||||
wpimath/src/main/java/edu/wpi/first/math/trajectory/TrajectoryParameterizer.java
|
||||
wpimath/src/main/native/include/frc/spline/SplineParameterizer.h
|
||||
wpimath/src/main/native/include/frc/trajectory/TrajectoryParameterizer.h
|
||||
wpimath/src/main/native/cpp/trajectory/TrajectoryParameterizer.cpp
|
||||
Portable File Dialogs wpigui/src/main/native/include/portable-file-dialogs.h
|
||||
V8 export-template wpiutil/src/main/native/include/wpi/SymbolExports.h
|
||||
GCEM wpimath/src/main/native/thirdparty/gcem/include/
|
||||
Sleipnir wpimath/src/main/native/thirdparty/sleipnir
|
||||
Debugging wpiutil/src/main/native/thirdparty/debugging
|
||||
argparse wpiutil/src/main/native/thirdparty/argparse/include/wpi/argparse.h
|
||||
apriltag apriltag/src/main/native/thirdparty/apriltag
|
||||
glfw thirdparty/imgui_suite/glfw
|
||||
Dear ImGui thirdparty/imgui_suite/imgui
|
||||
implot thirdparty/imgui_suite/implot
|
||||
memory wpiutil/src/main/native/thirdparty/memory
|
||||
nanopb wpiutil/src/main/native/thirdparty/nanopb
|
||||
protobuf wpiutil/src/main/native/thirdparty/protobuf
|
||||
mrcal wpical/src/main/native/thirdparty/mrcal
|
||||
libdogleg wpical/src/main/native/thirdparty/libdogleg
|
||||
Simd hal/src/main/native/athena/simd
|
||||
|
||||
Additionally, glfw, memory, and nanopb were all modified for use in WPILib.
|
||||
|
||||
==============================================================================
|
||||
Google Test License
|
||||
@@ -462,7 +474,7 @@ limitations under the License.
|
||||
|
||||
|
||||
==============================================================================
|
||||
MPacks License
|
||||
MPack License
|
||||
==============================================================================
|
||||
The MIT License (MIT)
|
||||
|
||||
@@ -1013,35 +1025,6 @@ Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
|
||||
|
||||
===================
|
||||
StackWalker License
|
||||
===================
|
||||
Copyright (c) 2005-2013, Jochen Kalmbach
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
Neither the name of Jochen Kalmbach nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
|
||||
================
|
||||
Team 254 Library
|
||||
================
|
||||
@@ -1078,33 +1061,6 @@ and/or modify it under the terms of the Do What the **** You Want
|
||||
to Public License, Version 2, as published by the WTFPL Task Force.
|
||||
See http://www.wtfpl.net/ for more details.
|
||||
|
||||
======================
|
||||
Boost Software License
|
||||
======================
|
||||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
======
|
||||
fmtlib
|
||||
======
|
||||
@@ -1136,29 +1092,6 @@ of this Software are embedded into a machine-executable object form of such
|
||||
source code, you may redistribute such embedded portions in such object form
|
||||
without including the above copyright and permission notices.
|
||||
|
||||
==============
|
||||
GHC filesystem
|
||||
==============
|
||||
Copyright (c) 2018, Steffen Schümann <s.schuemann@pobox.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
==================
|
||||
V8 export-template
|
||||
==================
|
||||
@@ -1251,3 +1184,518 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
================
|
||||
argparse License
|
||||
================
|
||||
Copyright (c) 2018 Pranav Srinivas Kumar <pranav.srinivas.kumar@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
================
|
||||
apriltag License
|
||||
================
|
||||
BSD 2-Clause License
|
||||
|
||||
Copyright (C) 2013-2016, The Regents of The University of Michigan.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
The views and conclusions contained in the software and documentation are those
|
||||
of the authors and should not be interpreted as representing official policies,
|
||||
either expressed or implied, of the Regents of The University of Michigan.
|
||||
|
||||
============
|
||||
gl3w License
|
||||
============
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
============
|
||||
glfw License
|
||||
============
|
||||
Copyright (c) 2002-2006 Marcus Geelnard
|
||||
|
||||
Copyright (c) 2006-2019 Camilla Löwy
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would
|
||||
be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must not
|
||||
be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
==================
|
||||
Dear ImGui License
|
||||
==================
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2024 Omar Cornut
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
==============
|
||||
implot License
|
||||
==============
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020 Evan Pezent
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
==============
|
||||
memory License
|
||||
==============
|
||||
Copyright (C) 2015-2023 Jonathan Müller and foonathan/memory contributors
|
||||
|
||||
This software is provided 'as-is', without any express or
|
||||
implied warranty. In no event will the authors be held
|
||||
liable for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented;
|
||||
you must not claim that you wrote the original software.
|
||||
If you use this software in a product, an acknowledgment
|
||||
in the product documentation would be appreciated but
|
||||
is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such,
|
||||
and must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any
|
||||
source distribution.
|
||||
|
||||
==============
|
||||
nanopb License
|
||||
==============
|
||||
Copyright (c) 2011 Petteri Aimonen <jpa at nanopb.mail.kapsi.fi>
|
||||
|
||||
This software is provided 'as-is', without any express or
|
||||
implied warranty. In no event will the authors be held liable
|
||||
for any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any
|
||||
purpose, including commercial applications, and to alter it and
|
||||
redistribute it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you
|
||||
must not claim that you wrote the original software. If you use
|
||||
this software in a product, an acknowledgment in the product
|
||||
documentation would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and
|
||||
must not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
|
||||
================
|
||||
protobuf License
|
||||
================
|
||||
Copyright 2008 Google Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following disclaimer
|
||||
in the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of Google Inc. nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
Code generated by the Protocol Buffer compiler is owned by the owner
|
||||
of the input file used when generating it. This code is not
|
||||
standalone and requires a support library to be linked with it. This
|
||||
support library is itself covered by the above license.
|
||||
|
||||
===========
|
||||
stb License
|
||||
===========
|
||||
This software is available under 2 licenses -- choose whichever you prefer.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE A - MIT License
|
||||
Copyright (c) 2017 Sean Barrett
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
------------------------------------------------------------------------------
|
||||
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
||||
This is free and unencumbered software released into the public domain.
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
||||
software, either in source code form or as a compiled binary, for any purpose,
|
||||
commercial or non-commercial, and by any means.
|
||||
In jurisdictions that recognize copyright laws, the author or authors of this
|
||||
software dedicate any and all copyright interest in the software to the public
|
||||
domain. We make this dedication for the benefit of the public at large and to
|
||||
the detriment of our heirs and successors. We intend this dedication to be an
|
||||
overt act of relinquishment in perpetuity of all present and future rights to
|
||||
this software under copyright law.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
=============
|
||||
mrcal License
|
||||
=============
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright (c) 2017-2023 California Institute of Technology ("Caltech"). U.S.
|
||||
Government sponsorship acknowledged. All rights reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
=================
|
||||
libdogleg License
|
||||
=================
|
||||
Copyright 2011 Oblong Industries 2017 Dima Kogan <dima@secretsauce.net>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
The full text of the license is available at http://www.gnu.org/licenses
|
||||
|
||||
============
|
||||
Simd License
|
||||
============
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2011-2017 Ihar Yermalayeu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
47
WORKSPACE
47
WORKSPACE
@@ -35,8 +35,8 @@ maven_install(
|
||||
# Download toolchains
|
||||
http_archive(
|
||||
name = "rules_bzlmodrio_toolchains",
|
||||
sha256 = "2ef1cafce7f4fd4e909bb5de8b0dc771a934646afd55d5f100ff31f6b500df98",
|
||||
url = "https://github.com/wpilibsuite/rules_bzlmodRio_toolchains/releases/download/2024-1.bcr1/rules_bzlmodRio_toolchains-2024-1.bcr1.tar.gz",
|
||||
sha256 = "ff25b5f9445cbd43759be4c6582b987d1065cf817c593eedc7ada1a699298c84",
|
||||
url = "https://github.com/wpilibsuite/rules_bzlmodRio_toolchains/releases/download/2025-1.bcr2/rules_bzlmodRio_toolchains-2025-1.bcr2.tar.gz",
|
||||
)
|
||||
|
||||
load("@rules_bzlmodrio_toolchains//:maven_deps.bzl", "setup_legacy_setup_toolchains_dependencies")
|
||||
@@ -50,8 +50,8 @@ load_toolchains()
|
||||
#
|
||||
http_archive(
|
||||
name = "rules_bzlmodrio_jdk",
|
||||
sha256 = "a00d5fa971fbcad8a17b1968cdc5350688397035e90b0cb94e040d375ecd97b4",
|
||||
url = "https://github.com/wpilibsuite/rules_bzlmodRio_jdk/releases/download/17.0.8.1-1/rules_bzlmodRio_jdk-17.0.8.1-1.tar.gz",
|
||||
sha256 = "81869fe9860e39b17e4a9bc1d33c1ca2faede7e31d9538ed0712406f753a2163",
|
||||
url = "https://github.com/wpilibsuite/rules_bzlmodRio_jdk/releases/download/17.0.12-7/rules_bzlmodRio_jdk-17.0.12-7.tar.gz",
|
||||
)
|
||||
|
||||
load("@rules_bzlmodrio_jdk//:maven_deps.bzl", "setup_legacy_setup_jdk_dependencies")
|
||||
@@ -62,23 +62,35 @@ register_toolchains(
|
||||
"@local_roborio//:macos",
|
||||
"@local_roborio//:linux",
|
||||
"@local_roborio//:windows",
|
||||
"@local_raspi_32//:macos",
|
||||
"@local_raspi_32//:linux",
|
||||
"@local_raspi_32//:windows",
|
||||
"@local_systemcore//:macos",
|
||||
"@local_systemcore//:linux",
|
||||
"@local_systemcore//:windows",
|
||||
"@local_raspi_bullseye_32//:macos",
|
||||
"@local_raspi_bullseye_32//:linux",
|
||||
"@local_raspi_bullseye_32//:windows",
|
||||
"@local_raspi_bookworm_32//:macos",
|
||||
"@local_raspi_bookworm_32//:linux",
|
||||
"@local_raspi_bookworm_32//:windows",
|
||||
"@local_bullseye_32//:macos",
|
||||
"@local_bullseye_32//:linux",
|
||||
"@local_bullseye_32//:windows",
|
||||
"@local_bullseye_64//:macos",
|
||||
"@local_bullseye_64//:linux",
|
||||
"@local_bullseye_64//:windows",
|
||||
"@local_bookworm_32//:macos",
|
||||
"@local_bookworm_32//:linux",
|
||||
"@local_bookworm_32//:windows",
|
||||
"@local_bookworm_64//:macos",
|
||||
"@local_bookworm_64//:linux",
|
||||
"@local_bookworm_64//:windows",
|
||||
)
|
||||
|
||||
setup_legacy_setup_jdk_dependencies()
|
||||
|
||||
http_archive(
|
||||
name = "bzlmodrio-ni",
|
||||
sha256 = "197fceac88bf44fb8427d5e000b0083118d3346172dd2ad31eccf83a5e61b3ce",
|
||||
url = "https://github.com/wpilibsuite/bzlmodRio-ni/releases/download/2025.0.0/bzlmodRio-ni-2025.0.0.tar.gz",
|
||||
sha256 = "fff62c3cb3e83f9a0d0a01f1739477c9ca5e9a6fac05be1ad59dafcd385801f7",
|
||||
url = "https://github.com/wpilibsuite/bzlmodRio-ni/releases/download/2025.2.0/bzlmodRio-ni-2025.2.0.tar.gz",
|
||||
)
|
||||
|
||||
load("@bzlmodrio-ni//:maven_cpp_deps.bzl", "setup_legacy_bzlmodrio_ni_cpp_dependencies")
|
||||
@@ -87,8 +99,8 @@ setup_legacy_bzlmodrio_ni_cpp_dependencies()
|
||||
|
||||
http_archive(
|
||||
name = "bzlmodrio-opencv",
|
||||
sha256 = "5314cce05b49451a46bf3e3140fc401342e53d5f3357612ed4473e59bb616cba",
|
||||
url = "https://github.com/wpilibsuite/bzlmodRio-opencv/releases/download/2024.4.8.0-4.bcr1/bzlmodRio-opencv-2024.4.8.0-4.bcr1.tar.gz",
|
||||
sha256 = "ba3f4910ce9cc0e08abff732aeb5835b1bcfd864ca5296edeadcf2935f7e81b9",
|
||||
url = "https://github.com/wpilibsuite/bzlmodRio-opencv/releases/download/2025.4.10.0-3.bcr1/bzlmodRio-opencv-2025.4.10.0-3.bcr1.tar.gz",
|
||||
)
|
||||
|
||||
load("@bzlmodrio-opencv//:maven_cpp_deps.bzl", "setup_legacy_bzlmodrio_opencv_cpp_dependencies")
|
||||
@@ -98,3 +110,16 @@ setup_legacy_bzlmodrio_opencv_cpp_dependencies()
|
||||
load("@bzlmodrio-opencv//:maven_java_deps.bzl", "setup_legacy_bzlmodrio_opencv_java_dependencies")
|
||||
|
||||
setup_legacy_bzlmodrio_opencv_java_dependencies()
|
||||
|
||||
http_archive(
|
||||
name = "build_bazel_apple_support",
|
||||
sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80",
|
||||
url = "https://github.com/bazelbuild/apple_support/releases/download/1.15.1/apple_support.1.15.1.tar.gz",
|
||||
)
|
||||
|
||||
load(
|
||||
"@build_bazel_apple_support//lib:repositories.bzl",
|
||||
"apple_support_dependencies",
|
||||
)
|
||||
|
||||
apple_support_dependencies()
|
||||
|
||||
112
apriltag/BUILD.bazel
Normal file
112
apriltag/BUILD.bazel
Normal file
@@ -0,0 +1,112 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
load("@rules_python//python:defs.bzl", "py_binary")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
|
||||
cc_library(
|
||||
name = "thirdparty-apriltag",
|
||||
srcs = glob(["src/main/native/thirdparty/apriltag/src/**"]),
|
||||
hdrs = glob(["src/main/native/thirdparty/apriltag/include/**"]),
|
||||
copts = select({
|
||||
"@bazel_tools//src/conditions:darwin": [
|
||||
"-Wno-format-nonliteral",
|
||||
"-Wno-gnu-zero-variadic-macro-arguments",
|
||||
"-Wno-uninitialized",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-type-limits",
|
||||
],
|
||||
"@bazel_tools//src/conditions:windows": [
|
||||
"/wd4005",
|
||||
"/wd4018",
|
||||
"/wd4244",
|
||||
"/wd4267",
|
||||
"/wd4996",
|
||||
],
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": [
|
||||
"-Wno-format-nonliteral",
|
||||
"-Wno-maybe-uninitialized",
|
||||
"-Wno-sign-compare",
|
||||
"-Wno-type-limits",
|
||||
],
|
||||
}),
|
||||
includes = ["src/main/native/thirdparty/apriltag/include/common"],
|
||||
strip_include_prefix = "src/main/native/thirdparty/apriltag/include",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
generate_resources(
|
||||
name = "generate-resources",
|
||||
namespace = "frc",
|
||||
prefix = "APRILTAG",
|
||||
resource_files = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "apriltag.static",
|
||||
srcs = [":generate-resources"] + glob(
|
||||
["src/main/native/cpp/**"],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
defines = ["WPILIB_EXPORTS"],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":thirdparty-apriltag",
|
||||
"//wpimath:wpimath.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "apriltag-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
resource_strip_prefix = "apriltag/src/main/native/resources",
|
||||
resources = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//wpimath:wpimath-java",
|
||||
"//wpiutil:wpiutil-java",
|
||||
"@bzlmodrio-opencv//libraries/java/opencv",
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_annotations",
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_core",
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_databind",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "apriltag-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/cpp/**"]),
|
||||
tags = [
|
||||
"no-asan",
|
||||
],
|
||||
deps = [
|
||||
":apriltag.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":apriltag.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "DevMain-Java",
|
||||
srcs = ["src/dev/java/edu/wpi/first/apriltag/DevMain.java"],
|
||||
main_class = "edu.wpi.first.apriltag.DevMain",
|
||||
deps = [
|
||||
":apriltag-java",
|
||||
],
|
||||
)
|
||||
|
||||
py_binary(
|
||||
name = "convert_apriltag_layouts",
|
||||
srcs = ["convert_apriltag_layouts.py"],
|
||||
tags = ["manual"],
|
||||
)
|
||||
@@ -7,10 +7,11 @@ AprilTagFields expects.
|
||||
|
||||
The input CSV has the following format:
|
||||
|
||||
* Columns: ID, X, Y, Z, Rotation
|
||||
* Columns: ID, X, Y, Z, Z Rotation, Y Rotation
|
||||
* ID is a positive integer
|
||||
* X, Y, and Z are decimal inches
|
||||
* Rotation is yaw in degrees
|
||||
* Z Rotation is yaw in degrees
|
||||
* Y Rotation is pitch in degrees
|
||||
|
||||
The values come from a table in the layout marking diagram (e.g.,
|
||||
https://firstfrc.blob.core.windows.net/frc2024/FieldAssets/2024LayoutMarkingDiagram.pdf).
|
||||
@@ -48,13 +49,14 @@ def main():
|
||||
x = float(row[1])
|
||||
y = float(row[2])
|
||||
z = float(row[3])
|
||||
rotation = float(row[4])
|
||||
zRotation = float(row[4])
|
||||
yRotation = float(row[5])
|
||||
|
||||
# Turn yaw into quaternion
|
||||
q = geometry.Rotation3d(
|
||||
units.radians(0.0),
|
||||
units.radians(0.0),
|
||||
units.degreesToRadians(rotation),
|
||||
units.radians(0),
|
||||
units.degreesToRadians(yRotation),
|
||||
units.degreesToRadians(zRotation),
|
||||
).getQuaternion()
|
||||
|
||||
json_data["tags"].append(
|
||||
|
||||
@@ -13,13 +13,17 @@ public enum AprilTagFields {
|
||||
/** 2023 Charged Up. */
|
||||
k2023ChargedUp("2023-chargedup.json"),
|
||||
/** 2024 Crescendo. */
|
||||
k2024Crescendo("2024-crescendo.json");
|
||||
k2024Crescendo("2024-crescendo.json"),
|
||||
/** 2025 Reefscape Welded (see TU 12). */
|
||||
k2025ReefscapeWelded("2025-reefscape-welded.json"),
|
||||
/** 2025 Reefscape AndyMark (see TU 12). */
|
||||
k2025ReefscapeAndyMark("2025-reefscape-andymark.json");
|
||||
|
||||
/** Base resource directory. */
|
||||
public static final String kBaseResourceDir = "/edu/wpi/first/apriltag/";
|
||||
|
||||
/** Alias to the current game. */
|
||||
public static final AprilTagFields kDefaultField = k2024Crescendo;
|
||||
public static final AprilTagFields kDefaultField = k2025ReefscapeWelded;
|
||||
|
||||
/** Resource filename. */
|
||||
public final String m_resourceFile;
|
||||
|
||||
@@ -133,6 +133,8 @@ namespace frc {
|
||||
std::string_view GetResource_2022_rapidreact_json();
|
||||
std::string_view GetResource_2023_chargedup_json();
|
||||
std::string_view GetResource_2024_crescendo_json();
|
||||
std::string_view GetResource_2025_reefscape_welded_json();
|
||||
std::string_view GetResource_2025_reefscape_andymark_json();
|
||||
|
||||
} // namespace frc
|
||||
|
||||
@@ -148,6 +150,12 @@ AprilTagFieldLayout AprilTagFieldLayout::LoadField(AprilTagField field) {
|
||||
case AprilTagField::k2024Crescendo:
|
||||
fieldString = GetResource_2024_crescendo_json();
|
||||
break;
|
||||
case AprilTagField::k2025ReefscapeWelded:
|
||||
fieldString = GetResource_2025_reefscape_welded_json();
|
||||
break;
|
||||
case AprilTagField::k2025ReefscapeAndyMark:
|
||||
fieldString = GetResource_2025_reefscape_andymark_json();
|
||||
break;
|
||||
case AprilTagField::kNumFields:
|
||||
throw std::invalid_argument("Invalid Field");
|
||||
}
|
||||
|
||||
@@ -20,6 +20,12 @@ enum class AprilTagField {
|
||||
k2023ChargedUp,
|
||||
/// 2024 Crescendo.
|
||||
k2024Crescendo,
|
||||
/// 2025 Reefscape AndyMark (see TU12).
|
||||
k2025ReefscapeAndyMark,
|
||||
/// 2025 Reefscape Welded (see TU12).
|
||||
k2025ReefscapeWelded,
|
||||
/// Alias to the current game.
|
||||
kDefaultField = k2025ReefscapeWelded,
|
||||
|
||||
// This is a placeholder for denoting the last supported field. This should
|
||||
// always be the last entry in the enum and should not be used by users
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
ID,X,Y,Z,Rotation
|
||||
1,593.68,9.68,53.38,120
|
||||
2,637.21,34.79,53.38,120
|
||||
3,652.73,196.17,57.13,180
|
||||
4,652.73,218.42,57.13,180
|
||||
5,578.77,323.00,53.38,270
|
||||
6,72.5,323.00,53.38,270
|
||||
7,-1.50,218.42,57.13,0
|
||||
8,-1.50,196.17,57.13,0
|
||||
9,14.02,34.79,53.38,60
|
||||
10,57.54,9.68,53.38,60
|
||||
11,468.69,146.19,52.00,300
|
||||
12,468.69,177.10,52.00,60
|
||||
13,441.74,161.62,52.00,180
|
||||
14,209.48,161.62,52.00,0
|
||||
15,182.73,177.10,52.00,120
|
||||
16,182.73,146.19,52.00,240
|
||||
|
@@ -0,0 +1,23 @@
|
||||
ID,X,Y,Z,Z-Rotation,X-Rotation
|
||||
1,656.98,24.73,58.5,126,0
|
||||
2,656.98,291.9,58.5,234,0
|
||||
3,452.4,316.21,51.25,270,0
|
||||
4,365.2,241.44,73.54,0,30
|
||||
5,365.2,75.19,73.54,0,30
|
||||
6,530.49,129.97,12.13,300,0
|
||||
7,546.87,158.3,12.13,0,0
|
||||
8,530.49,186.63,12.13,60,0
|
||||
9,497.77,186.63,12.13,120,0
|
||||
10,481.39,158.3,12.13,180,0
|
||||
11,497.77,129.97,12.13,240,0
|
||||
12,33.91,24.73,58.5,54,0
|
||||
13,33.91,291.9,58.5,306,0
|
||||
14,325.68,241.44,73.54,180,30
|
||||
15,325.68,75.19,73.54,180,30
|
||||
16,238.49,0.42,51.25,90,0
|
||||
17,160.39,129.97,12.13,240,0
|
||||
18,144,158.3,12.13,180,0
|
||||
19,160.39,186.63,12.13,120,0
|
||||
20,193.1,186.63,12.13,60,0
|
||||
21,209.49,158.3,12.13,0,0
|
||||
22,193.1,129.97,12.13,300,0
|
||||
|
@@ -0,0 +1,404 @@
|
||||
{
|
||||
"tags": [
|
||||
{
|
||||
"ID": 1,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 16.687292,
|
||||
"y": 0.628142,
|
||||
"z": 1.4859
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.4539904997395468,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8910065241883678
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 2,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 16.687292,
|
||||
"y": 7.414259999999999,
|
||||
"z": 1.4859
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.45399049973954675,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8910065241883679
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 3,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 11.49096,
|
||||
"y": 8.031733999999998,
|
||||
"z": 1.30175
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.7071067811865475,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.7071067811865476
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 4,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 9.276079999999999,
|
||||
"y": 6.132575999999999,
|
||||
"z": 1.8679160000000001
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.9659258262890683,
|
||||
"X": 0.0,
|
||||
"Y": 0.25881904510252074,
|
||||
"Z": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 5,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 9.276079999999999,
|
||||
"y": 1.9098259999999998,
|
||||
"z": 1.8679160000000001
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.9659258262890683,
|
||||
"X": 0.0,
|
||||
"Y": 0.25881904510252074,
|
||||
"Z": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 6,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 13.474446,
|
||||
"y": 3.3012379999999997,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.8660254037844387,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.49999999999999994
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 7,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 13.890498,
|
||||
"y": 4.0208200000000005,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 1.0,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 8,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 13.474446,
|
||||
"y": 4.740402,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.8660254037844387,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.49999999999999994
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 9,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 12.643358,
|
||||
"y": 4.740402,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.5000000000000001,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8660254037844386
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 10,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 12.227305999999999,
|
||||
"y": 4.0208200000000005,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 6.123233995736766e-17,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 11,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 12.643358,
|
||||
"y": 3.3012379999999997,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.4999999999999998,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8660254037844387
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 12,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 0.8613139999999999,
|
||||
"y": 0.628142,
|
||||
"z": 1.4859
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.8910065241883679,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.45399049973954675
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 13,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 0.8613139999999999,
|
||||
"y": 7.414259999999999,
|
||||
"z": 1.4859
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.8910065241883678,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.45399049973954686
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 14,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 8.272272,
|
||||
"y": 6.132575999999999,
|
||||
"z": 1.8679160000000001
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 5.914589856893349e-17,
|
||||
"X": -0.25881904510252074,
|
||||
"Y": 1.5848095757158825e-17,
|
||||
"Z": 0.9659258262890683
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 15,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 8.272272,
|
||||
"y": 1.9098259999999998,
|
||||
"z": 1.8679160000000001
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 5.914589856893349e-17,
|
||||
"X": -0.25881904510252074,
|
||||
"Y": 1.5848095757158825e-17,
|
||||
"Z": 0.9659258262890683
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 16,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 6.057646,
|
||||
"y": 0.010667999999999999,
|
||||
"z": 1.30175
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.7071067811865476,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.7071067811865476
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 17,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 4.073905999999999,
|
||||
"y": 3.3012379999999997,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.4999999999999998,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8660254037844387
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 18,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 3.6576,
|
||||
"y": 4.0208200000000005,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 6.123233995736766e-17,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 19,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 4.073905999999999,
|
||||
"y": 4.740402,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.5000000000000001,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8660254037844386
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 20,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 4.904739999999999,
|
||||
"y": 4.740402,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.8660254037844387,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.49999999999999994
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 21,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 5.321046,
|
||||
"y": 4.0208200000000005,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 1.0,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 22,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 4.904739999999999,
|
||||
"y": 3.3012379999999997,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.8660254037844387,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.49999999999999994
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"field": {
|
||||
"length": 17.548,
|
||||
"width": 8.042
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
ID,X,Y,Z,Z-Rotation,X-Rotation
|
||||
1,657.37,25.8,58.5,126,0
|
||||
2,657.37,291.2,58.5,234,0
|
||||
3,455.15,317.15,51.25,270,0
|
||||
4,365.2,241.64,73.54,0,30
|
||||
5,365.2,75.39,73.54,0,30
|
||||
6,530.49,130.17,12.13,300,0
|
||||
7,546.87,158.5,12.13,0,0
|
||||
8,530.49,186.83,12.13,60,0
|
||||
9,497.77,186.83,12.13,120,0
|
||||
10,481.39,158.5,12.13,180,0
|
||||
11,497.77,130.17,12.13,240,0
|
||||
12,33.51,25.8,58.5,54,0
|
||||
13,33.51,291.2,58.5,306,0
|
||||
14,325.68,241.64,73.54,180,30
|
||||
15,325.68,75.39,73.54,180,30
|
||||
16,235.73,-0.15,51.25,90,0
|
||||
17,160.39,130.17,12.13,240,0
|
||||
18,144,158.5,12.13,180,0
|
||||
19,160.39,186.83,12.13,120,0
|
||||
20,193.1,186.83,12.13,60,0
|
||||
21,209.49,158.5,12.13,0,0
|
||||
22,193.1,130.17,12.13,300,0
|
||||
|
@@ -0,0 +1,404 @@
|
||||
{
|
||||
"tags": [
|
||||
{
|
||||
"ID": 1,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 16.697198,
|
||||
"y": 0.65532,
|
||||
"z": 1.4859
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.4539904997395468,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8910065241883678
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 2,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 16.697198,
|
||||
"y": 7.3964799999999995,
|
||||
"z": 1.4859
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.45399049973954675,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8910065241883679
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 3,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 11.560809999999998,
|
||||
"y": 8.05561,
|
||||
"z": 1.30175
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.7071067811865475,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.7071067811865476
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 4,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 9.276079999999999,
|
||||
"y": 6.137656,
|
||||
"z": 1.8679160000000001
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.9659258262890683,
|
||||
"X": 0.0,
|
||||
"Y": 0.25881904510252074,
|
||||
"Z": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 5,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 9.276079999999999,
|
||||
"y": 1.914906,
|
||||
"z": 1.8679160000000001
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.9659258262890683,
|
||||
"X": 0.0,
|
||||
"Y": 0.25881904510252074,
|
||||
"Z": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 6,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 13.474446,
|
||||
"y": 3.3063179999999996,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.8660254037844387,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.49999999999999994
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 7,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 13.890498,
|
||||
"y": 4.0259,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 1.0,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 8,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 13.474446,
|
||||
"y": 4.745482,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.8660254037844387,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.49999999999999994
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 9,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 12.643358,
|
||||
"y": 4.745482,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.5000000000000001,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8660254037844386
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 10,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 12.227305999999999,
|
||||
"y": 4.0259,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 6.123233995736766e-17,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 11,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 12.643358,
|
||||
"y": 3.3063179999999996,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.4999999999999998,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8660254037844387
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 12,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 0.851154,
|
||||
"y": 0.65532,
|
||||
"z": 1.4859
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.8910065241883679,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.45399049973954675
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 13,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 0.851154,
|
||||
"y": 7.3964799999999995,
|
||||
"z": 1.4859
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.8910065241883678,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.45399049973954686
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 14,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 8.272272,
|
||||
"y": 6.137656,
|
||||
"z": 1.8679160000000001
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 5.914589856893349e-17,
|
||||
"X": -0.25881904510252074,
|
||||
"Y": 1.5848095757158825e-17,
|
||||
"Z": 0.9659258262890683
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 15,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 8.272272,
|
||||
"y": 1.914906,
|
||||
"z": 1.8679160000000001
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 5.914589856893349e-17,
|
||||
"X": -0.25881904510252074,
|
||||
"Y": 1.5848095757158825e-17,
|
||||
"Z": 0.9659258262890683
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 16,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 5.9875419999999995,
|
||||
"y": -0.0038099999999999996,
|
||||
"z": 1.30175
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.7071067811865476,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.7071067811865476
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 17,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 4.073905999999999,
|
||||
"y": 3.3063179999999996,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.4999999999999998,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8660254037844387
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 18,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 3.6576,
|
||||
"y": 4.0259,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 6.123233995736766e-17,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 1.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 19,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 4.073905999999999,
|
||||
"y": 4.745482,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.5000000000000001,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.8660254037844386
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 20,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 4.904739999999999,
|
||||
"y": 4.745482,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 0.8660254037844387,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.49999999999999994
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 21,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 5.321046,
|
||||
"y": 4.0259,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": 1.0,
|
||||
"X": 0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.0
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"ID": 22,
|
||||
"pose": {
|
||||
"translation": {
|
||||
"x": 4.904739999999999,
|
||||
"y": 3.3063179999999996,
|
||||
"z": 0.308102
|
||||
},
|
||||
"rotation": {
|
||||
"quaternion": {
|
||||
"W": -0.8660254037844387,
|
||||
"X": -0.0,
|
||||
"Y": 0.0,
|
||||
"Z": 0.49999999999999994
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"field": {
|
||||
"length": 17.548,
|
||||
"width": 8.052
|
||||
}
|
||||
}
|
||||
@@ -9,5 +9,5 @@ repositories {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation "edu.wpi.first:native-utils:2025.9.0"
|
||||
implementation "edu.wpi.first:native-utils:2025.9.1"
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class WPIJREArtifact extends MavenArtifact {
|
||||
|
||||
private boolean checkJreVersion = true;
|
||||
|
||||
private final String artifactLocation = "edu.wpi.first.jdk:roborio-2024:17.0.9u7-1"
|
||||
private final String artifactLocation = "edu.wpi.first.jdk:roborio-2024:17.0.9u7-3"
|
||||
|
||||
@Inject
|
||||
public WPIJREArtifact(String name, RemoteTarget target) {
|
||||
|
||||
@@ -1,6 +1,22 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary")
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
|
||||
cc_library(
|
||||
name = "cameraserver.static",
|
||||
srcs = glob(["src/main/native/cpp/**"]),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
includes = [
|
||||
"cpp",
|
||||
"src/main/native/include",
|
||||
],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//cscore:cscore.static",
|
||||
"//ntcore:ntcore.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "cameraserver-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
@@ -16,10 +32,21 @@ java_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "cameraserver-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/**"]),
|
||||
deps = [
|
||||
":cameraserver.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":cameraserver.static",
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@@ -14,18 +14,20 @@ macro(wpilib_target_warnings target)
|
||||
|
||||
target_compile_options(${target} PRIVATE ${WARNING_FLAGS})
|
||||
else()
|
||||
target_compile_options(
|
||||
${target}
|
||||
PRIVATE
|
||||
/wd4146
|
||||
/wd4244
|
||||
/wd4251
|
||||
/wd4267
|
||||
/wd4324
|
||||
/WX
|
||||
/D_CRT_SECURE_NO_WARNINGS
|
||||
${WPILIB_TARGET_WARNINGS}
|
||||
set(WARNING_FLAGS
|
||||
/wd4146
|
||||
/wd4244
|
||||
/wd4251
|
||||
/wd4267
|
||||
/wd4324
|
||||
/D_CRT_SECURE_NO_WARNINGS
|
||||
${WPILIB_TARGET_WARNINGS}
|
||||
)
|
||||
if(NOT NO_WERROR)
|
||||
set(WARNING_FLAGS ${WARNING_FLAGS} /WX)
|
||||
endif()
|
||||
|
||||
target_compile_options(${target} PRIVATE ${WARNING_FLAGS})
|
||||
endif()
|
||||
|
||||
# Suppress C++-specific OpenCV warning; C compiler rejects it with an error
|
||||
@@ -44,7 +46,7 @@ macro(wpilib_target_warnings target)
|
||||
|
||||
# Suppress warning "enumeration types with a fixed underlying type are a
|
||||
# Clang extension"
|
||||
if(APPLE)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:C>:-Wno-fixed-enum-extension>)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -1,5 +1,76 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test", "objc_library")
|
||||
load("@rules_java//java:defs.bzl", "java_binary", "java_library")
|
||||
|
||||
WIN_SRCS = glob([
|
||||
"src/main/native/windows/**/*.cpp",
|
||||
"src/main/native/windows/**/*.h",
|
||||
])
|
||||
|
||||
LINUX_SRCS = glob([
|
||||
"src/main/native/linux/**/*.cpp",
|
||||
"src/main/native/linux/**/*.h",
|
||||
])
|
||||
|
||||
MAC_SRCS = glob(["src/main/native/osx/**/*.cpp"])
|
||||
|
||||
filegroup(
|
||||
name = "native-srcs",
|
||||
srcs = select({
|
||||
"@bazel_tools//src/conditions:darwin": MAC_SRCS,
|
||||
"@bazel_tools//src/conditions:windows": WIN_SRCS,
|
||||
"@rules_bzlmodrio_toolchains//constraints/combined:is_linux": LINUX_SRCS,
|
||||
}),
|
||||
)
|
||||
|
||||
objc_library(
|
||||
name = "cscore-mac",
|
||||
srcs = glob([
|
||||
"src/main/native/objcpp/**/*.mm",
|
||||
"src/main/native/cpp/*.h",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"src/main/native/include/**/*",
|
||||
"src/main/native/objcpp/**/*.h",
|
||||
]),
|
||||
copts = [
|
||||
"-std=c++20",
|
||||
],
|
||||
includes = [
|
||||
"src/main/native/cpp",
|
||||
"src/main/native/include",
|
||||
"src/main/native/objcpp",
|
||||
],
|
||||
tags = ["manual"],
|
||||
deps = [
|
||||
"//wpinet:wpinet.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
"@bzlmodrio-opencv//libraries/cpp/opencv",
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "cscore.static",
|
||||
srcs = [":native-srcs"] + glob(
|
||||
["src/main/native/cpp/**"],
|
||||
exclude = ["src/main/native/cpp/jni/**"],
|
||||
),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
includes = [
|
||||
"src/main/native/cpp",
|
||||
"src/main/native/include",
|
||||
],
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//wpinet:wpinet.static",
|
||||
"//wpiutil:wpiutil.static",
|
||||
"@bzlmodrio-opencv//libraries/cpp/opencv",
|
||||
] + select({
|
||||
"@bazel_tools//src/conditions:darwin": [":cscore-mac"],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "cscore-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
@@ -10,6 +81,24 @@ java_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "cscore-cpp-test",
|
||||
size = "small",
|
||||
srcs = glob(["src/test/native/**"]),
|
||||
deps = [
|
||||
":cscore.static",
|
||||
"//thirdparty/googletest:googletest.static",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "DevMain-Cpp",
|
||||
srcs = ["src/dev/native/cpp/main.cpp"],
|
||||
deps = [
|
||||
":cscore.static",
|
||||
],
|
||||
)
|
||||
|
||||
java_binary(
|
||||
name = "DevMain-Java",
|
||||
srcs = ["src/dev/java/edu/wpi/first/cscore/DevMain.java"],
|
||||
|
||||
@@ -185,7 +185,7 @@ model {
|
||||
lib project: ':wpinet', library: 'wpinet', linkage: 'shared'
|
||||
lib project: ':wpigui', library: 'wpigui', linkage: 'static'
|
||||
lib library: 'cscore', linkage: 'shared'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imgui', linkage: 'static'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
|
||||
it.buildable = false
|
||||
return
|
||||
|
||||
@@ -6,6 +6,7 @@ package edu.wpi.first.cscore;
|
||||
|
||||
import edu.wpi.first.util.PixelFormat;
|
||||
import edu.wpi.first.util.RawFrame;
|
||||
import edu.wpi.first.util.TimestampSource;
|
||||
import java.nio.ByteBuffer;
|
||||
import org.opencv.core.CvType;
|
||||
import org.opencv.core.Mat;
|
||||
@@ -44,7 +45,7 @@ public class CvSink extends ImageSink {
|
||||
* Create a sink for accepting OpenCV images. grabFrame() must be called on the created sink to
|
||||
* get each new image.
|
||||
*
|
||||
* @param name Source name (arbitrary unique identifier)
|
||||
* @param name Sink name (arbitrary unique identifier)
|
||||
* @param pixelFormat Source pixel format
|
||||
*/
|
||||
public CvSink(String name, PixelFormat pixelFormat) {
|
||||
@@ -220,4 +221,22 @@ public class CvSink extends ImageSink {
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the last time a frame was grabbed. This uses the same time base as wpi::Now().
|
||||
*
|
||||
* @return Time in 1 us increments.
|
||||
*/
|
||||
public long getLastFrameTime() {
|
||||
return m_frame.getTimestamp();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time source for the timestamp the last frame was grabbed at.
|
||||
*
|
||||
* @return Time source
|
||||
*/
|
||||
public TimestampSource getLastFrameTimeSource() {
|
||||
return m_frame.getTimestampSource();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,18 +16,22 @@
|
||||
|
||||
using namespace cs;
|
||||
|
||||
Frame::Frame(SourceImpl& source, std::string_view error, Time time)
|
||||
Frame::Frame(SourceImpl& source, std::string_view error, Time time,
|
||||
WPI_TimestampSource timeSrc)
|
||||
: m_impl{source.AllocFrameImpl().release()} {
|
||||
m_impl->refcount = 1;
|
||||
m_impl->error = error;
|
||||
m_impl->time = time;
|
||||
m_impl->timeSource = timeSrc;
|
||||
}
|
||||
|
||||
Frame::Frame(SourceImpl& source, std::unique_ptr<Image> image, Time time)
|
||||
Frame::Frame(SourceImpl& source, std::unique_ptr<Image> image, Time time,
|
||||
WPI_TimestampSource timeSrc)
|
||||
: m_impl{source.AllocFrameImpl().release()} {
|
||||
m_impl->refcount = 1;
|
||||
m_impl->error.resize(0);
|
||||
m_impl->time = time;
|
||||
m_impl->timeSource = timeSrc;
|
||||
m_impl->images.push_back(image.release());
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ class Frame {
|
||||
wpi::recursive_mutex mutex;
|
||||
std::atomic_int refcount{0};
|
||||
Time time{0};
|
||||
WPI_TimestampSource timeSource{WPI_TIMESRC_UNKNOWN};
|
||||
SourceImpl& source;
|
||||
std::string error;
|
||||
wpi::SmallVector<Image*, 4> images;
|
||||
@@ -48,9 +49,11 @@ class Frame {
|
||||
public:
|
||||
Frame() noexcept = default;
|
||||
|
||||
Frame(SourceImpl& source, std::string_view error, Time time);
|
||||
Frame(SourceImpl& source, std::string_view error, Time time,
|
||||
WPI_TimestampSource timeSrc);
|
||||
|
||||
Frame(SourceImpl& source, std::unique_ptr<Image> image, Time time);
|
||||
Frame(SourceImpl& source, std::unique_ptr<Image> image, Time time,
|
||||
WPI_TimestampSource timeSrc);
|
||||
|
||||
Frame(const Frame& frame) noexcept : m_impl{frame.m_impl} {
|
||||
if (m_impl) {
|
||||
@@ -75,6 +78,9 @@ class Frame {
|
||||
}
|
||||
|
||||
Time GetTime() const { return m_impl ? m_impl->time : 0; }
|
||||
WPI_TimestampSource GetTimeSource() const {
|
||||
return m_impl ? m_impl->timeSource : WPI_TIMESRC_UNKNOWN;
|
||||
}
|
||||
|
||||
std::string_view GetError() const {
|
||||
if (!m_impl) {
|
||||
|
||||
@@ -50,7 +50,7 @@ inline void NamedLog(wpi::Logger& logger, unsigned int level, const char* file,
|
||||
|
||||
#define SLOG(level, format, ...) \
|
||||
NamedLog(m_logger, level, __FILE__, __LINE__, GetName(), \
|
||||
FMT_STRING(format) __VA_OPT__(, ) __VA_ARGS__)
|
||||
format __VA_OPT__(, ) __VA_ARGS__)
|
||||
|
||||
#define SERROR(format, ...) \
|
||||
SLOG(::wpi::WPI_LOG_ERROR, format __VA_OPT__(, ) __VA_ARGS__)
|
||||
|
||||
@@ -63,6 +63,11 @@ uint64_t RawSinkImpl::GrabFrame(WPI_RawFrame& image) {
|
||||
}
|
||||
|
||||
uint64_t RawSinkImpl::GrabFrame(WPI_RawFrame& image, double timeout) {
|
||||
return GrabFrame(image, timeout, 0);
|
||||
}
|
||||
|
||||
uint64_t RawSinkImpl::GrabFrame(WPI_RawFrame& image, double timeout,
|
||||
uint64_t lastFrameTime) {
|
||||
SetEnabled(true);
|
||||
|
||||
auto source = GetSource();
|
||||
@@ -72,7 +77,7 @@ uint64_t RawSinkImpl::GrabFrame(WPI_RawFrame& image, double timeout) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto frame = source->GetNextFrame(timeout); // blocks
|
||||
auto frame = source->GetNextFrame(timeout, lastFrameTime); // blocks
|
||||
if (!frame) {
|
||||
// Bad frame; sleep for 20 ms so we don't consume all processor time.
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
@@ -115,6 +120,8 @@ uint64_t RawSinkImpl::GrabFrameImpl(WPI_RawFrame& rawFrame,
|
||||
rawFrame.pixelFormat = newImage->pixelFormat;
|
||||
rawFrame.size = newImage->size();
|
||||
std::copy(newImage->data(), newImage->data() + rawFrame.size, rawFrame.data);
|
||||
rawFrame.timestamp = incomingFrame.GetTime();
|
||||
rawFrame.timestampSrc = incomingFrame.GetTimeSource();
|
||||
|
||||
return incomingFrame.GetTime();
|
||||
}
|
||||
@@ -183,6 +190,18 @@ uint64_t GrabSinkFrameTimeout(CS_Sink sink, WPI_RawFrame& image, double timeout,
|
||||
return static_cast<RawSinkImpl&>(*data->sink).GrabFrame(image, timeout);
|
||||
}
|
||||
|
||||
uint64_t GrabSinkFrameTimeoutLastTime(CS_Sink sink, WPI_RawFrame& image,
|
||||
double timeout, uint64_t lastFrameTime,
|
||||
CS_Status* status) {
|
||||
auto data = Instance::GetInstance().GetSink(sink);
|
||||
if (!data || (data->kind & SinkMask) == 0) {
|
||||
*status = CS_INVALID_HANDLE;
|
||||
return 0;
|
||||
}
|
||||
return static_cast<RawSinkImpl&>(*data->sink)
|
||||
.GrabFrame(image, timeout, lastFrameTime);
|
||||
}
|
||||
|
||||
} // namespace cs
|
||||
|
||||
extern "C" {
|
||||
@@ -209,4 +228,13 @@ uint64_t CS_GrabRawSinkFrameTimeout(CS_Sink sink, struct WPI_RawFrame* image,
|
||||
return cs::GrabSinkFrameTimeout(sink, *image, timeout, status);
|
||||
}
|
||||
|
||||
uint64_t CS_GrabRawSinkFrameTimeoutWithFrameTime(CS_Sink sink,
|
||||
struct WPI_RawFrame* image,
|
||||
double timeout,
|
||||
uint64_t lastFrameTime,
|
||||
CS_Status* status) {
|
||||
return cs::GrabSinkFrameTimeoutLastTime(sink, *image, timeout, lastFrameTime,
|
||||
status);
|
||||
}
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -34,10 +34,15 @@ class RawSinkImpl : public SinkImpl {
|
||||
|
||||
uint64_t GrabFrame(WPI_RawFrame& frame);
|
||||
uint64_t GrabFrame(WPI_RawFrame& frame, double timeout);
|
||||
// Wait for a frame with a time other than lastFrameTime
|
||||
uint64_t GrabFrame(WPI_RawFrame& frame, double timeout,
|
||||
uint64_t lastFrameTime);
|
||||
|
||||
private:
|
||||
void ThreadMain();
|
||||
|
||||
// Copies the image from incomingFrame into rawFrame, converting where
|
||||
// necessary to the resolution of rawFrame
|
||||
uint64_t GrabFrameImpl(WPI_RawFrame& rawFrame, Frame& incomingFrame);
|
||||
|
||||
std::atomic_bool m_active; // set to false to terminate threads
|
||||
|
||||
@@ -29,7 +29,7 @@ SourceImpl::SourceImpl(std::string_view name, wpi::Logger& logger,
|
||||
m_notifier(notifier),
|
||||
m_telemetry(telemetry),
|
||||
m_name{name} {
|
||||
m_frame = Frame{*this, std::string_view{}, 0};
|
||||
m_frame = Frame{*this, std::string_view{}, 0, WPI_TIMESRC_UNKNOWN};
|
||||
}
|
||||
|
||||
SourceImpl::~SourceImpl() {
|
||||
@@ -84,13 +84,19 @@ Frame SourceImpl::GetNextFrame() {
|
||||
return m_frame;
|
||||
}
|
||||
|
||||
Frame SourceImpl::GetNextFrame(double timeout) {
|
||||
Frame SourceImpl::GetNextFrame(double timeout, Frame::Time lastFrameTime) {
|
||||
std::unique_lock lock{m_frameMutex};
|
||||
auto oldTime = m_frame.GetTime();
|
||||
|
||||
if (lastFrameTime == 0) {
|
||||
lastFrameTime = m_frame.GetTime();
|
||||
}
|
||||
|
||||
// Wait unitl m_frame has a timestamp other than lastFrameTime
|
||||
if (!m_frameCv.wait_for(
|
||||
lock, std::chrono::milliseconds(static_cast<int>(timeout * 1000)),
|
||||
[=, this] { return m_frame.GetTime() != oldTime; })) {
|
||||
m_frame = Frame{*this, "timed out getting frame", wpi::Now()};
|
||||
[=, this] { return m_frame.GetTime() != lastFrameTime; })) {
|
||||
m_frame = Frame{*this, "timed out getting frame", wpi::Now(),
|
||||
WPI_TIMESRC_UNKNOWN};
|
||||
}
|
||||
return m_frame;
|
||||
}
|
||||
@@ -98,7 +104,7 @@ Frame SourceImpl::GetNextFrame(double timeout) {
|
||||
void SourceImpl::Wakeup() {
|
||||
{
|
||||
std::scoped_lock lock{m_frameMutex};
|
||||
m_frame = Frame{*this, std::string_view{}, 0};
|
||||
m_frame = Frame{*this, std::string_view{}, 0, WPI_TIMESRC_UNKNOWN};
|
||||
}
|
||||
m_frameCv.notify_all();
|
||||
}
|
||||
@@ -458,7 +464,8 @@ std::unique_ptr<Image> SourceImpl::AllocImage(
|
||||
}
|
||||
|
||||
void SourceImpl::PutFrame(VideoMode::PixelFormat pixelFormat, int width,
|
||||
int height, std::string_view data, Frame::Time time) {
|
||||
int height, std::string_view data, Frame::Time time,
|
||||
WPI_TimestampSource timeSrc) {
|
||||
if (pixelFormat == VideoMode::PixelFormat::kBGRA) {
|
||||
// Write BGRA as BGR to save a copy
|
||||
auto image =
|
||||
@@ -475,10 +482,11 @@ void SourceImpl::PutFrame(VideoMode::PixelFormat pixelFormat, int width,
|
||||
fmt::ptr(data.data()), data.size());
|
||||
std::memcpy(image->data(), data.data(), data.size());
|
||||
|
||||
PutFrame(std::move(image), time);
|
||||
PutFrame(std::move(image), time, timeSrc);
|
||||
}
|
||||
|
||||
void SourceImpl::PutFrame(std::unique_ptr<Image> image, Frame::Time time) {
|
||||
void SourceImpl::PutFrame(std::unique_ptr<Image> image, Frame::Time time,
|
||||
WPI_TimestampSource timeSrc) {
|
||||
// Update telemetry
|
||||
m_telemetry.RecordSourceFrames(*this, 1);
|
||||
m_telemetry.RecordSourceBytes(*this, static_cast<int>(image->size()));
|
||||
@@ -486,7 +494,7 @@ void SourceImpl::PutFrame(std::unique_ptr<Image> image, Frame::Time time) {
|
||||
// Update frame
|
||||
{
|
||||
std::scoped_lock lock{m_frameMutex};
|
||||
m_frame = Frame{*this, std::move(image), time};
|
||||
m_frame = Frame{*this, std::move(image), time, timeSrc};
|
||||
}
|
||||
|
||||
// Signal listeners
|
||||
@@ -497,7 +505,7 @@ void SourceImpl::PutError(std::string_view msg, Frame::Time time) {
|
||||
// Update frame
|
||||
{
|
||||
std::scoped_lock lock{m_frameMutex};
|
||||
m_frame = Frame{*this, msg, time};
|
||||
m_frame = Frame{*this, msg, time, WPI_TIMESRC_UNKNOWN};
|
||||
}
|
||||
|
||||
// Signal listeners
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include <wpi/Logger.h>
|
||||
#include <wpi/RawFrame.h>
|
||||
#include <wpi/condition_variable.h>
|
||||
#include <wpi/json_fwd.h>
|
||||
#include <wpi/mutex.h>
|
||||
@@ -98,7 +99,8 @@ class SourceImpl : public PropertyContainer {
|
||||
|
||||
// Blocking function that waits for the next frame and returns it (with
|
||||
// timeout in seconds). If timeout expires, returns empty frame.
|
||||
Frame GetNextFrame(double timeout);
|
||||
// If lastFrameTime==0, uses m_frame.GetTime() for lastFrameTime
|
||||
Frame GetNextFrame(double timeout, Frame::Time lastFrameTime = 0);
|
||||
|
||||
// Force a wakeup of all GetNextFrame() callers by sending an empty frame.
|
||||
void Wakeup();
|
||||
@@ -140,8 +142,10 @@ class SourceImpl : public PropertyContainer {
|
||||
std::string_view valueStr) override;
|
||||
|
||||
void PutFrame(VideoMode::PixelFormat pixelFormat, int width, int height,
|
||||
std::string_view data, Frame::Time time);
|
||||
void PutFrame(std::unique_ptr<Image> image, Frame::Time time);
|
||||
std::string_view data, Frame::Time time,
|
||||
WPI_TimestampSource timeSrc = WPI_TIMESRC_FRAME_DEQUEUE);
|
||||
void PutFrame(std::unique_ptr<Image> image, Frame::Time time,
|
||||
WPI_TimestampSource timeSrc = WPI_TIMESRC_FRAME_DEQUEUE);
|
||||
void PutError(std::string_view msg, Frame::Time time);
|
||||
|
||||
// Notification functions for corresponding atomics
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <functional>
|
||||
|
||||
#include <opencv2/core/mat.hpp>
|
||||
#include <wpi/RawFrame.h>
|
||||
|
||||
#include "cscore_oo.h"
|
||||
#include "cscore_raw.h"
|
||||
@@ -151,6 +152,44 @@ class CvSink : public ImageSink {
|
||||
[[nodiscard]]
|
||||
uint64_t GrabFrameNoTimeoutDirect(cv::Mat& image);
|
||||
|
||||
/**
|
||||
* Wait for the next frame and get the image.
|
||||
* Times out (returning 0) after timeout seconds.
|
||||
* The provided image will have the pixelFormat this class was constructed
|
||||
* with. The data is backed by data in the CvSink. It will be invalidated by
|
||||
* any grabFrame*() call on the sink.
|
||||
*
|
||||
* <p>If lastFrameTime is provided and non-zero, the sink will fill image with
|
||||
* the first frame from the source that is not equal to lastFrameTime. If
|
||||
* lastFrameTime is zero, the time of the current frame owned by the CvSource
|
||||
* is used, and this function will block until the connected CvSource provides
|
||||
* a new frame.
|
||||
*
|
||||
* @return Frame time, or 0 on error (call GetError() to obtain the error
|
||||
* message); the frame time is in the same time base as wpi::Now(),
|
||||
* and is in 1 us increments.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
uint64_t GrabFrameDirectLastTime(cv::Mat& image, uint64_t lastFrameTime,
|
||||
double timeout = 0.225);
|
||||
|
||||
/**
|
||||
* Get the last time a frame was grabbed. This uses the same time base as
|
||||
* wpi::Now().
|
||||
*
|
||||
* @return Time in 1 us increments.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
uint64_t LastFrameTime();
|
||||
|
||||
/**
|
||||
* Get the time source for the timestamp the last frame was grabbed at.
|
||||
*
|
||||
* @return Time source
|
||||
*/
|
||||
[[nodiscard]]
|
||||
WPI_TimestampSource LastFrameTimeSource();
|
||||
|
||||
private:
|
||||
constexpr int GetCvFormat(WPI_PixelFormat pixelFormat);
|
||||
|
||||
@@ -365,6 +404,33 @@ inline uint64_t CvSink::GrabFrameNoTimeoutDirect(cv::Mat& image) {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
inline uint64_t CvSink::GrabFrameDirectLastTime(cv::Mat& image,
|
||||
uint64_t lastFrameTime,
|
||||
double timeout) {
|
||||
rawFrame.height = 0;
|
||||
rawFrame.width = 0;
|
||||
rawFrame.stride = 0;
|
||||
rawFrame.pixelFormat = pixelFormat;
|
||||
auto timestamp = GrabSinkFrameTimeoutLastTime(m_handle, rawFrame, timeout,
|
||||
lastFrameTime, &m_status);
|
||||
if (m_status != CS_OK) {
|
||||
return 0;
|
||||
}
|
||||
image =
|
||||
cv::Mat{rawFrame.height, rawFrame.width,
|
||||
GetCvFormat(static_cast<WPI_PixelFormat>(rawFrame.pixelFormat)),
|
||||
rawFrame.data, static_cast<size_t>(rawFrame.stride)};
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
inline uint64_t CvSink::LastFrameTime() {
|
||||
return rawFrame.timestamp;
|
||||
}
|
||||
|
||||
inline WPI_TimestampSource CvSink::LastFrameTimeSource() {
|
||||
return static_cast<WPI_TimestampSource>(rawFrame.timestampSrc);
|
||||
}
|
||||
|
||||
} // namespace cs
|
||||
|
||||
#endif // CSCORE_CSCORE_CV_H_
|
||||
|
||||
@@ -27,6 +27,11 @@ uint64_t CS_GrabRawSinkFrame(CS_Sink sink, struct WPI_RawFrame* rawImage,
|
||||
CS_Status* status);
|
||||
uint64_t CS_GrabRawSinkFrameTimeout(CS_Sink sink, struct WPI_RawFrame* rawImage,
|
||||
double timeout, CS_Status* status);
|
||||
uint64_t CS_GrabRawSinkFrameTimeoutWithFrameTime(CS_Sink sink,
|
||||
struct WPI_RawFrame* rawImage,
|
||||
double timeout,
|
||||
uint64_t lastFrameTime,
|
||||
CS_Status* status);
|
||||
|
||||
CS_Sink CS_CreateRawSink(const struct WPI_String* name, CS_Bool isCv,
|
||||
CS_Status* status);
|
||||
@@ -67,6 +72,9 @@ void PutSourceFrame(CS_Source source, const WPI_RawFrame& image,
|
||||
uint64_t GrabSinkFrame(CS_Sink sink, WPI_RawFrame& image, CS_Status* status);
|
||||
uint64_t GrabSinkFrameTimeout(CS_Sink sink, WPI_RawFrame& image, double timeout,
|
||||
CS_Status* status);
|
||||
uint64_t GrabSinkFrameTimeoutLastTime(CS_Sink sink, WPI_RawFrame& image,
|
||||
double timeout, uint64_t lastFrameTime,
|
||||
CS_Status* status);
|
||||
|
||||
/**
|
||||
* A source for user code to provide video frames as raw bytes.
|
||||
@@ -163,6 +171,24 @@ class RawSink : public ImageSink {
|
||||
*/
|
||||
[[nodiscard]]
|
||||
uint64_t GrabFrameNoTimeout(wpi::RawFrame& image) const;
|
||||
|
||||
/**
|
||||
* Wait for the next frame and get the image. May block forever.
|
||||
* The provided image will have three 8-bit channels stored in BGR order.
|
||||
*
|
||||
* <p>If lastFrameTime is provided and non-zero, the sink will fill image with
|
||||
* the first frame from the source that is not equal to lastFrameTime. If
|
||||
* lastFrameTime is zero, the time of the current frame owned by the CvSource
|
||||
* is used, and this function will block until the connected CvSource provides
|
||||
* a new frame.
|
||||
*
|
||||
* @return Frame time, or 0 on error (call GetError() to obtain the error
|
||||
* message); the frame time is in the same time base as wpi::Now(),
|
||||
* and is in 1 us increments.
|
||||
*/
|
||||
[[nodiscard]]
|
||||
uint64_t GrabFrameLastTime(wpi::RawFrame& image, uint64_t lastFrameTime,
|
||||
double timeout = 0.225) const;
|
||||
};
|
||||
|
||||
inline RawSource::RawSource(std::string_view name, const VideoMode& mode) {
|
||||
@@ -199,6 +225,14 @@ inline uint64_t RawSink::GrabFrameNoTimeout(wpi::RawFrame& image) const {
|
||||
m_status = 0;
|
||||
return GrabSinkFrame(m_handle, image, &m_status);
|
||||
}
|
||||
|
||||
inline uint64_t RawSink::GrabFrameLastTime(wpi::RawFrame& image,
|
||||
uint64_t lastFrameTime,
|
||||
double timeout) const {
|
||||
m_status = 0;
|
||||
return GrabSinkFrameTimeoutLastTime(m_handle, image, timeout, lastFrameTime,
|
||||
&m_status);
|
||||
}
|
||||
/** @} */
|
||||
|
||||
} // namespace cs
|
||||
|
||||
@@ -555,8 +555,51 @@ void UsbCameraImpl::CameraThreadMain() {
|
||||
good = false;
|
||||
}
|
||||
if (good) {
|
||||
Frame::Time frameTime{wpi::Now()};
|
||||
WPI_TimestampSource timeSource{WPI_TIMESRC_FRAME_DEQUEUE};
|
||||
|
||||
// check the timestamp time
|
||||
auto tsFlags = buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MASK;
|
||||
SDEBUG4("Flags {}", tsFlags);
|
||||
if (tsFlags == V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN) {
|
||||
SDEBUG4("Got unknown time for frame - default to wpi::Now");
|
||||
} else if (tsFlags == V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) {
|
||||
SDEBUG4("Got valid monotonic time for frame");
|
||||
// we can't go directly to frametime, since the rest of cscore
|
||||
// expects us to use wpi::Now, which is in an arbitrary timebase
|
||||
// (see timestamp.cpp). Best I can do is (approximately) translate
|
||||
// between timebases
|
||||
|
||||
// grab current time in the same timebase as buf.timestamp
|
||||
struct timespec ts;
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) {
|
||||
int64_t nowTime = {ts.tv_sec * 1'000'000 + ts.tv_nsec / 1000};
|
||||
int64_t bufTime = {buf.timestamp.tv_sec * 1'000'000 +
|
||||
buf.timestamp.tv_usec};
|
||||
// And offset frameTime by the latency
|
||||
int64_t offset{nowTime - bufTime};
|
||||
frameTime -= offset;
|
||||
|
||||
// Figure out the timestamp's source
|
||||
int tsrcFlags = buf.flags & V4L2_BUF_FLAG_TSTAMP_SRC_MASK;
|
||||
if (tsrcFlags == V4L2_BUF_FLAG_TSTAMP_SRC_EOF) {
|
||||
timeSource = WPI_TIMESRC_V4L_EOF;
|
||||
} else if (tsrcFlags == V4L2_BUF_FLAG_TSTAMP_SRC_SOE) {
|
||||
timeSource = WPI_TIMESRC_V4L_SOE;
|
||||
} else {
|
||||
timeSource = WPI_TIMESRC_UNKNOWN;
|
||||
}
|
||||
SDEBUG4("Frame was {} uS old, flags {}, source {}", offset,
|
||||
tsrcFlags, static_cast<int>(timeSource));
|
||||
} else {
|
||||
// Can't do anything if we can't access the clock, leave default
|
||||
}
|
||||
} else if (tsFlags == V4L2_BUF_FLAG_TIMESTAMP_COPY) {
|
||||
SDEBUG4("Got valid copy time for frame - default to wpi::Now");
|
||||
}
|
||||
|
||||
PutFrame(static_cast<VideoMode::PixelFormat>(m_mode.pixelFormat),
|
||||
width, height, image, wpi::Now()); // TODO: time
|
||||
width, height, image, frameTime, timeSource);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ inline void NamedLog(UsbCameraImplObjc* objc, unsigned int level,
|
||||
|
||||
#define OBJCLOG(level, format, ...) \
|
||||
NamedLog(self, level, __FILE__, __LINE__, \
|
||||
FMT_STRING(format) __VA_OPT__(, ) __VA_ARGS__)
|
||||
format __VA_OPT__(, ) __VA_ARGS__)
|
||||
|
||||
#define OBJCERROR(format, ...) \
|
||||
OBJCLOG(::wpi::WPI_LOG_ERROR, format __VA_OPT__(, ) __VA_ARGS__)
|
||||
|
||||
@@ -101,7 +101,7 @@ model {
|
||||
lib project: ':glass', library: 'glass', linkage: 'static'
|
||||
lib project: ':wpiutil', library: 'wpiutil', linkage: 'static'
|
||||
lib project: ':wpigui', library: 'wpigui', linkage: 'static'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imgui', linkage: 'static'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
|
||||
nativeUtils.useRequiredLibrary(it, 'libssh')
|
||||
if (it.targetPlatform.operatingSystem.isWindows()) {
|
||||
it.linker.args << 'Gdi32.lib' << 'Shell32.lib' << 'd3d11.lib' << 'd3dcompiler.lib'
|
||||
|
||||
@@ -5,4 +5,4 @@ include(CompileWarnings)
|
||||
file(GLOB developerRobotCpp_src src/main/native/cpp/*.cpp)
|
||||
|
||||
add_executable(developerRobotCpp ${developerRobotCpp_src})
|
||||
target_link_libraries(developerRobotCpp wpilibc)
|
||||
target_link_libraries(developerRobotCpp wpilibc wpilibNewCommands apriltag)
|
||||
|
||||
@@ -142,6 +142,19 @@ deploy {
|
||||
}
|
||||
}
|
||||
|
||||
// Prevent the eclipse compiler (used by the VS Code extension for intellisense and debugging)
|
||||
// from generating bad class files from annotation processors like Epilogue
|
||||
eclipse {
|
||||
classpath {
|
||||
containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
|
||||
file.whenMerged { cp ->
|
||||
def entries = cp.entries;
|
||||
def src = new org.gradle.plugins.ide.eclipse.model.SourceFolder('build/generated/sources/annotationProcessor/java/main/', null)
|
||||
entries.add(src)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register('deployJava') {
|
||||
try {
|
||||
dependsOn tasks.named('deployjreroborio')
|
||||
|
||||
22
epilogue-processor/BUILD.bazel
Normal file
22
epilogue-processor/BUILD.bazel
Normal file
@@ -0,0 +1,22 @@
|
||||
load("@rules_java//java:defs.bzl", "java_library", "java_plugin")
|
||||
|
||||
java_library(
|
||||
name = "processor",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
visibility = ["//visibility:public"],
|
||||
runtime_deps = [
|
||||
"//wpilibNewCommands:wpilibNewCommands-java",
|
||||
],
|
||||
deps = [
|
||||
"//epilogue-runtime:epilogue",
|
||||
],
|
||||
)
|
||||
|
||||
java_plugin(
|
||||
name = "plugin",
|
||||
processor_class = "edu.wpi.first.epilogue.processor.AnnotationProcessor",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
":processor",
|
||||
],
|
||||
)
|
||||
@@ -68,7 +68,9 @@ public class AnnotationProcessor extends AbstractProcessor {
|
||||
customLoggers.putAll(processCustomLoggers(roundEnv, customLogger));
|
||||
});
|
||||
|
||||
// Get all root types (classes and interfaces), excluding packages and modules
|
||||
roundEnv.getRootElements().stream()
|
||||
.filter(e -> e instanceof TypeElement)
|
||||
.filter(
|
||||
e ->
|
||||
processingEnv
|
||||
@@ -267,12 +269,18 @@ public class AnnotationProcessor extends AbstractProcessor {
|
||||
return false;
|
||||
}
|
||||
|
||||
processingEnv
|
||||
.getMessager()
|
||||
.printMessage(
|
||||
Diagnostic.Kind.NOTE,
|
||||
"[EPILOGUE] Excluded from logs because " + type + " is not a loggable data type",
|
||||
element);
|
||||
var classConfig = element.getEnclosingElement().getAnnotation(Logged.class);
|
||||
|
||||
if (classConfig == null || classConfig.warnForNonLoggableTypes()) {
|
||||
// Not loggable and not explicitly opted out of logging; print a warning message
|
||||
processingEnv
|
||||
.getMessager()
|
||||
.printMessage(
|
||||
Diagnostic.Kind.NOTE,
|
||||
"[EPILOGUE] Excluded from logs because " + type + " is not a loggable data type",
|
||||
element);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ public class LoggerGenerator {
|
||||
LoggerGenerator::isBuiltInJavaMethod;
|
||||
private final ProcessingEnvironment m_processingEnv;
|
||||
private final List<ElementHandler> m_handlers;
|
||||
|
||||
@SuppressWarnings("BadAnnotationImplementation")
|
||||
private final Logged m_defaultConfig =
|
||||
new Logged() {
|
||||
@Override
|
||||
@@ -69,6 +71,11 @@ public class LoggerGenerator {
|
||||
public Naming defaultNaming() {
|
||||
return Naming.USE_CODE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean warnForNonLoggableTypes() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
public LoggerGenerator(ProcessingEnvironment processingEnv, List<ElementHandler> handlers) {
|
||||
|
||||
@@ -1772,7 +1772,7 @@ class AnnotationProcessorTest {
|
||||
"""
|
||||
package edu.wpi.first.epilogue;
|
||||
|
||||
@Logged
|
||||
@Logged(warnForNonLoggableTypes = true)
|
||||
class Example {
|
||||
Throwable t;
|
||||
}
|
||||
@@ -1974,6 +1974,37 @@ class AnnotationProcessorTest {
|
||||
assertLoggerGenerates(source, expectedRootLogger);
|
||||
}
|
||||
|
||||
@Test
|
||||
void doesNotBreakWithPackageInfo() {
|
||||
String source =
|
||||
"""
|
||||
package example;
|
||||
|
||||
import edu.wpi.first.epilogue.*;
|
||||
|
||||
@Logged
|
||||
class Example {}
|
||||
""";
|
||||
|
||||
String packageInfo = """
|
||||
package example;
|
||||
""";
|
||||
|
||||
Compilation compilation =
|
||||
javac()
|
||||
.withOptions(kJavaVersionOptions)
|
||||
.withProcessors(new AnnotationProcessor())
|
||||
.compile(
|
||||
JavaFileObjects.forSourceString("example.Example", source),
|
||||
JavaFileObjects.forSourceString("example.package-info", packageInfo));
|
||||
|
||||
assertThat(compilation).succeeded();
|
||||
compilation.generatedSourceFiles().stream()
|
||||
.filter(jfo -> jfo.getName().contains("Example"))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("Logger file was not generated!"));
|
||||
}
|
||||
|
||||
private void assertCompilationError(
|
||||
String message, long lineNumber, long col, Diagnostic<? extends JavaFileObject> diagnostic) {
|
||||
assertAll(
|
||||
|
||||
12
epilogue-runtime/BUILD.bazel
Normal file
12
epilogue-runtime/BUILD.bazel
Normal file
@@ -0,0 +1,12 @@
|
||||
load("@rules_java//java:defs.bzl", "java_library")
|
||||
|
||||
java_library(
|
||||
name = "epilogue",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//ntcore:networktables-java",
|
||||
"//wpiunits",
|
||||
"//wpiutil:wpiutil-java",
|
||||
],
|
||||
)
|
||||
@@ -124,4 +124,12 @@ public @interface Logged {
|
||||
* for all logged fields and methods in an annotated class
|
||||
*/
|
||||
Naming defaultNaming() default Naming.USE_CODE_NAME;
|
||||
|
||||
/**
|
||||
* Class-level only: if {@link #strategy()} is {@link Strategy#OPT_OUT}, this can be used to quiet
|
||||
* the warnings that are printed for non-loggable fields and methods detected within the class.
|
||||
*
|
||||
* @return true if warnings should be printed, or false if warnings should not be printed
|
||||
*/
|
||||
boolean warnForNonLoggableTypes() default false;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class LazyBackend implements EpilogueBackend {
|
||||
return;
|
||||
}
|
||||
|
||||
m_previousValues.put(identifier, value);
|
||||
m_previousValues.put(identifier, value.clone());
|
||||
m_backend.log(identifier, value);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class LazyBackend implements EpilogueBackend {
|
||||
return;
|
||||
}
|
||||
|
||||
m_previousValues.put(identifier, value);
|
||||
m_previousValues.put(identifier, value.clone());
|
||||
m_backend.log(identifier, value);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ public class LazyBackend implements EpilogueBackend {
|
||||
return;
|
||||
}
|
||||
|
||||
m_previousValues.put(identifier, value);
|
||||
m_previousValues.put(identifier, value.clone());
|
||||
m_backend.log(identifier, value);
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class LazyBackend implements EpilogueBackend {
|
||||
return;
|
||||
}
|
||||
|
||||
m_previousValues.put(identifier, value);
|
||||
m_previousValues.put(identifier, value.clone());
|
||||
m_backend.log(identifier, value);
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ public class LazyBackend implements EpilogueBackend {
|
||||
return;
|
||||
}
|
||||
|
||||
m_previousValues.put(identifier, value);
|
||||
m_previousValues.put(identifier, value.clone());
|
||||
m_backend.log(identifier, value);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public class LazyBackend implements EpilogueBackend {
|
||||
return;
|
||||
}
|
||||
|
||||
m_previousValues.put(identifier, value);
|
||||
m_previousValues.put(identifier, value.clone());
|
||||
m_backend.log(identifier, value);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ public class LazyBackend implements EpilogueBackend {
|
||||
return;
|
||||
}
|
||||
|
||||
m_previousValues.put(identifier, value);
|
||||
m_previousValues.put(identifier, value.clone());
|
||||
m_backend.log(identifier, value);
|
||||
}
|
||||
|
||||
@@ -234,7 +234,7 @@ public class LazyBackend implements EpilogueBackend {
|
||||
return;
|
||||
}
|
||||
|
||||
m_previousValues.put(identifier, value);
|
||||
m_previousValues.put(identifier, value.clone());
|
||||
m_backend.log(identifier, value, struct);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
// 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.
|
||||
|
||||
package edu.wpi.first.epilogue.logging;
|
||||
|
||||
import edu.wpi.first.util.struct.Struct;
|
||||
import edu.wpi.first.util.struct.StructSerializable;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public record CustomStruct(int x) implements StructSerializable {
|
||||
public static final Serializer struct = new Serializer();
|
||||
|
||||
public static final class Serializer implements Struct<CustomStruct> {
|
||||
@Override
|
||||
public Class<CustomStruct> getTypeClass() {
|
||||
return CustomStruct.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeName() {
|
||||
return "CustomStruct";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return kSizeInt32;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchema() {
|
||||
return "int32 x;";
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomStruct unpack(ByteBuffer bb) {
|
||||
return new CustomStruct(bb.getInt());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pack(ByteBuffer bb, CustomStruct value) {
|
||||
bb.putInt(value.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
package edu.wpi.first.epilogue.logging;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||
|
||||
@@ -53,4 +54,135 @@ class LazyBackendTest {
|
||||
backend.getEntries());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void inPlaceByteArray() {
|
||||
var backend = new TestBackend();
|
||||
var lazy = new LazyBackend(backend);
|
||||
|
||||
byte[] arr = new byte[] {0};
|
||||
lazy.log("arr", arr);
|
||||
|
||||
arr[0] = 1;
|
||||
lazy.log("arr", arr);
|
||||
|
||||
assertEquals(2, backend.getEntries().size());
|
||||
assertArrayEquals(new byte[] {0}, (byte[]) backend.getEntries().get(0).value());
|
||||
assertArrayEquals(new byte[] {1}, (byte[]) backend.getEntries().get(1).value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void inPlaceIntArray() {
|
||||
var backend = new TestBackend();
|
||||
var lazy = new LazyBackend(backend);
|
||||
|
||||
int[] arr = new int[] {0};
|
||||
lazy.log("arr", arr);
|
||||
|
||||
arr[0] = 1;
|
||||
lazy.log("arr", arr);
|
||||
|
||||
assertEquals(2, backend.getEntries().size());
|
||||
assertArrayEquals(new int[] {0}, (int[]) backend.getEntries().get(0).value());
|
||||
assertArrayEquals(new int[] {1}, (int[]) backend.getEntries().get(1).value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void inPlaceLongArray() {
|
||||
var backend = new TestBackend();
|
||||
var lazy = new LazyBackend(backend);
|
||||
|
||||
long[] arr = new long[] {0};
|
||||
lazy.log("arr", arr);
|
||||
|
||||
arr[0] = 1;
|
||||
lazy.log("arr", arr);
|
||||
|
||||
assertEquals(2, backend.getEntries().size());
|
||||
assertArrayEquals(new long[] {0}, (long[]) backend.getEntries().get(0).value());
|
||||
assertArrayEquals(new long[] {1}, (long[]) backend.getEntries().get(1).value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void inPlaceFloatArray() {
|
||||
var backend = new TestBackend();
|
||||
var lazy = new LazyBackend(backend);
|
||||
|
||||
float[] arr = new float[] {0};
|
||||
lazy.log("arr", arr);
|
||||
|
||||
arr[0] = 1;
|
||||
lazy.log("arr", arr);
|
||||
|
||||
assertEquals(2, backend.getEntries().size());
|
||||
assertArrayEquals(new float[] {0}, (float[]) backend.getEntries().get(0).value());
|
||||
assertArrayEquals(new float[] {1}, (float[]) backend.getEntries().get(1).value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void inPlaceDoubleArray() {
|
||||
var backend = new TestBackend();
|
||||
var lazy = new LazyBackend(backend);
|
||||
|
||||
double[] arr = new double[] {0};
|
||||
lazy.log("arr", arr);
|
||||
|
||||
arr[0] = 1;
|
||||
lazy.log("arr", arr);
|
||||
|
||||
assertEquals(2, backend.getEntries().size());
|
||||
assertArrayEquals(new double[] {0}, (double[]) backend.getEntries().get(0).value());
|
||||
assertArrayEquals(new double[] {1}, (double[]) backend.getEntries().get(1).value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void inPlaceBooleanArray() {
|
||||
var backend = new TestBackend();
|
||||
var lazy = new LazyBackend(backend);
|
||||
|
||||
boolean[] arr = new boolean[] {false};
|
||||
lazy.log("arr", arr);
|
||||
|
||||
arr[0] = true;
|
||||
lazy.log("arr", arr);
|
||||
|
||||
assertEquals(2, backend.getEntries().size());
|
||||
assertArrayEquals(new boolean[] {false}, (boolean[]) backend.getEntries().get(0).value());
|
||||
assertArrayEquals(new boolean[] {true}, (boolean[]) backend.getEntries().get(1).value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void inPlaceStringArray() {
|
||||
var backend = new TestBackend();
|
||||
var lazy = new LazyBackend(backend);
|
||||
|
||||
String[] arr = new String[] {"0"};
|
||||
lazy.log("arr", arr);
|
||||
|
||||
arr[0] = "1";
|
||||
lazy.log("arr", arr);
|
||||
|
||||
assertEquals(2, backend.getEntries().size());
|
||||
assertArrayEquals(new String[] {"0"}, (String[]) backend.getEntries().get(0).value());
|
||||
assertArrayEquals(new String[] {"1"}, (String[]) backend.getEntries().get(1).value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void inPlaceStructArray() {
|
||||
var backend = new TestBackend();
|
||||
var lazy = new LazyBackend(backend);
|
||||
|
||||
CustomStruct[] arr = new CustomStruct[] {new CustomStruct(0)};
|
||||
|
||||
lazy.log("arr", arr, CustomStruct.struct);
|
||||
|
||||
arr[0] = new CustomStruct(1);
|
||||
lazy.log("arr", arr, CustomStruct.struct);
|
||||
|
||||
assertEquals(2, backend.getEntries().size());
|
||||
assertArrayEquals(
|
||||
new byte[] {0x00, 0x00, 0x00, 0x00}, (byte[]) backend.getEntries().get(0).value());
|
||||
assertArrayEquals(
|
||||
new byte[] {0x01, 0x00, 0x00, 0x00}, (byte[]) backend.getEntries().get(1).value());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,32 +55,32 @@ public class TestBackend implements EpilogueBackend {
|
||||
|
||||
@Override
|
||||
public void log(String identifier, byte[] value) {
|
||||
m_entries.add(new LogEntry<>(identifier, value));
|
||||
m_entries.add(new LogEntry<>(identifier, value.clone()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String identifier, int[] value) {
|
||||
m_entries.add(new LogEntry<>(identifier, value));
|
||||
m_entries.add(new LogEntry<>(identifier, value.clone()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String identifier, long[] value) {
|
||||
m_entries.add(new LogEntry<>(identifier, value));
|
||||
m_entries.add(new LogEntry<>(identifier, value.clone()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String identifier, float[] value) {
|
||||
m_entries.add(new LogEntry<>(identifier, value));
|
||||
m_entries.add(new LogEntry<>(identifier, value.clone()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String identifier, double[] value) {
|
||||
m_entries.add(new LogEntry<>(identifier, value));
|
||||
m_entries.add(new LogEntry<>(identifier, value.clone()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String identifier, boolean[] value) {
|
||||
m_entries.add(new LogEntry<>(identifier, value));
|
||||
m_entries.add(new LogEntry<>(identifier, value.clone()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,19 +90,27 @@ public class TestBackend implements EpilogueBackend {
|
||||
|
||||
@Override
|
||||
public void log(String identifier, String[] value) {
|
||||
m_entries.add(new LogEntry<>(identifier, value));
|
||||
m_entries.add(new LogEntry<>(identifier, value.clone()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> void log(String identifier, S value, Struct<S> struct) {
|
||||
var serialized = StructBuffer.create(struct).write(value).array();
|
||||
var buffer = StructBuffer.create(struct).write(value).position(0);
|
||||
var serialized = new byte[buffer.capacity()];
|
||||
for (int i = 0; i < buffer.capacity(); i++) {
|
||||
serialized[i] = buffer.get();
|
||||
}
|
||||
|
||||
m_entries.add(new LogEntry<>(identifier, serialized));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> void log(String identifier, S[] value, Struct<S> struct) {
|
||||
var serialized = StructBuffer.create(struct).writeArray(value).array();
|
||||
var buffer = StructBuffer.create(struct).writeArray(value).position(0);
|
||||
var serialized = new byte[buffer.capacity()];
|
||||
for (int i = 0; i < buffer.capacity(); i++) {
|
||||
serialized[i] = buffer.get();
|
||||
}
|
||||
|
||||
m_entries.add(new LogEntry<>(identifier, serialized));
|
||||
}
|
||||
|
||||
31
fieldImages/BUILD.bazel
Normal file
31
fieldImages/BUILD.bazel
Normal file
@@ -0,0 +1,31 @@
|
||||
load("@rules_cc//cc:defs.bzl", "cc_library")
|
||||
load("@rules_java//java:defs.bzl", "java_library")
|
||||
load("//shared/bazel/rules/gen:gen-resources.bzl", "generate_resources")
|
||||
|
||||
generate_resources(
|
||||
name = "generate-resources",
|
||||
namespace = "fields",
|
||||
prefix = "FIELDS",
|
||||
resource_files = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "fieldImages",
|
||||
srcs = [":generate-resources"] + glob(["src/main/native/cpp/**"]),
|
||||
hdrs = glob(["src/main/native/include/**/*"]),
|
||||
strip_include_prefix = "src/main/native/include",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
java_library(
|
||||
name = "fieldImages-java",
|
||||
srcs = glob(["src/main/java/**/*.java"]),
|
||||
resource_strip_prefix = "fieldImages/src/main/native/resources",
|
||||
resources = glob(["src/main/native/resources/**"]),
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_annotations",
|
||||
"@maven//:com_fasterxml_jackson_core_jackson_databind",
|
||||
],
|
||||
)
|
||||
@@ -36,13 +36,13 @@ endif()
|
||||
|
||||
generate_resources(
|
||||
src/main/native/resources/edu/wpi/first/fields
|
||||
generated/main/cpp
|
||||
${CMAKE_CURRENT_BINARY_DIR}/generated/main/cpp
|
||||
FIELDS
|
||||
fields
|
||||
field_images_resources_src
|
||||
)
|
||||
|
||||
add_library(fieldImages src/main/native/cpp/fields.cpp ${field_images_resources_src})
|
||||
add_library(fieldImages ${field_images_resources_src} src/main/native/cpp/fields.cpp)
|
||||
set_target_properties(fieldImages PROPERTIES DEBUG_POSTFIX "d")
|
||||
|
||||
set_property(TARGET fieldImages PROPERTY FOLDER "libraries")
|
||||
|
||||
@@ -16,12 +16,13 @@ public enum Fields {
|
||||
k2021Slalom("2021-slalompath.json"),
|
||||
k2022RapidReact("2022-rapidreact.json"),
|
||||
k2023ChargedUp("2023-chargedup.json"),
|
||||
k2024Crescendo("2024-crescendo.json");
|
||||
k2024Crescendo("2024-crescendo.json"),
|
||||
k2025Reefscape("2025-reefscape.json");
|
||||
|
||||
public static final String kBaseResourceDir = "/edu/wpi/first/fields/";
|
||||
|
||||
/** Alias to the current game. */
|
||||
public static final Fields kDefaultField = k2024Crescendo;
|
||||
public static final Fields kDefaultField = k2025Reefscape;
|
||||
|
||||
public final String m_resourceFile;
|
||||
|
||||
|
||||
@@ -16,10 +16,13 @@
|
||||
#include "fields/2022-rapidreact.h"
|
||||
#include "fields/2023-chargedup.h"
|
||||
#include "fields/2024-crescendo.h"
|
||||
#include "fields/2025-reefscape.h"
|
||||
|
||||
using namespace fields;
|
||||
|
||||
static const Field kFields[] = {
|
||||
{"2025 Reefscape", GetResource_2025_reefscape_json,
|
||||
GetResource_2025_field_png},
|
||||
{"2024 Crescendo", GetResource_2024_crescendo_json,
|
||||
GetResource_2024_field_png},
|
||||
{"2023 Charged Up", GetResource_2023_chargedup_json,
|
||||
|
||||
12
fieldImages/src/main/native/include/fields/2025-reefscape.h
Normal file
12
fieldImages/src/main/native/include/fields/2025-reefscape.h
Normal file
@@ -0,0 +1,12 @@
|
||||
// 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 <string_view>
|
||||
|
||||
namespace fields {
|
||||
std::string_view GetResource_2025_reefscape_json();
|
||||
std::string_view GetResource_2025_field_png();
|
||||
} // namespace fields
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 921 KiB |
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"game": "Reefscape",
|
||||
"field-image": "2025-field.png",
|
||||
"field-corners": {
|
||||
"top-left": [
|
||||
534,
|
||||
291
|
||||
],
|
||||
"bottom-right": [
|
||||
3466,
|
||||
1638
|
||||
]
|
||||
},
|
||||
"field-size": [
|
||||
57.573,
|
||||
26.417
|
||||
],
|
||||
"field-unit": "foot"
|
||||
}
|
||||
@@ -97,7 +97,7 @@ model {
|
||||
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
|
||||
lib project: ':wpigui', library: 'wpigui', linkage: 'static'
|
||||
lib project: ':fieldImages', library: 'fieldImages', linkage: 'shared'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imgui', linkage: 'static'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
|
||||
}
|
||||
appendDebugPathToBinaries(binaries)
|
||||
}
|
||||
@@ -127,7 +127,7 @@ model {
|
||||
lib project: ':wpimath', library: 'wpimath', linkage: 'shared'
|
||||
lib project: ':wpigui', library: 'wpigui', linkage: 'static'
|
||||
lib project: ':fieldImages', library: 'fieldImages', linkage: 'shared'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imgui', linkage: 'static'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
|
||||
}
|
||||
appendDebugPathToBinaries(binaries)
|
||||
}
|
||||
@@ -167,7 +167,7 @@ model {
|
||||
lib project: ':wpigui', library: 'wpigui', linkage: 'static'
|
||||
lib project: ':fieldImages', library: 'fieldImages', linkage: 'static'
|
||||
nativeUtils.useRequiredLibrary(it, 'opencv_static')
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imgui', linkage: 'static'
|
||||
lib project: ':thirdparty:imgui_suite', library: 'imguiSuite', linkage: 'static'
|
||||
if (it.targetPlatform.operatingSystem.isWindows()) {
|
||||
it.linker.args << 'Gdi32.lib' << 'Shell32.lib' << 'd3d11.lib' << 'd3dcompiler.lib'
|
||||
it.linker.args << '/DELAYLOAD:MF.dll' << '/DELAYLOAD:MFReadWrite.dll' << '/DELAYLOAD:MFPlat.dll' << '/delay:nobind'
|
||||
|
||||
@@ -57,12 +57,22 @@ void Window::Display() {
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, m_padding);
|
||||
}
|
||||
|
||||
std::string label;
|
||||
std::string* name = &m_name;
|
||||
if (m_name.empty()) {
|
||||
label = fmt::format("{}###{}", m_defaultName, m_id);
|
||||
} else {
|
||||
label = fmt::format("{}###{}", m_name, m_id);
|
||||
name = &m_defaultName;
|
||||
}
|
||||
std::string label = fmt::format("{}###{}", *name, m_id);
|
||||
|
||||
// Accounts for size of title, collapse button, and close button
|
||||
float minWidth =
|
||||
ImGui::CalcTextSize(name->c_str()).x + ImGui::GetFontSize() * 2 +
|
||||
ImGui::GetStyle().ItemInnerSpacing.x * 3 +
|
||||
ImGui::GetStyle().FramePadding.x * 2 + ImGui::GetStyle().WindowBorderSize;
|
||||
// Accounts for size of hamburger button
|
||||
if (m_renamePopupEnabled || m_view->HasSettings()) {
|
||||
minWidth += ImGui::GetFontSize() + ImGui::GetStyle().FramePadding.x;
|
||||
}
|
||||
ImGui::SetNextWindowSizeConstraints({minWidth, 0}, ImVec2{FLT_MAX, FLT_MAX});
|
||||
|
||||
if (Begin(label.c_str(), &m_visible, m_flags)) {
|
||||
if (m_renamePopupEnabled || m_view->HasSettings()) {
|
||||
|
||||
@@ -33,7 +33,7 @@ void glass::DisplayLEDDisplay(LEDDisplayModel* model, int index) {
|
||||
int& order = storage.GetInt("order", LEDConfig::RowMajor);
|
||||
int& start = storage.GetInt("start", LEDConfig::UpperLeft);
|
||||
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 6);
|
||||
ImGui::PushItemWidth(ImGui::GetFontSize() * 7);
|
||||
ImGui::LabelText("Length", "%d", length);
|
||||
ImGui::LabelText("Running", "%s", running ? "Yes" : "No");
|
||||
ImGui::InputInt("Columns", &numColumns);
|
||||
|
||||
@@ -224,8 +224,8 @@ class ObjectInfo {
|
||||
|
||||
class FieldInfo {
|
||||
public:
|
||||
static constexpr auto kDefaultWidth = 16.541052_m;
|
||||
static constexpr auto kDefaultHeight = 8.211_m;
|
||||
static constexpr auto kDefaultWidth = 17.5483_m;
|
||||
static constexpr auto kDefaultHeight = 8.0519_m;
|
||||
|
||||
explicit FieldInfo(Storage& storage);
|
||||
|
||||
@@ -345,7 +345,7 @@ static bool InputPose(frc::Pose2d* pose) {
|
||||
}
|
||||
|
||||
FieldInfo::FieldInfo(Storage& storage)
|
||||
: m_builtin{storage.GetString("builtin", "2024 Crescendo")},
|
||||
: m_builtin{storage.GetString("builtin", "2025 Reefscape")},
|
||||
m_filename{storage.GetString("image")},
|
||||
m_width{storage.GetFloat("width", kDefaultWidth.to<float>())},
|
||||
m_height{storage.GetFloat("height", kDefaultHeight.to<float>())},
|
||||
@@ -373,13 +373,12 @@ void FieldInfo::DisplaySettings() {
|
||||
}
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
if (m_builtin.empty() && ImGui::Button("Load image...")) {
|
||||
if (m_builtin.empty() && ImGui::Button("Load JSON/image...")) {
|
||||
m_fileOpener = std::make_unique<pfd::open_file>(
|
||||
"Choose field image", "",
|
||||
std::vector<std::string>{"Image File",
|
||||
"Choose field JSON/image", "",
|
||||
std::vector<std::string>{"PathWeaver JSON File", "*.json", "Image File",
|
||||
"*.jpg *.jpeg *.png *.bmp *.psd *.tga *.gif "
|
||||
"*.hdr *.pic *.ppm *.pgm",
|
||||
"PathWeaver JSON File", "*.json"});
|
||||
"*.hdr *.pic *.ppm *.pgm"});
|
||||
}
|
||||
if (ImGui::Button("Reset image")) {
|
||||
Reset();
|
||||
@@ -586,17 +585,29 @@ FieldFrameData FieldInfo::GetFrameData(ImVec2 min, ImVec2 max) const {
|
||||
max.x -= (m_imageWidth - m_right) * scale;
|
||||
max.y -= (m_imageHeight - m_bottom) * scale;
|
||||
} else if ((max.x - min.x) > 40 && (max.y - min.y > 40)) {
|
||||
// scale padding to be proportional to aspect ratio
|
||||
float width = max.x - min.x;
|
||||
float height = max.y - min.y;
|
||||
float padX, padY;
|
||||
if (width > height) {
|
||||
padX = 20 * width / height;
|
||||
padY = 20;
|
||||
} else {
|
||||
padX = 20;
|
||||
padY = 20 * height / width;
|
||||
}
|
||||
|
||||
// ensure there's some padding
|
||||
min.x += 20;
|
||||
max.x -= 20;
|
||||
min.y += 20;
|
||||
max.y -= 20;
|
||||
min.x += padX;
|
||||
max.x -= padX;
|
||||
min.y += padY;
|
||||
max.y -= padY;
|
||||
|
||||
// also pad the image so it's the same size as the box
|
||||
ffd.imageMin.x += 20;
|
||||
ffd.imageMax.x -= 20;
|
||||
ffd.imageMin.y += 20;
|
||||
ffd.imageMax.y -= 20;
|
||||
ffd.imageMin.x += padX;
|
||||
ffd.imageMax.x -= padX;
|
||||
ffd.imageMin.y += padY;
|
||||
ffd.imageMax.y -= padY;
|
||||
}
|
||||
|
||||
ffd.min = min;
|
||||
|
||||
@@ -15,6 +15,8 @@ kFramework_ROS = 5
|
||||
kFramework_RobotBuilder = 6
|
||||
kFramework_AdvantageKit = 7
|
||||
kFramework_MagicBot = 8
|
||||
kFramework_KitBotTraditional = 9
|
||||
kFramework_KitBotInline = 10
|
||||
kRobotDrive_ArcadeStandard = 1
|
||||
kRobotDrive_ArcadeButtonSpin = 2
|
||||
kRobotDrive_ArcadeRatioCurve = 3
|
||||
|
||||
@@ -122,5 +122,6 @@ kResourceType_ChoreoTrigger = 120
|
||||
kResourceType_PathWeaverTrajectory = 121
|
||||
kResourceType_Koors40 = 122
|
||||
kResourceType_ThriftyNova = 123
|
||||
kResourceType_PWFSEN36005 = 124
|
||||
kResourceType_LaserShark = 125
|
||||
kResourceType_RevServoHub = 124
|
||||
kResourceType_PWFSEN36005 = 125
|
||||
kResourceType_LaserShark = 126
|
||||
|
||||
@@ -267,10 +267,12 @@ public final class FRCNetComm {
|
||||
public static final int kResourceType_Koors40 = 122;
|
||||
/** kResourceType_ThriftyNova = 123. */
|
||||
public static final int kResourceType_ThriftyNova = 123;
|
||||
/** kResourceType_PWFSEN36005 = 124. */
|
||||
public static final int kResourceType_PWFSEN36005 = 124;
|
||||
/** kResourceType_LaserShark = 125. */
|
||||
public static final int kResourceType_LaserShark = 125;
|
||||
/** kResourceType_RevServoHub = 124. */
|
||||
public static final int kResourceType_RevServoHub = 124;
|
||||
/** kResourceType_PWFSEN36005 = 125. */
|
||||
public static final int kResourceType_PWFSEN36005 = 125;
|
||||
/** kResourceType_LaserShark = 126. */
|
||||
public static final int kResourceType_LaserShark = 126;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,6 +317,10 @@ public final class FRCNetComm {
|
||||
public static final int kFramework_AdvantageKit = 7;
|
||||
/** kFramework_MagicBot = 8. */
|
||||
public static final int kFramework_MagicBot = 8;
|
||||
/** kFramework_KitBotTraditional = 9. */
|
||||
public static final int kFramework_KitBotTraditional = 9;
|
||||
/** kFramework_KitBotInline = 10. */
|
||||
public static final int kFramework_KitBotInline = 10;
|
||||
/** kRobotDrive_ArcadeStandard = 1. */
|
||||
public static final int kRobotDrive_ArcadeStandard = 1;
|
||||
/** kRobotDrive_ArcadeButtonSpin = 2. */
|
||||
|
||||
@@ -175,8 +175,9 @@ namespace HALUsageReporting {
|
||||
kResourceType_PathWeaverTrajectory = 121,
|
||||
kResourceType_Koors40 = 122,
|
||||
kResourceType_ThriftyNova = 123,
|
||||
kResourceType_PWFSEN36005 = 124,
|
||||
kResourceType_LaserShark = 125,
|
||||
kResourceType_RevServoHub = 124,
|
||||
kResourceType_PWFSEN36005 = 125,
|
||||
kResourceType_LaserShark = 126,
|
||||
};
|
||||
enum tInstances : int32_t {
|
||||
kLanguage_LabVIEW = 1,
|
||||
@@ -196,6 +197,8 @@ namespace HALUsageReporting {
|
||||
kFramework_RobotBuilder = 6,
|
||||
kFramework_AdvantageKit = 7,
|
||||
kFramework_MagicBot = 8,
|
||||
kFramework_KitBotTraditional = 9,
|
||||
kFramework_KitBotInline = 10,
|
||||
kRobotDrive_ArcadeStandard = 1,
|
||||
kRobotDrive_ArcadeButtonSpin = 2,
|
||||
kRobotDrive_ArcadeRatioCurve = 3,
|
||||
|
||||
@@ -144,8 +144,9 @@ typedef enum
|
||||
kResourceType_PathWeaverTrajectory = 121,
|
||||
kResourceType_Koors40 = 122,
|
||||
kResourceType_ThriftyNova = 123,
|
||||
kResourceType_PWFSEN36005 = 124,
|
||||
kResourceType_LaserShark = 125,
|
||||
kResourceType_RevServoHub = 124,
|
||||
kResourceType_PWFSEN36005 = 125,
|
||||
kResourceType_LaserShark = 126,
|
||||
|
||||
// kResourceType_MaximumID = 255,
|
||||
} tResourceType;
|
||||
@@ -169,6 +170,8 @@ typedef enum
|
||||
kFramework_RobotBuilder = 6,
|
||||
kFramework_AdvantageKit = 7,
|
||||
kFramework_MagicBot = 8,
|
||||
kFramework_KitBotTraditional = 9,
|
||||
kFramework_KitBotInline = 10,
|
||||
kRobotDrive_ArcadeStandard = 1,
|
||||
kRobotDrive_ArcadeButtonSpin = 2,
|
||||
kRobotDrive_ArcadeRatioCurve = 3,
|
||||
|
||||
@@ -10,6 +10,13 @@ package edu.wpi.first.hal;
|
||||
* @see "hal/AddressableLED.h"
|
||||
*/
|
||||
public class AddressableLEDJNI extends JNIWrapper {
|
||||
public static final int COLOR_ORDER_RGB = 0;
|
||||
public static final int COLOR_ORDER_RBG = 1;
|
||||
public static final int COLOR_ORDER_BGR = 2;
|
||||
public static final int COLOR_ORDER_BRG = 3;
|
||||
public static final int COLOR_ORDER_GBR = 4;
|
||||
public static final int COLOR_ORDER_GRB = 5;
|
||||
|
||||
/**
|
||||
* Initialize Addressable LED using a PWM Digital handle.
|
||||
*
|
||||
@@ -27,6 +34,16 @@ public class AddressableLEDJNI extends JNIWrapper {
|
||||
*/
|
||||
public static native void free(int handle);
|
||||
|
||||
/**
|
||||
* Sets the color order for the addressable LED output. The default order is GRB.
|
||||
*
|
||||
* <p>This will take effect on the next call to {@link #setData(int, byte[])}.
|
||||
*
|
||||
* @param handle the Addressable LED handle
|
||||
* @param colorOrder the color order
|
||||
*/
|
||||
public static native void setColorOrder(int handle, int colorOrder);
|
||||
|
||||
/**
|
||||
* Sets the length of the LED strip.
|
||||
*
|
||||
@@ -53,7 +70,8 @@ public class AddressableLEDJNI extends JNIWrapper {
|
||||
/**
|
||||
* Sets the bit timing.
|
||||
*
|
||||
* <p>By default, the driver is set up to drive WS2812Bs, so nothing needs to be set for those.
|
||||
* <p>By default, the driver is set up to drive WS2812B and WS2815, so nothing needs to be set for
|
||||
* those.
|
||||
*
|
||||
* @param handle the Addressable LED handle
|
||||
* @param highTime0NanoSeconds high time for 0 bit (default 400ns)
|
||||
@@ -72,7 +90,7 @@ public class AddressableLEDJNI extends JNIWrapper {
|
||||
/**
|
||||
* Sets the sync time.
|
||||
*
|
||||
* <p>The sync time is the time to hold output so LEDs enable. Default set for WS2812B.
|
||||
* <p>The sync time is the time to hold output so LEDs enable. Default set for WS2812B and WS2815.
|
||||
*
|
||||
* @param handle the Addressable LED handle
|
||||
* @param syncTimeMicroSeconds the sync time (default 280us)
|
||||
|
||||
@@ -47,6 +47,8 @@ public final class CANAPITypes {
|
||||
kMiscellaneous(10),
|
||||
/** IO breakout. */
|
||||
kIOBreakout(11),
|
||||
/** Servo Controller. */
|
||||
kServoController(12),
|
||||
/** Firmware update. */
|
||||
kFirmwareUpdate(31);
|
||||
|
||||
|
||||
@@ -61,12 +61,12 @@ public class SPIJNI extends JNIWrapper {
|
||||
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
|
||||
* @param dataToSend Buffer of data to send as part of the transaction.
|
||||
* @param dataReceived Buffer to read data into.
|
||||
* @param size Number of bytes to transfer. [0..7]
|
||||
* @param size Number of bytes to transfer.
|
||||
* @return Number of bytes transferred, -1 for error
|
||||
* @see "HAL_TransactionSPI"
|
||||
*/
|
||||
public static native int spiTransaction(
|
||||
int port, ByteBuffer dataToSend, ByteBuffer dataReceived, byte size);
|
||||
int port, ByteBuffer dataToSend, ByteBuffer dataReceived, int size);
|
||||
|
||||
/**
|
||||
* Performs an SPI send/receive transaction.
|
||||
@@ -77,12 +77,12 @@ public class SPIJNI extends JNIWrapper {
|
||||
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
|
||||
* @param dataToSend Buffer of data to send as part of the transaction.
|
||||
* @param dataReceived Buffer to read data into.
|
||||
* @param size Number of bytes to transfer. [0..7]
|
||||
* @param size Number of bytes to transfer.
|
||||
* @return Number of bytes transferred, -1 for error
|
||||
* @see "HAL_TransactionSPI"
|
||||
*/
|
||||
public static native int spiTransactionB(
|
||||
int port, byte[] dataToSend, byte[] dataReceived, byte size);
|
||||
int port, byte[] dataToSend, byte[] dataReceived, int size);
|
||||
|
||||
/**
|
||||
* Executes a write transaction with the device.
|
||||
@@ -95,7 +95,7 @@ public class SPIJNI extends JNIWrapper {
|
||||
* @return The number of bytes written. -1 for an error
|
||||
* @see "HAL_WriteSPI"
|
||||
*/
|
||||
public static native int spiWrite(int port, ByteBuffer dataToSend, byte sendSize);
|
||||
public static native int spiWrite(int port, ByteBuffer dataToSend, int sendSize);
|
||||
|
||||
/**
|
||||
* Executes a write transaction with the device.
|
||||
@@ -108,7 +108,7 @@ public class SPIJNI extends JNIWrapper {
|
||||
* @return The number of bytes written. -1 for an error
|
||||
* @see "HAL_WriteSPI"
|
||||
*/
|
||||
public static native int spiWriteB(int port, byte[] dataToSend, byte sendSize);
|
||||
public static native int spiWriteB(int port, byte[] dataToSend, int sendSize);
|
||||
|
||||
/**
|
||||
* Executes a read from the device.
|
||||
@@ -121,11 +121,11 @@ public class SPIJNI extends JNIWrapper {
|
||||
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
|
||||
* @param initiate initiates a transaction when true. Just reads when false.
|
||||
* @param dataReceived A pointer to the array of bytes to store the data read from the device.
|
||||
* @param size The number of bytes to read in the transaction. [1..7]
|
||||
* @param size The number of bytes to read in the transaction.
|
||||
* @return Number of bytes read. -1 for error.
|
||||
* @see "HAL_ReadSPI"
|
||||
*/
|
||||
public static native int spiRead(int port, boolean initiate, ByteBuffer dataReceived, byte size);
|
||||
public static native int spiRead(int port, boolean initiate, ByteBuffer dataReceived, int size);
|
||||
|
||||
/**
|
||||
* Executes a read from the device.
|
||||
@@ -138,11 +138,11 @@ public class SPIJNI extends JNIWrapper {
|
||||
* @param port The number of the port to use. 0-3 for Onboard CS0-CS2, 4 for MXP
|
||||
* @param initiate initiates a transaction when true. Just reads when false.
|
||||
* @param dataReceived A pointer to the array of bytes to store the data read from the device.
|
||||
* @param size The number of bytes to read in the transaction. [1..7]
|
||||
* @param size The number of bytes to read in the transaction.
|
||||
* @return Number of bytes read. -1 for error.
|
||||
* @see "HAL_ReadSPI"
|
||||
*/
|
||||
public static native int spiReadB(int port, boolean initiate, byte[] dataReceived, byte size);
|
||||
public static native int spiReadB(int port, boolean initiate, byte[] dataReceived, int size);
|
||||
|
||||
/**
|
||||
* Closes the SPI port.
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include "AddressableLEDSimd.h"
|
||||
#include "ConstantsInternal.h"
|
||||
#include "DigitalInternal.h"
|
||||
#include "FPGACalls.h"
|
||||
@@ -21,6 +22,7 @@
|
||||
#include "hal/handles/LimitedHandleResource.h"
|
||||
|
||||
using namespace hal;
|
||||
using namespace hal::detail;
|
||||
|
||||
namespace {
|
||||
struct AddressableLED {
|
||||
@@ -28,6 +30,7 @@ struct AddressableLED {
|
||||
void* ledBuffer;
|
||||
size_t ledBufferSize;
|
||||
int32_t stringLength = 1;
|
||||
HAL_AddressableLEDColorOrder colorOrder = HAL_ALED_GRB;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
@@ -47,6 +50,37 @@ void InitializeAddressableLED() {
|
||||
|
||||
static constexpr const char* HmbName = "HMB_0_LED";
|
||||
|
||||
static void ConvertAndCopyLEDData(void* dst,
|
||||
const struct HAL_AddressableLEDData* src,
|
||||
int32_t len,
|
||||
HAL_AddressableLEDColorOrder order) {
|
||||
switch (order) {
|
||||
case HAL_ALED_GRB:
|
||||
std::memcpy(dst, src, len * sizeof(HAL_AddressableLEDData));
|
||||
break;
|
||||
case HAL_ALED_RGB:
|
||||
ConvertPixels<HAL_ALED_RGB>(reinterpret_cast<const uint8_t*>(src),
|
||||
reinterpret_cast<uint8_t*>(dst), len);
|
||||
break;
|
||||
case HAL_ALED_RBG:
|
||||
ConvertPixels<HAL_ALED_RBG>(reinterpret_cast<const uint8_t*>(src),
|
||||
reinterpret_cast<uint8_t*>(dst), len);
|
||||
break;
|
||||
case HAL_ALED_BGR:
|
||||
ConvertPixels<HAL_ALED_BGR>(reinterpret_cast<const uint8_t*>(src),
|
||||
reinterpret_cast<uint8_t*>(dst), len);
|
||||
break;
|
||||
case HAL_ALED_BRG:
|
||||
ConvertPixels<HAL_ALED_BRG>(reinterpret_cast<const uint8_t*>(src),
|
||||
reinterpret_cast<uint8_t*>(dst), len);
|
||||
break;
|
||||
case HAL_ALED_GBR:
|
||||
ConvertPixels<HAL_ALED_GBR>(reinterpret_cast<const uint8_t*>(src),
|
||||
reinterpret_cast<uint8_t*>(dst), len);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
||||
HAL_AddressableLEDHandle HAL_InitializeAddressableLED(
|
||||
@@ -125,6 +159,19 @@ void HAL_FreeAddressableLED(HAL_AddressableLEDHandle handle) {
|
||||
addressableLEDHandles->Free(handle);
|
||||
}
|
||||
|
||||
void HAL_SetAddressableLEDColorOrder(HAL_AddressableLEDHandle handle,
|
||||
HAL_AddressableLEDColorOrder colorOrder,
|
||||
int32_t* status) {
|
||||
auto led = addressableLEDHandles->Get(handle);
|
||||
|
||||
if (!led) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
led->colorOrder = colorOrder;
|
||||
}
|
||||
|
||||
void HAL_SetAddressableLEDOutputPort(HAL_AddressableLEDHandle handle,
|
||||
HAL_DigitalHandle outputPort,
|
||||
int32_t* status) {
|
||||
@@ -203,7 +250,7 @@ void HAL_WriteAddressableLEDData(HAL_AddressableLEDHandle handle,
|
||||
return;
|
||||
}
|
||||
|
||||
std::memcpy(led->ledBuffer, data, length * sizeof(HAL_AddressableLEDData));
|
||||
ConvertAndCopyLEDData(led->ledBuffer, data, length, led->colorOrder);
|
||||
|
||||
asm("dmb");
|
||||
|
||||
|
||||
273
hal/src/main/native/athena/AddressableLEDSimd.h
Normal file
273
hal/src/main/native/athena/AddressableLEDSimd.h
Normal file
@@ -0,0 +1,273 @@
|
||||
// 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 <utility>
|
||||
|
||||
#include "hal/AddressableLEDTypes.h"
|
||||
#include "simd/simd.h"
|
||||
|
||||
// Timing info
|
||||
// https://developer.arm.com/documentation/ddi0409/i/instruction-timing/instruction-specific-scheduling/advanced-simd-load-store-instructions?lang=en
|
||||
|
||||
namespace hal::detail {
|
||||
|
||||
using namespace Simd::Neon;
|
||||
|
||||
template <typename T>
|
||||
using ConvertFunc = void (*)(T);
|
||||
|
||||
/*
|
||||
* Conversion funtions perform in-place conversion by swapping elements.
|
||||
* The names of the functions indicate the wire output (default GRB),
|
||||
* but the FPGA takes sequences of BGR_.
|
||||
*/
|
||||
|
||||
template <typename T>
|
||||
void ToRGB(T val) {
|
||||
std::swap(val[1], val[2]); // swap G and R
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ToRBG(T val) {
|
||||
std::swap(val[1], val[2]); // swap G and R
|
||||
std::swap(val[0], val[2]); // swap B and G
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ToBGR(T val) {
|
||||
std::swap(val[0], val[1]); // swap B and G
|
||||
std::swap(val[0], val[2]); // swap G and R
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ToBRG(T val) {
|
||||
std::swap(val[0], val[1]); // swap B and G
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void ToGBR(T val) {
|
||||
std::swap(val[0], val[2]); // swap B and R
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies 16 pixels from src to dst using NEON instructions, converting using
|
||||
* the provided conversion function. Optimizes based on alignment of input and
|
||||
* output arrays specified by srcAlign and dstAlign
|
||||
* @tparam srcAlign whether src is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @tparam dstAlign whether dst is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @tparam the conversion function
|
||||
* @param[in] src The source array
|
||||
* @param[out] dst the destination array
|
||||
* @pre src and dst must contain at least 64 bytes (16 pixels)
|
||||
* @pre if srcAlign is true, src must be 16 byte aligned
|
||||
* @pre if dstAlign is true, src muts be 16 byte aligned
|
||||
*/
|
||||
template <bool srcAlign, bool dstAlign, ConvertFunc<uint8x16_t*> Convert>
|
||||
void ConvertNEON_16(const uint8_t* src, uint8_t* dst) {
|
||||
uint8x16x4_t pixels = Load4<srcAlign>(src);
|
||||
Convert(pixels.val);
|
||||
Store4<dstAlign>(dst, pixels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies 8 pixels from src to dst using NEON instructions, converting using
|
||||
* the provided conversion function. Optimizes based on alignment of input and
|
||||
* output arrays specified by srcAlign and dstAlign
|
||||
* @tparam srcAlign whether src is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @tparam dstAlign whether dst is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @tparam the conversion function
|
||||
* @param[in] src The source array
|
||||
* @param[out] dst the destination array
|
||||
* @pre src and dst must contain at least 32 bytes (8 pixels)
|
||||
* @pre if srcAlign is true, src must be 16 byte aligned
|
||||
* @pre if dstAlign is true, src muts be 16 byte aligned
|
||||
*/
|
||||
template <bool srcAlign, bool dstAlign, ConvertFunc<uint8x8_t*> Convert>
|
||||
void ConvertNEON_8(const uint8_t* src, uint8_t* dst) {
|
||||
uint8x8x4_t pixels = LoadHalf4<srcAlign>(src);
|
||||
Convert(pixels.val);
|
||||
Store4<dstAlign>(dst, pixels);
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies 16 pixels from src to dst, converting from GRB (wire order) to order.
|
||||
* Optimizes based on alignment of input and output arrays specified by srcAlign
|
||||
* and dstAlign
|
||||
* @tparam order the color order to convert to
|
||||
* @tparam srcAlign whether src is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @tparam dstAlign whether dst is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @param[in] src The source array
|
||||
* @param[out] dst the destination array
|
||||
* @pre src and dst must contain at least 64 bytes (16 pixels)
|
||||
* @pre if srcAlign is true, src must be 16 byte aligned
|
||||
* @pre if dstAlign is true, src muts be 16 byte aligned
|
||||
*/
|
||||
template <HAL_AddressableLEDColorOrder order, bool srcAlign, bool dstAlign>
|
||||
void Convert16Pixels(const uint8_t* src, uint8_t* dst) {
|
||||
switch (order) {
|
||||
case HAL_ALED_RGB:
|
||||
ConvertNEON_16<srcAlign, dstAlign, ToRGB>(src, dst);
|
||||
break;
|
||||
case HAL_ALED_RBG:
|
||||
ConvertNEON_16<srcAlign, dstAlign, ToRBG>(src, dst);
|
||||
break;
|
||||
case HAL_ALED_BGR:
|
||||
ConvertNEON_16<srcAlign, dstAlign, ToBGR>(src, dst);
|
||||
break;
|
||||
case HAL_ALED_BRG:
|
||||
ConvertNEON_16<srcAlign, dstAlign, ToBRG>(src, dst);
|
||||
break;
|
||||
case HAL_ALED_GBR:
|
||||
ConvertNEON_16<srcAlign, dstAlign, ToGBR>(src, dst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies 8 pixels from src to dst, converting from GRB (wire order) to order.
|
||||
* Optimizes based on alignment of input and output arrays specified by srcAlign
|
||||
* and dstAlign
|
||||
* @tparam order the color order to convert to
|
||||
* @tparam srcAlign whether src is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @tparam dstAlign whether dst is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @param[in] src The source array
|
||||
* @param[out] dst the destination array
|
||||
* @pre src and dst must contain at least 32 bytes (8 pixels)
|
||||
* @pre if srcAlign is true, src must be 16 byte aligned
|
||||
* @pre if dstAlign is true, src muts be 16 byte aligned
|
||||
*/
|
||||
template <HAL_AddressableLEDColorOrder order, bool srcAlign, bool dstAlign>
|
||||
void Convert8Pixels(const uint8_t* src, uint8_t* dst) {
|
||||
switch (order) {
|
||||
case HAL_ALED_RGB:
|
||||
ConvertNEON_8<srcAlign, dstAlign, ToRGB>(src, dst);
|
||||
break;
|
||||
case HAL_ALED_RBG:
|
||||
ConvertNEON_8<srcAlign, dstAlign, ToRBG>(src, dst);
|
||||
break;
|
||||
case HAL_ALED_BGR:
|
||||
ConvertNEON_8<srcAlign, dstAlign, ToBGR>(src, dst);
|
||||
break;
|
||||
case HAL_ALED_BRG:
|
||||
ConvertNEON_8<srcAlign, dstAlign, ToBRG>(src, dst);
|
||||
break;
|
||||
case HAL_ALED_GBR:
|
||||
ConvertNEON_8<srcAlign, dstAlign, ToGBR>(src, dst);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies 1 pixel from src to dst, converting from RGB to the specified order.
|
||||
* @param[in] order the color order to convert to
|
||||
* @param[in] in the source array
|
||||
* @param[out] the destination array
|
||||
* @pre in and out must contain at least 1 pixel (4 bytes).
|
||||
*/
|
||||
void Convert1Pixel(HAL_AddressableLEDColorOrder order, const uint8_t* src,
|
||||
uint8_t* dst) {
|
||||
uint8_t tmp[4];
|
||||
std::memcpy(tmp, src, 4); // Load 4 bytes
|
||||
// convert based on order
|
||||
switch (order) {
|
||||
case HAL_ALED_RGB:
|
||||
ToRGB(tmp);
|
||||
break;
|
||||
case HAL_ALED_RBG:
|
||||
ToRBG(tmp);
|
||||
break;
|
||||
case HAL_ALED_BGR:
|
||||
ToBGR(tmp);
|
||||
break;
|
||||
case HAL_ALED_BRG:
|
||||
ToBRG(tmp);
|
||||
break;
|
||||
case HAL_ALED_GBR:
|
||||
ToGBR(tmp);
|
||||
break;
|
||||
case HAL_ALED_GRB:
|
||||
break; // this shouldn't ever get hit but compiler
|
||||
// wants this to be exhaustive
|
||||
}
|
||||
std::memcpy(dst, tmp, 4); // Store 4 bytes
|
||||
}
|
||||
/**
|
||||
* Copies len pixels from src to dst, converting from GRB (wire order) to order.
|
||||
* Optimizes based on alignment of input and output arrays specified by srcAlign
|
||||
* and dstAlign
|
||||
* @tparam order the color order to convert to
|
||||
* @tparam srcAlign whether src is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @tparam dstAlign whether dst is aligned to the size of a NEON register (16
|
||||
* bytes)
|
||||
* @param[in] src The source array
|
||||
* @param[out] dst the destination array
|
||||
* @param[in] len the size (in pixels, len = (size in bytes) / 4)
|
||||
* @pre src and dst must have at least len*4 capacity in bytes
|
||||
* @pre if srcAlign is true, src must be 16 byte aligned
|
||||
* @pre if dstAlign is true, src muts be 16 byte aligned
|
||||
*/
|
||||
template <HAL_AddressableLEDColorOrder order, bool srcAlign, bool dstAlign>
|
||||
void ConvertPixels(const uint8_t* src, uint8_t* dst, size_t len) {
|
||||
if (len >= 16) {
|
||||
constexpr size_t A4 =
|
||||
A * 4; // Stride of 1 16-pixel conversion operation. (4 NEON registers)
|
||||
size_t size = len * 4;
|
||||
size_t aligned = Simd::AlignLo(
|
||||
size, A4); // number of bytes we can copy with whole 16-pixel strides
|
||||
for (size_t i = 0; i < aligned; i += A4) {
|
||||
Convert16Pixels<order, srcAlign, dstAlign>(src + i, dst + i);
|
||||
}
|
||||
if (aligned < size) {
|
||||
Convert16Pixels<order, false, false>(
|
||||
src + size - A4,
|
||||
dst + size - A4); // copy last 16 pixels, possibly recopying.
|
||||
}
|
||||
} else if (len >= 8) {
|
||||
// If len between 8 and 16, we can do 1 or 2 8-pixel copies
|
||||
Convert8Pixels<order, srcAlign, dstAlign>(src, dst);
|
||||
if (len > 8) {
|
||||
size_t recopyOffset = (len * 4) - (HA * 4);
|
||||
Convert8Pixels<order, false, false>(
|
||||
src + recopyOffset,
|
||||
dst + recopyOffset); // copy last 8 pixels, possibly recopying
|
||||
}
|
||||
} else {
|
||||
// Just copy pixel-by-pixel for <8
|
||||
for (size_t i = 0; i < len; i += 4) {
|
||||
Convert1Pixel(order, src + i, dst + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies pixelCount pixels from src to dst, converting from RGB to the
|
||||
* specified order
|
||||
* @tparam order the color order to convert to
|
||||
* @param src the source array
|
||||
* @param dst the destination array
|
||||
* @param pixelCount the number of pixels to convert and copy
|
||||
*/
|
||||
template <HAL_AddressableLEDColorOrder order>
|
||||
void ConvertPixels(const uint8_t* src, uint8_t* dst, size_t pixelCount) {
|
||||
if (Aligned(src) && Aligned(dst)) {
|
||||
ConvertPixels<order, true, true>(src, dst, pixelCount);
|
||||
} else if (Aligned(src)) {
|
||||
ConvertPixels<order, true, false>(src, dst, pixelCount);
|
||||
} else if (Aligned(dst)) {
|
||||
ConvertPixels<order, false, true>(src, dst, pixelCount);
|
||||
} else {
|
||||
ConvertPixels<order, false, false>(src, dst, pixelCount);
|
||||
}
|
||||
}
|
||||
} // namespace hal::detail
|
||||
174
hal/src/main/native/athena/simd/simd.h
Normal file
174
hal/src/main/native/athena/simd/simd.h
Normal file
@@ -0,0 +1,174 @@
|
||||
// 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.
|
||||
|
||||
// This file contains modified snippets from the Simd Library by Ihar Yermalayeu
|
||||
// (http://ermig1979.github.io/Simd). The original source file names are listed
|
||||
// above each section.
|
||||
/*
|
||||
* Simd Library (http://ermig1979.github.io/Simd).
|
||||
*
|
||||
* Copyright (c) 2011-2024 Yermalayeu Ihar.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <arm_neon.h>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
|
||||
// SimdLib.h
|
||||
#define SIMD_INLINE inline __attribute__((always_inline))
|
||||
|
||||
// SimdMemory.h
|
||||
namespace Simd {
|
||||
SIMD_INLINE size_t AlignLo(size_t size, size_t align) {
|
||||
return size & ~(align - 1);
|
||||
}
|
||||
|
||||
SIMD_INLINE void* AlignLo(const void* ptr, size_t align) {
|
||||
return reinterpret_cast<void*>(reinterpret_cast<size_t>(ptr) & ~(align - 1));
|
||||
}
|
||||
|
||||
SIMD_INLINE bool Aligned(size_t size, size_t align) {
|
||||
return size == AlignLo(size, align);
|
||||
}
|
||||
|
||||
SIMD_INLINE bool Aligned(const void* ptr, size_t align) {
|
||||
return ptr == AlignLo(ptr, align);
|
||||
}
|
||||
} // namespace Simd
|
||||
namespace Simd::Neon {
|
||||
SIMD_INLINE bool Aligned(size_t size, size_t align = sizeof(uint8x16_t)) {
|
||||
return Simd::Aligned(size, align);
|
||||
}
|
||||
|
||||
SIMD_INLINE bool Aligned(const void* ptr, size_t align = sizeof(uint8x16_t)) {
|
||||
return Simd::Aligned(ptr, align);
|
||||
}
|
||||
} // namespace Simd::Neon
|
||||
|
||||
// SimdConst.h
|
||||
namespace Simd::Neon {
|
||||
const size_t A = sizeof(uint8x16_t);
|
||||
const size_t DA = 2 * A;
|
||||
const size_t QA = 4 * A;
|
||||
const size_t OA = 8 * A;
|
||||
const size_t HA = A / 2;
|
||||
} // namespace Simd::Neon
|
||||
|
||||
// SimdLoad.h
|
||||
namespace Simd::Neon {
|
||||
template <bool align>
|
||||
SIMD_INLINE uint8x8x4_t LoadHalf4(const uint8_t* p);
|
||||
|
||||
template <>
|
||||
SIMD_INLINE uint8x8x4_t LoadHalf4<false>(const uint8_t* p) {
|
||||
#if defined(__GNUC__) && SIMD_NEON_PREFECH_SIZE
|
||||
__builtin_prefetch(p + SIMD_NEON_PREFECH_SIZE);
|
||||
#endif
|
||||
return vld4_u8(p);
|
||||
}
|
||||
|
||||
template <>
|
||||
SIMD_INLINE uint8x8x4_t LoadHalf4<true>(const uint8_t* p) {
|
||||
#if defined(__GNUC__)
|
||||
#if SIMD_NEON_PREFECH_SIZE
|
||||
__builtin_prefetch(p + SIMD_NEON_PREFECH_SIZE);
|
||||
#endif
|
||||
uint8_t* _p = static_cast<uint8_t*>(__builtin_assume_aligned(p, 8));
|
||||
return vld4_u8(_p);
|
||||
#elif defined(_MSC_VER)
|
||||
return vld4_u8_ex(p, 64);
|
||||
#else
|
||||
return vld4_u8(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <bool align>
|
||||
SIMD_INLINE uint8x16x4_t Load4(const uint8_t* p);
|
||||
|
||||
template <>
|
||||
SIMD_INLINE uint8x16x4_t Load4<false>(const uint8_t* p) {
|
||||
#if defined(__GNUC__) && SIMD_NEON_PREFECH_SIZE
|
||||
__builtin_prefetch(p + SIMD_NEON_PREFECH_SIZE);
|
||||
#endif
|
||||
return vld4q_u8(p);
|
||||
}
|
||||
|
||||
template <>
|
||||
SIMD_INLINE uint8x16x4_t Load4<true>(const uint8_t* p) {
|
||||
#if defined(__GNUC__)
|
||||
#if SIMD_NEON_PREFECH_SIZE
|
||||
__builtin_prefetch(p + SIMD_NEON_PREFECH_SIZE);
|
||||
#endif
|
||||
uint8_t* _p = static_cast<uint8_t*>(__builtin_assume_aligned(p, 16));
|
||||
return vld4q_u8(_p);
|
||||
#elif defined(_MSC_VER)
|
||||
return vld4q_u8_ex(p, 128);
|
||||
#else
|
||||
return vld4q_u8(p);
|
||||
#endif
|
||||
}
|
||||
|
||||
// SimdStore.h
|
||||
template <bool align>
|
||||
SIMD_INLINE void Store4(uint8_t* p, uint8x16x4_t a);
|
||||
|
||||
template <>
|
||||
SIMD_INLINE void Store4<false>(uint8_t* p, uint8x16x4_t a) {
|
||||
vst4q_u8(p, a);
|
||||
}
|
||||
|
||||
template <>
|
||||
SIMD_INLINE void Store4<true>(uint8_t* p, uint8x16x4_t a) {
|
||||
#if defined(__GNUC__)
|
||||
uint8_t* _p = static_cast<uint8_t*>(__builtin_assume_aligned(p, 16));
|
||||
vst4q_u8(_p, a);
|
||||
#elif defined(_MSC_VER)
|
||||
vst4q_u8_ex(p, a, 128);
|
||||
#else
|
||||
vst4q_u8(p, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <bool align>
|
||||
SIMD_INLINE void Store4(uint8_t* p, uint8x8x4_t a);
|
||||
|
||||
template <>
|
||||
SIMD_INLINE void Store4<false>(uint8_t* p, uint8x8x4_t a) {
|
||||
vst4_u8(p, a);
|
||||
}
|
||||
|
||||
template <>
|
||||
SIMD_INLINE void Store4<true>(uint8_t* p, uint8x8x4_t a) {
|
||||
#if defined(__GNUC__)
|
||||
uint8_t* _p = static_cast<uint8_t*>(__builtin_assume_aligned(p, 8));
|
||||
vst4_u8(_p, a);
|
||||
#elif defined(_MSC_VER)
|
||||
vst4_u8_ex(p, a, 64);
|
||||
#else
|
||||
vst4_u8(p, a);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace Simd::Neon
|
||||
@@ -15,6 +15,19 @@ using namespace wpi::java;
|
||||
|
||||
static_assert(sizeof(jbyte) * 4 == sizeof(HAL_AddressableLEDData));
|
||||
|
||||
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_RGB ==
|
||||
HAL_ALED_RGB);
|
||||
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_RBG ==
|
||||
HAL_ALED_RBG);
|
||||
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_BGR ==
|
||||
HAL_ALED_BGR);
|
||||
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_BRG ==
|
||||
HAL_ALED_BRG);
|
||||
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_GBR ==
|
||||
HAL_ALED_GBR);
|
||||
static_assert(edu_wpi_first_hal_AddressableLEDJNI_COLOR_ORDER_GRB ==
|
||||
HAL_ALED_GRB);
|
||||
|
||||
extern "C" {
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AddressableLEDJNI
|
||||
@@ -46,6 +59,22 @@ Java_edu_wpi_first_hal_AddressableLEDJNI_free
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AddressableLEDJNI
|
||||
* Method: setColorOrder
|
||||
* Signature: (II)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_edu_wpi_first_hal_AddressableLEDJNI_setColorOrder
|
||||
(JNIEnv* env, jclass, jint handle, jint colorOrder)
|
||||
{
|
||||
int32_t status = 0;
|
||||
HAL_SetAddressableLEDColorOrder(
|
||||
static_cast<HAL_AddressableLEDHandle>(handle),
|
||||
static_cast<HAL_AddressableLEDColorOrder>(colorOrder), &status);
|
||||
CheckStatus(env, status);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_AddressableLEDJNI
|
||||
* Method: setLength
|
||||
|
||||
@@ -55,12 +55,12 @@ Java_edu_wpi_first_hal_SPIJNI_spiInitialize
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_SPIJNI
|
||||
* Method: spiTransaction
|
||||
* Signature: (ILjava/lang/Object;Ljava/lang/Object;B)I
|
||||
* Signature: (ILjava/lang/Object;Ljava/lang/Object;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_SPIJNI_spiTransaction
|
||||
(JNIEnv* env, jclass, jint port, jobject dataToSend, jobject dataReceived,
|
||||
jbyte size)
|
||||
jint size)
|
||||
{
|
||||
uint8_t* dataToSendPtr = nullptr;
|
||||
if (dataToSend != nullptr) {
|
||||
@@ -77,12 +77,12 @@ Java_edu_wpi_first_hal_SPIJNI_spiTransaction
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_SPIJNI
|
||||
* Method: spiTransactionB
|
||||
* Signature: (I[B[BB)I
|
||||
* Signature: (I[B[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_SPIJNI_spiTransactionB
|
||||
(JNIEnv* env, jclass, jint port, jbyteArray dataToSend,
|
||||
jbyteArray dataReceived, jbyte size)
|
||||
jbyteArray dataReceived, jint size)
|
||||
{
|
||||
if (size < 0) {
|
||||
ThrowIllegalArgumentException(env, "SPIJNI.spiTransactionB() size < 0");
|
||||
@@ -104,11 +104,11 @@ Java_edu_wpi_first_hal_SPIJNI_spiTransactionB
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_SPIJNI
|
||||
* Method: spiWrite
|
||||
* Signature: (ILjava/lang/Object;B)I
|
||||
* Signature: (ILjava/lang/Object;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_SPIJNI_spiWrite
|
||||
(JNIEnv* env, jclass, jint port, jobject dataToSend, jbyte size)
|
||||
(JNIEnv* env, jclass, jint port, jobject dataToSend, jint size)
|
||||
{
|
||||
uint8_t* dataToSendPtr = nullptr;
|
||||
if (dataToSend != nullptr) {
|
||||
@@ -123,11 +123,11 @@ Java_edu_wpi_first_hal_SPIJNI_spiWrite
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_SPIJNI
|
||||
* Method: spiWriteB
|
||||
* Signature: (I[BB)I
|
||||
* Signature: (I[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_SPIJNI_spiWriteB
|
||||
(JNIEnv* env, jclass, jint port, jbyteArray dataToSend, jbyte size)
|
||||
(JNIEnv* env, jclass, jint port, jbyteArray dataToSend, jint size)
|
||||
{
|
||||
jint retVal = HAL_WriteSPI(static_cast<HAL_SPIPort>(port),
|
||||
reinterpret_cast<const uint8_t*>(
|
||||
@@ -139,12 +139,12 @@ Java_edu_wpi_first_hal_SPIJNI_spiWriteB
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_SPIJNI
|
||||
* Method: spiRead
|
||||
* Signature: (IZLjava/lang/Object;B)I
|
||||
* Signature: (IZLjava/lang/Object;I)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_SPIJNI_spiRead
|
||||
(JNIEnv* env, jclass, jint port, jboolean initiate, jobject dataReceived,
|
||||
jbyte size)
|
||||
jint size)
|
||||
{
|
||||
if (size < 0) {
|
||||
ThrowIllegalArgumentException(env, "SPIJNI.spiRead() size < 0");
|
||||
@@ -169,12 +169,12 @@ Java_edu_wpi_first_hal_SPIJNI_spiRead
|
||||
/*
|
||||
* Class: edu_wpi_first_hal_SPIJNI
|
||||
* Method: spiReadB
|
||||
* Signature: (IZ[BB)I
|
||||
* Signature: (IZ[BI)I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_edu_wpi_first_hal_SPIJNI_spiReadB
|
||||
(JNIEnv* env, jclass, jint port, jboolean initiate, jbyteArray dataReceived,
|
||||
jbyte size)
|
||||
jint size)
|
||||
{
|
||||
if (size < 0) {
|
||||
ThrowIllegalArgumentException(env, "SPIJNI.spiReadB() size < 0");
|
||||
|
||||
@@ -36,6 +36,17 @@ HAL_AddressableLEDHandle HAL_InitializeAddressableLED(
|
||||
*/
|
||||
void HAL_FreeAddressableLED(HAL_AddressableLEDHandle handle);
|
||||
|
||||
/**
|
||||
* Sets the color order for the addressable LED output. The default order is
|
||||
* GRB. This will take effect on the next call to HAL_WriteAddressableLEDData().
|
||||
* @param[in] handle the Addressable LED handle
|
||||
* @param[in] colorOrder the color order
|
||||
* @param[out] status the error code, or 0 for success
|
||||
*/
|
||||
void HAL_SetAddressableLEDColorOrder(HAL_AddressableLEDHandle handle,
|
||||
HAL_AddressableLEDColorOrder colorOrder,
|
||||
int32_t* status);
|
||||
|
||||
/**
|
||||
* Set the Addressable LED PWM Digital port.
|
||||
*
|
||||
@@ -77,8 +88,8 @@ void HAL_WriteAddressableLEDData(HAL_AddressableLEDHandle handle,
|
||||
/**
|
||||
* Sets the bit timing.
|
||||
*
|
||||
* <p>By default, the driver is set up to drive WS2812Bs, so nothing needs to
|
||||
* be set for those.
|
||||
* <p>By default, the driver is set up to drive WS2812B and WS2815, so nothing
|
||||
* needs to be set for those.
|
||||
*
|
||||
* @param[in] handle the Addressable LED handle
|
||||
* @param[in] highTime0NanoSeconds high time for 0 bit (default 400ns)
|
||||
@@ -98,7 +109,7 @@ void HAL_SetAddressableLEDBitTiming(HAL_AddressableLEDHandle handle,
|
||||
* Sets the sync time.
|
||||
*
|
||||
* <p>The sync time is the time to hold output so LEDs enable. Default set for
|
||||
* WS2812B.
|
||||
* WS2812B and WS2815.
|
||||
*
|
||||
* @param[in] handle the Addressable LED handle
|
||||
* @param[in] syncTimeMicroSeconds the sync time (default 280us)
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <hal/Types.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/** max length of LED strip supported by FPGA. */
|
||||
@@ -16,3 +17,21 @@ struct HAL_AddressableLEDData {
|
||||
uint8_t r; ///< red value
|
||||
uint8_t padding;
|
||||
};
|
||||
|
||||
/**
|
||||
* Order that color data is sent over the wire.
|
||||
*/
|
||||
HAL_ENUM(HAL_AddressableLEDColorOrder) {
|
||||
HAL_ALED_RGB,
|
||||
HAL_ALED_RBG,
|
||||
HAL_ALED_BGR,
|
||||
HAL_ALED_BRG,
|
||||
HAL_ALED_GBR,
|
||||
HAL_ALED_GRB
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
constexpr auto format_as(HAL_AddressableLEDColorOrder order) {
|
||||
return static_cast<int32_t>(order);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -44,6 +44,8 @@ HAL_ENUM(HAL_CANDeviceType) {
|
||||
HAL_CAN_Dev_kMiscellaneous = 10,
|
||||
/// IO breakout.
|
||||
HAL_CAN_Dev_kIOBreakout = 11,
|
||||
// Servo controller.
|
||||
HAL_CAN_Dev_kServoController = 12,
|
||||
/// Firmware update.
|
||||
HAL_CAN_Dev_kFirmwareUpdate = 31
|
||||
};
|
||||
|
||||
@@ -91,6 +91,10 @@ void HAL_FreeAddressableLED(HAL_AddressableLEDHandle handle) {
|
||||
SimAddressableLEDData[led->index].initialized = false;
|
||||
}
|
||||
|
||||
void HAL_SetAddressableLEDColorOrder(HAL_AddressableLEDHandle handle,
|
||||
HAL_AddressableLEDColorOrder colorOrder,
|
||||
int32_t* status) {}
|
||||
|
||||
void HAL_SetAddressableLEDOutputPort(HAL_AddressableLEDHandle handle,
|
||||
HAL_DigitalHandle outputPort,
|
||||
int32_t* status) {
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include "WireDecoder3.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <bit>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <wpi/MathExtras.h>
|
||||
#include <wpi/SpanExtras.h>
|
||||
|
||||
#include "Message3.h"
|
||||
@@ -74,7 +74,7 @@ std::optional<uint64_t> WireDecoder3::SimpleValueReader::Read64(
|
||||
std::optional<double> WireDecoder3::SimpleValueReader::ReadDouble(
|
||||
std::span<const uint8_t>* in) {
|
||||
if (auto val = Read64(in)) {
|
||||
return wpi::bit_cast<double>(val.value());
|
||||
return std::bit_cast<double>(val.value());
|
||||
} else {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
#include "WireEncoder3.h"
|
||||
|
||||
#include <bit>
|
||||
|
||||
#include <wpi/Endian.h>
|
||||
#include <wpi/MathExtras.h>
|
||||
#include <wpi/SmallVector.h>
|
||||
#include <wpi/leb128.h>
|
||||
#include <wpi/raw_ostream.h>
|
||||
@@ -33,7 +34,7 @@ static void Write32(wpi::raw_ostream& os, uint32_t val) {
|
||||
|
||||
static void WriteDouble(wpi::raw_ostream& os, double val) {
|
||||
uint8_t buf[8];
|
||||
wpi::support::endian::write64be(buf, wpi::bit_cast<uint64_t>(val));
|
||||
wpi::support::endian::write64be(buf, std::bit_cast<uint64_t>(val));
|
||||
os << buf;
|
||||
}
|
||||
|
||||
|
||||
@@ -387,7 +387,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultBoolean(bool defaultValue) {
|
||||
return nt::SetDefaultBoolean(m_pubHandle, defaultValue);
|
||||
@@ -397,7 +397,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultInteger(int64_t defaultValue) {
|
||||
return nt::SetDefaultInteger(m_pubHandle, defaultValue);
|
||||
@@ -407,7 +407,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultFloat(float defaultValue) {
|
||||
return nt::SetDefaultFloat(m_pubHandle, defaultValue);
|
||||
@@ -417,7 +417,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultDouble(double defaultValue) {
|
||||
return nt::SetDefaultDouble(m_pubHandle, defaultValue);
|
||||
@@ -427,7 +427,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultString(std::string_view defaultValue) {
|
||||
return nt::SetDefaultString(m_pubHandle, defaultValue);
|
||||
@@ -437,7 +437,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultRaw(std::span<const uint8_t> defaultValue) {
|
||||
return nt::SetDefaultRaw(m_pubHandle, defaultValue);
|
||||
@@ -447,7 +447,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultBooleanArray(std::span<const int> defaultValue) {
|
||||
return nt::SetDefaultBooleanArray(m_pubHandle, defaultValue);
|
||||
@@ -457,7 +457,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultIntegerArray(std::span<const int64_t> defaultValue) {
|
||||
return nt::SetDefaultIntegerArray(m_pubHandle, defaultValue);
|
||||
@@ -467,7 +467,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultFloatArray(std::span<const float> defaultValue) {
|
||||
return nt::SetDefaultFloatArray(m_pubHandle, defaultValue);
|
||||
@@ -477,7 +477,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultDoubleArray(std::span<const double> defaultValue) {
|
||||
return nt::SetDefaultDoubleArray(m_pubHandle, defaultValue);
|
||||
@@ -487,7 +487,7 @@ class GenericPublisher : public Publisher {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultStringArray(std::span<const std::string> defaultValue) {
|
||||
return nt::SetDefaultStringArray(m_pubHandle, defaultValue);
|
||||
|
||||
@@ -361,11 +361,11 @@ class NetworkTable final {
|
||||
bool PutNumber(std::string_view key, double value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
* Set Default Entry Value
|
||||
*
|
||||
* @param key the key
|
||||
* @param defaultValue the default value to set if key doesn't exist.
|
||||
* @returns False if the table key exists with a different type
|
||||
* @returns True if the table key did not already exist, otherwise False
|
||||
*/
|
||||
bool SetDefaultNumber(std::string_view key, double defaultValue);
|
||||
|
||||
@@ -389,11 +389,11 @@ class NetworkTable final {
|
||||
bool PutString(std::string_view key, std::string_view value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
* Set Default Entry Value
|
||||
*
|
||||
* @param key the key
|
||||
* @param defaultValue the default value to set if key doesn't exist.
|
||||
* @returns False if the table key exists with a different type
|
||||
* @returns True if the table key did not already exist, otherwise False
|
||||
*/
|
||||
bool SetDefaultString(std::string_view key, std::string_view defaultValue);
|
||||
|
||||
@@ -419,11 +419,11 @@ class NetworkTable final {
|
||||
bool PutBoolean(std::string_view key, bool value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
* Set Default Entry Value
|
||||
*
|
||||
* @param key the key
|
||||
* @param defaultValue the default value to set if key doesn't exist.
|
||||
* @returns False if the table key exists with a different type
|
||||
* @returns True if the table key did not already exist, otherwise False
|
||||
*/
|
||||
bool SetDefaultBoolean(std::string_view key, bool defaultValue);
|
||||
|
||||
@@ -452,11 +452,11 @@ class NetworkTable final {
|
||||
bool PutBooleanArray(std::string_view key, std::span<const int> value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
* Set Default Entry Value
|
||||
*
|
||||
* @param key the key
|
||||
* @param defaultValue the default value to set if key doesn't exist.
|
||||
* @return False if the table key exists with a different type
|
||||
* @return True if the table key did not already exist, otherwise False
|
||||
*/
|
||||
bool SetDefaultBooleanArray(std::string_view key,
|
||||
std::span<const int> defaultValue);
|
||||
@@ -490,11 +490,11 @@ class NetworkTable final {
|
||||
bool PutNumberArray(std::string_view key, std::span<const double> value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
* Set Default Entry Value
|
||||
*
|
||||
* @param key the key
|
||||
* @param defaultValue the default value to set if key doesn't exist.
|
||||
* @returns False if the table key exists with a different type
|
||||
* @returns True if the table key did not already exist, otherwise False
|
||||
*/
|
||||
bool SetDefaultNumberArray(std::string_view key,
|
||||
std::span<const double> defaultValue);
|
||||
@@ -524,11 +524,11 @@ class NetworkTable final {
|
||||
bool PutStringArray(std::string_view key, std::span<const std::string> value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
* Set Default Entry Value
|
||||
*
|
||||
* @param key the key
|
||||
* @param defaultValue the default value to set if key doesn't exist.
|
||||
* @returns False if the table key exists with a different type
|
||||
* @returns True if the table key did not already exist, otherwise False
|
||||
*/
|
||||
bool SetDefaultStringArray(std::string_view key,
|
||||
std::span<const std::string> defaultValue);
|
||||
@@ -558,11 +558,11 @@ class NetworkTable final {
|
||||
bool PutRaw(std::string_view key, std::span<const uint8_t> value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
* Set Default Entry Value
|
||||
*
|
||||
* @param key the key
|
||||
* @param defaultValue the default value to set if key doesn't exist.
|
||||
* @return False if the table key exists with a different type
|
||||
* @return True if the table key did not already exist, otherwise False
|
||||
*/
|
||||
bool SetDefaultRaw(std::string_view key,
|
||||
std::span<const uint8_t> defaultValue);
|
||||
@@ -592,11 +592,11 @@ class NetworkTable final {
|
||||
bool PutValue(std::string_view key, const Value& value);
|
||||
|
||||
/**
|
||||
* Gets the current value in the table, setting it if it does not exist.
|
||||
* Set Default Entry Value.
|
||||
*
|
||||
* @param key the key
|
||||
* @param defaultValue the default value to set if key doesn't exist.
|
||||
* @return False if the table key exists with a different type
|
||||
* @return True if the table key did not already exist, otherwise False
|
||||
*/
|
||||
bool SetDefaultValue(std::string_view key, const Value& defaultValue);
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultValue(const Value& defaultValue) {
|
||||
return SetDefaultEntryValue(m_handle, defaultValue);
|
||||
@@ -270,7 +270,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultBoolean(bool defaultValue) {
|
||||
return nt::SetDefaultBoolean(m_handle, defaultValue);
|
||||
@@ -280,7 +280,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultInteger(int64_t defaultValue) {
|
||||
return nt::SetDefaultInteger(m_handle, defaultValue);
|
||||
@@ -290,7 +290,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultFloat(float defaultValue) {
|
||||
return nt::SetDefaultFloat(m_handle, defaultValue);
|
||||
@@ -300,7 +300,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultDouble(double defaultValue) {
|
||||
return nt::SetDefaultDouble(m_handle, defaultValue);
|
||||
@@ -310,7 +310,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultString(std::string_view defaultValue) {
|
||||
return nt::SetDefaultString(m_handle, defaultValue);
|
||||
@@ -320,7 +320,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultRaw(std::span<const uint8_t> defaultValue) {
|
||||
return nt::SetDefaultRaw(m_handle, defaultValue);
|
||||
@@ -330,7 +330,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultBooleanArray(std::span<const int> defaultValue) {
|
||||
return nt::SetDefaultBooleanArray(m_handle, defaultValue);
|
||||
@@ -340,7 +340,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultIntegerArray(std::span<const int64_t> defaultValue) {
|
||||
return nt::SetDefaultIntegerArray(m_handle, defaultValue);
|
||||
@@ -350,7 +350,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultFloatArray(std::span<const float> defaultValue) {
|
||||
return nt::SetDefaultFloatArray(m_handle, defaultValue);
|
||||
@@ -360,7 +360,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultDoubleArray(std::span<const double> defaultValue) {
|
||||
return nt::SetDefaultDoubleArray(m_handle, defaultValue);
|
||||
@@ -370,7 +370,7 @@ class NetworkTableEntry final {
|
||||
* Sets the entry's value if it does not exist.
|
||||
*
|
||||
* @param defaultValue the default value to set
|
||||
* @return False if the entry exists with a different type
|
||||
* @return True if the entry did not already have a value, otherwise False
|
||||
*/
|
||||
bool SetDefaultStringArray(std::span<const std::string> defaultValue) {
|
||||
return nt::SetDefaultStringArray(m_handle, defaultValue);
|
||||
|
||||
@@ -476,8 +476,8 @@ void NT_GetEntryValueType(NT_Entry entry, unsigned int types,
|
||||
/**
|
||||
* Set Default Entry Value.
|
||||
*
|
||||
* Returns copy of current entry value if it exists.
|
||||
* Otherwise, sets passed in value, and returns set value.
|
||||
* Returns 0 if name exists.
|
||||
* Otherwise, sets passed in value, and returns 1.
|
||||
* Note that one of the type options is "unassigned".
|
||||
*
|
||||
* @param entry entry handle
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user