mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
Compare commits
137 Commits
v2023.0.0-
...
v2023.0.0-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
90cfa00115 | ||
|
|
5cf961edb9 | ||
|
|
b2276e47de | ||
|
|
893b46139a | ||
|
|
60e29627c0 | ||
|
|
3b81cf6c35 | ||
|
|
5c067d30a0 | ||
|
|
ceaf493811 | ||
|
|
10e04e2b13 | ||
|
|
726f67c64b | ||
|
|
c7b7624c1c | ||
|
|
d600529ec0 | ||
|
|
b53b3526a2 | ||
|
|
38bb23eb18 | ||
|
|
3937ff8221 | ||
|
|
abbfe244b5 | ||
|
|
4ddb8aa0dd | ||
|
|
a791470de7 | ||
|
|
17f504f548 | ||
|
|
773198537c | ||
|
|
5ac658c8f0 | ||
|
|
8767e4a941 | ||
|
|
8c4af073f4 | ||
|
|
c79f38584a | ||
|
|
36c08dd97c | ||
|
|
69b7b3dd7d | ||
|
|
738c75fed8 | ||
|
|
4eb1d03fb3 | ||
|
|
ba4ec6c967 | ||
|
|
97836f0e55 | ||
|
|
fdfb85f695 | ||
|
|
ab1baf4832 | ||
|
|
9730032866 | ||
|
|
5b656eecf6 | ||
|
|
9ae38eaa7c | ||
|
|
cb33bd71df | ||
|
|
d9b4e7b8bf | ||
|
|
0389bf5214 | ||
|
|
4267fa08d1 | ||
|
|
65c8fbd452 | ||
|
|
f36162fddc | ||
|
|
5149f7d894 | ||
|
|
20b5bed1cb | ||
|
|
f18dd1905d | ||
|
|
aa9d7f1cdc | ||
|
|
2742662254 | ||
|
|
a5df391166 | ||
|
|
59e6706b75 | ||
|
|
8461bb1e03 | ||
|
|
b873e208b4 | ||
|
|
873e72df8c | ||
|
|
c8bd6fc5b4 | ||
|
|
fed68b83b4 | ||
|
|
0ef8a4e1df | ||
|
|
c393b3b367 | ||
|
|
b5a17f762c | ||
|
|
fafc81ed1a | ||
|
|
cc56bdc787 | ||
|
|
4254438d8d | ||
|
|
97c15af238 | ||
|
|
d22ff8a158 | ||
|
|
fdb5a2791f | ||
|
|
c3a93fb995 | ||
|
|
f2a8d38d2a | ||
|
|
9e24c6eac0 | ||
|
|
fe4d12ce22 | ||
|
|
eb08486039 | ||
|
|
ccf83c634a | ||
|
|
3fd69749e7 | ||
|
|
594df5fc08 | ||
|
|
539070820d | ||
|
|
564a56d99b | ||
|
|
5adf50d93c | ||
|
|
d80e8039d7 | ||
|
|
0e6d67b23b | ||
|
|
be5270697a | ||
|
|
8d28851263 | ||
|
|
3d2115c93e | ||
|
|
91002ae3cc | ||
|
|
148c18e658 | ||
|
|
a2a5c926b6 | ||
|
|
ea6b1d8449 | ||
|
|
ac9be78e27 | ||
|
|
151dabb2af | ||
|
|
340465c929 | ||
|
|
d45bcddd15 | ||
|
|
0e0786331a | ||
|
|
c5db23f296 | ||
|
|
44abc8dfa6 | ||
|
|
3fdb2f767d | ||
|
|
0485f05da9 | ||
|
|
0a5eb65231 | ||
|
|
19ffebaf3e | ||
|
|
ce1a90d639 | ||
|
|
d25af48797 | ||
|
|
ebb836dacb | ||
|
|
d83e202f00 | ||
|
|
3ccf806064 | ||
|
|
6f1e01f8bd | ||
|
|
1023c34b1c | ||
|
|
faa29d596c | ||
|
|
add00a96ed | ||
|
|
82fac41244 | ||
|
|
5eb44e22a9 | ||
|
|
2e09fa7325 | ||
|
|
fe3c24b1ee | ||
|
|
aa221597bc | ||
|
|
579a8ee229 | ||
|
|
5105c5eab6 | ||
|
|
787fe6e7a5 | ||
|
|
6671f8d099 | ||
|
|
9ac9b69aa2 | ||
|
|
e61028cb18 | ||
|
|
661d23eaf5 | ||
|
|
666040e3e5 | ||
|
|
aebc272449 | ||
|
|
fd884581e4 | ||
|
|
9b1bf5c7f1 | ||
|
|
c9e620a920 | ||
|
|
41d40dd62f | ||
|
|
30f5b68264 | ||
|
|
f7b3f4b90e | ||
|
|
a99c11c14c | ||
|
|
45b7fc445b | ||
|
|
16a4888c52 | ||
|
|
17752f1337 | ||
|
|
abb45a68db | ||
|
|
1280a54ef3 | ||
|
|
f2d243fa68 | ||
|
|
a4787130f4 | ||
|
|
af7985e46c | ||
|
|
e9d1b5c2d0 | ||
|
|
45b598d236 | ||
|
|
fc37265da5 | ||
|
|
a4ec13eb0e | ||
|
|
2fa52007af | ||
|
|
d9f9cd1140 |
@@ -53,7 +53,6 @@ Checks:
|
||||
google-readability-avoid-underscore-in-googletest-name,
|
||||
google-readability-casting,
|
||||
google-runtime-operator,
|
||||
llvm-twine-local,
|
||||
misc-definitions-in-headers,
|
||||
misc-misplaced-const,
|
||||
misc-new-delete-overloads,
|
||||
@@ -70,6 +69,3 @@ Checks:
|
||||
modernize-use-using,
|
||||
readability-braces-around-statements'
|
||||
FormatStyle: file
|
||||
CheckOptions:
|
||||
- key: bugprone-dangling-handle
|
||||
value: 'wpi::StringRef;wpi::Twine'
|
||||
|
||||
32
.github/workflows/cmake.yml
vendored
32
.github/workflows/cmake.yml
vendored
@@ -49,35 +49,3 @@ jobs:
|
||||
- name: test
|
||||
working-directory: build
|
||||
run: ctest --output-on-failure
|
||||
|
||||
build-windows:
|
||||
env:
|
||||
VCPKG_DEFAULT_TRIPLET: x64-windows
|
||||
name: "Build - Windows"
|
||||
runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install CMake
|
||||
uses: lukka/get-cmake@v3.23.0
|
||||
|
||||
- name: Run vcpkg
|
||||
uses: lukka/run-vcpkg@v10.2
|
||||
with:
|
||||
vcpkgDirectory: ${{ runner.workspace }}/vcpkg
|
||||
vcpkgGitCommitId: f6af75acc923c833a5620943e3fc7d5e4930f0df # HEAD on 2022-04-10
|
||||
runVcpkgInstall: true
|
||||
|
||||
- name: Install jinja
|
||||
run: python -m pip install jinja2
|
||||
|
||||
- name: configure
|
||||
run: mkdir build && cd build && cmake -DWITH_JAVA=OFF -DCMAKE_TOOLCHAIN_FILE=${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake ..
|
||||
|
||||
- name: build
|
||||
working-directory: build
|
||||
run: cmake --build . --parallel $(nproc)
|
||||
|
||||
- name: test
|
||||
working-directory: build
|
||||
run: ctest -C "Debug" --output-on-failure
|
||||
|
||||
11
.github/workflows/comment-command.yml
vendored
11
.github/workflows/comment-command.yml
vendored
@@ -20,6 +20,8 @@ jobs:
|
||||
content: "rocket",
|
||||
});
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}
|
||||
- name: Fetch all history and metadata
|
||||
run: |
|
||||
git fetch --prune --unshallow
|
||||
@@ -29,7 +31,7 @@ jobs:
|
||||
run: |
|
||||
gh pr checkout $NUMBER
|
||||
env:
|
||||
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||
GITHUB_TOKEN: "${{ secrets.COMMENT_COMMAND_PAT_TOKEN }}"
|
||||
NUMBER: ${{ github.event.issue.number }}
|
||||
- name: Set up Python 3.8
|
||||
uses: actions/setup-python@v2
|
||||
@@ -37,13 +39,14 @@ jobs:
|
||||
python-version: 3.8
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
sudo sh -c "echo 'deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe' >> /etc/apt/sources.list.d/proposed-repositories.list"
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo sh -c "echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -y clang-format-12
|
||||
sudo apt-get install -y clang-format-14
|
||||
- name: Install wpiformat
|
||||
run: pip3 install wpiformat
|
||||
- name: Run wpiformat
|
||||
run: wpiformat -clang 12
|
||||
run: wpiformat -clang 14
|
||||
- name: Commit
|
||||
run: |
|
||||
# Set credentials
|
||||
|
||||
23
.github/workflows/gradle.yml
vendored
23
.github/workflows/gradle.yml
vendored
@@ -16,11 +16,11 @@ jobs:
|
||||
artifact-name: Athena
|
||||
build-options: "-Ponlylinuxathena"
|
||||
- container: wpilib/raspbian-cross-ubuntu:10-20.04
|
||||
artifact-name: Raspbian
|
||||
build-options: "-Ponlylinuxraspbian"
|
||||
artifact-name: Arm32
|
||||
build-options: "-Ponlylinuxarm32"
|
||||
- container: wpilib/aarch64-cross-ubuntu:bionic-20.04
|
||||
artifact-name: Aarch64
|
||||
build-options: "-Ponlylinuxaarch64bionic"
|
||||
artifact-name: Arm64
|
||||
build-options: "-Ponlylinuxarm64"
|
||||
- container: wpilib/ubuntu-base:20.04
|
||||
artifact-name: Linux
|
||||
build-options: "-Ponlylinuxx86-64"
|
||||
@@ -52,11 +52,20 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- os: windows-2019
|
||||
artifact-name: Win64
|
||||
artifact-name: Win64Debug
|
||||
architecture: x64
|
||||
task: "build"
|
||||
build-options: "-PciDebugOnly --max-workers 1"
|
||||
- os: windows-2019
|
||||
artifact-name: Win64Release
|
||||
architecture: x64
|
||||
build-options: "-PciReleaseOnly --max-workers 1"
|
||||
task: "copyAllOutputs"
|
||||
- os: macOS-11
|
||||
artifact-name: macOS
|
||||
architecture: x64
|
||||
build-options: "-Pbuildalldesktop"
|
||||
task: "build"
|
||||
name: "Build - ${{ matrix.artifact-name }}"
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
@@ -86,12 +95,12 @@ jobs:
|
||||
shell: bash
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build --build-cache -PbuildServer -PskipJavaFormat ${{ env.EXTRA_GRADLE_ARGS }}
|
||||
run: ./gradlew ${{ matrix.task }} --build-cache -PbuildServer -PskipJavaFormat ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
|
||||
env:
|
||||
ARTIFACTORY_PUBLISH_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
|
||||
ARTIFACTORY_PUBLISH_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
|
||||
- name: Sign Libraries with Developer ID
|
||||
run: ./gradlew build -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ env.EXTRA_GRADLE_ARGS }}
|
||||
run: ./gradlew build -PbuildServer -PskipJavaFormat -PdeveloperID=${{ secrets.APPLE_DEVELOPER_ID }} ${{ matrix.build-options }} ${{ env.EXTRA_GRADLE_ARGS }}
|
||||
if: |
|
||||
matrix.artifact-name == 'macOS' && (github.repository_owner == 'wpilibsuite' &&
|
||||
(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
|
||||
|
||||
14
.github/workflows/lint-format.yml
vendored
14
.github/workflows/lint-format.yml
vendored
@@ -28,13 +28,14 @@ jobs:
|
||||
python-version: 3.8
|
||||
- name: Install clang-format
|
||||
run: |
|
||||
sudo sh -c "echo 'deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe' >> /etc/apt/sources.list.d/proposed-repositories.list"
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo sh -c "echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -y clang-format-12
|
||||
sudo apt-get install -y clang-format-14
|
||||
- name: Install wpiformat
|
||||
run: pip3 install wpiformat
|
||||
- name: Run
|
||||
run: wpiformat -clang 12
|
||||
run: wpiformat -clang 14
|
||||
- name: Check output
|
||||
run: git --no-pager diff --exit-code HEAD
|
||||
- name: Generate diff
|
||||
@@ -63,9 +64,10 @@ jobs:
|
||||
python-version: 3.8
|
||||
- name: Install clang-tidy
|
||||
run: |
|
||||
sudo sh -c "echo 'deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe' >> /etc/apt/sources.list.d/proposed-repositories.list"
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
|
||||
sudo sh -c "echo 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main' >> /etc/apt/sources.list.d/proposed-repositories.list"
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -y clang-tidy-12 clang-format-12
|
||||
sudo apt-get install -y clang-tidy-14 clang-format-14
|
||||
- name: Install wpiformat
|
||||
run: pip3 install wpiformat
|
||||
- name: Create compile_commands.json
|
||||
@@ -73,7 +75,7 @@ jobs:
|
||||
- name: List changed files
|
||||
run: wpiformat -list-changed-files
|
||||
- name: Run clang-tidy
|
||||
run: wpiformat -clang 12 -no-format -tidy-changed -compile-commands=build/compile_commands/linuxx86-64 -vv
|
||||
run: wpiformat -clang 14 -no-format -tidy-changed -compile-commands=build/compile_commands/linuxx86-64 -vv
|
||||
javaformat:
|
||||
name: "Java format"
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
2
.github/workflows/sanitizers.yml
vendored
2
.github/workflows/sanitizers.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: asan
|
||||
cmake-flags: "-DCMAKE_BUILD_TYPE=Asan"
|
||||
ctest-env: ""
|
||||
ctest-flags: "-E 'wpinet|wpiutil|ntcore|wpilibc'"
|
||||
ctest-flags: "-E 'ntcore|wpilibc'"
|
||||
- name: tsan
|
||||
cmake-flags: "-DCMAKE_BUILD_TYPE=Tsan"
|
||||
ctest-env: "TSAN_OPTIONS=second_deadlock_stack=1"
|
||||
|
||||
10
.github/workflows/upstream-utils.yml
vendored
10
.github/workflows/upstream-utils.yml
vendored
@@ -37,6 +37,10 @@ jobs:
|
||||
run: |
|
||||
cd upstream_utils
|
||||
./update_eigen.py
|
||||
- name: Run update_fmt.py
|
||||
run: |
|
||||
cd upstream_utils
|
||||
./update_fmt.py
|
||||
- name: Run update_libuv.py
|
||||
run: |
|
||||
cd upstream_utils
|
||||
@@ -49,5 +53,11 @@ jobs:
|
||||
run: |
|
||||
cd upstream_utils
|
||||
./update_stack_walker.py
|
||||
- name: Run update_memory.py
|
||||
run: |
|
||||
cd upstream_utils
|
||||
./update_memory.py
|
||||
- name: Add untracked files to index so they count as changes
|
||||
run: git add -A
|
||||
- name: Check output
|
||||
run: git --no-pager diff --exit-code HEAD
|
||||
|
||||
@@ -37,7 +37,7 @@ So you want to contribute your changes back to WPILib. Great! We have a few cont
|
||||
|
||||
## Coding Guidelines
|
||||
|
||||
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system. We currently use clang-format 12.0 with wpiformat.
|
||||
WPILib uses modified Google style guides for both C++ and Java, which can be found in the [styleguide repository](https://github.com/wpilibsuite/styleguide). Autoformatters are available for many popular editors at https://github.com/google/styleguide. Running wpiformat is required for all contributions and is enforced by our continuous integration system. We currently use clang-format 14.0 with wpiformat.
|
||||
|
||||
While the library should be fully formatted according to the styles, additional elements of the style guide were not followed when the library was initially created. All new code should follow the guidelines. If you are looking for some easy ramp-up tasks, finding areas that don't follow the style guide and fixing them is very welcome.
|
||||
|
||||
|
||||
@@ -6,9 +6,9 @@ This article contains instructions on building projects using a development buil
|
||||
|
||||
## Development Build
|
||||
|
||||
Development builds are the per-commit build hosted everytime a commit is pushed to the [allwpilib](https://github.com/wpilibsuite/allwpilib/) repository. These builds are then hosted on [artifactory](https://frcmaven.wpi.edu/artifactory/webapp/#/home).
|
||||
Development builds are the per-commit build hosted every time a commit is pushed to the [allwpilib](https://github.com/wpilibsuite/allwpilib/) repository. These builds are then hosted on [artifactory](https://frcmaven.wpi.edu/artifactory/webapp/#/home).
|
||||
|
||||
In order to build a project using a development build, find the build.gradle file and open it. Then, add the following code below the plugin section and replace YEAR with the year of the development version.
|
||||
In order to build a project using a development build, find the build.gradle file and open it. Then, add the following code below the plugin section and replace YEAR with the year of the development version. It is also necessary to use a 2023 GradleRIO version, ie `2023.0.0-alpha-1`
|
||||
|
||||
```groovy
|
||||
wpi.maven.useLocal = false
|
||||
@@ -23,13 +23,13 @@ Java
|
||||
```groovy
|
||||
plugins {
|
||||
id "java"
|
||||
id "edu.wpi.first.GradleRIO" version "2022.1.1"
|
||||
id "edu.wpi.first.GradleRIO" version "2023.0.0-alpha-1"
|
||||
}
|
||||
|
||||
wpi.maven.useLocal = false
|
||||
wpi.maven.useDevelopment = true
|
||||
wpi.versions.wpilibVersion = '2022.+'
|
||||
wpi.versions.wpimathVersion = '2022.+'
|
||||
wpi.versions.wpilibVersion = '2023.+'
|
||||
wpi.versions.wpimathVersion = '2023.+'
|
||||
```
|
||||
|
||||
C++
|
||||
@@ -37,13 +37,13 @@ C++
|
||||
plugins {
|
||||
id "cpp"
|
||||
id "google-test-test-suite"
|
||||
id "edu.wpi.first.GradleRIO" version "2022.1.1"
|
||||
id "edu.wpi.first.GradleRIO" version "2023.0.0-alpha-1"
|
||||
}
|
||||
|
||||
wpi.maven.useLocal = false
|
||||
wpi.maven.useDevelopment = true
|
||||
wpi.versions.wpilibVersion = '2022.+'
|
||||
wpi.versions.wpimathVersion = '2022.+'
|
||||
wpi.versions.wpilibVersion = '2023.+'
|
||||
wpi.versions.wpimathVersion = '2023.+'
|
||||
```
|
||||
|
||||
## Local Build
|
||||
@@ -54,7 +54,7 @@ Java
|
||||
```groovy
|
||||
plugins {
|
||||
id "java"
|
||||
id "edu.wpi.first.GradleRIO" version "2022.1.1"
|
||||
id "edu.wpi.first.GradleRIO" version "2023.0.0-alpha-1"
|
||||
}
|
||||
|
||||
wpi.maven.useLocal = false
|
||||
@@ -68,7 +68,7 @@ C++
|
||||
plugins {
|
||||
id "cpp"
|
||||
id "google-test-test-suite"
|
||||
id "edu.wpi.first.GradleRIO" version "2022.1.1"
|
||||
id "edu.wpi.first.GradleRIO" version "2023.0.0-alpha-1"
|
||||
}
|
||||
|
||||
wpi.maven.useLocal = false
|
||||
|
||||
@@ -16,7 +16,7 @@ Welcome to the WPILib project. This repository contains the HAL, WPILibJ, and WP
|
||||
- [Using Development Builds](#using-development-builds)
|
||||
- [Custom toolchain location](#custom-toolchain-location)
|
||||
- [Gazebo simulation](#gazebo-simulation)
|
||||
- [Formatting/linting with wpiformat](#formattinglinting-with-wpiformat)
|
||||
- [Formatting/Linting](#formattinglinting)
|
||||
- [CMake](#cmake)
|
||||
- [Publishing](#publishing)
|
||||
- [Structure and Organization](#structure-and-organization)
|
||||
@@ -54,7 +54,9 @@ Using Gradle makes building WPILib very straightforward. It only has a few depen
|
||||
- Run `./gradlew installRoboRioToolchain` after cloning this repository
|
||||
- If the WPILib installer was used, this toolchain is already installed
|
||||
- Raspberry Pi toolchain (optional)
|
||||
- Run `./gradlew installRaspbianToolchain` after cloning this repository
|
||||
- Run `./gradlew installArm32Toolchain` after cloning this repository
|
||||
|
||||
On macOS ARM, run `softwareupdate --install-rosetta`. This is necessary to be able to use the macOS x86 roboRIO toolchain on ARM.
|
||||
|
||||
## Setup
|
||||
|
||||
@@ -166,7 +168,7 @@ The Simulation directory contains extra simulation tools and libraries, such as
|
||||
|
||||
The integration test directories for C++ and Java contain test code that runs on our test-system. When you submit code for review, it is tested by those programs. If you add new functionality you should make sure to write tests for it so we don't break it in the future.
|
||||
|
||||
The hal directory contains more C++ code meant to run on the roboRIO. HAL is an acronym for "Hardware Abstraction Layer", and it interfaces with the NI Libraries. The NI Libraries contain the low-level code for controlling devices on your robot. The NI Libraries are found in the ni-libraries folder.
|
||||
The hal directory contains more C++ code meant to run on the roboRIO. HAL is an acronym for "Hardware Abstraction Layer", and it interfaces with the NI Libraries. The NI Libraries contain the low-level code for controlling devices on your robot. The NI Libraries are found in the [ni-libraries](https://github.com/wpilibsuite/ni-libraries) project.
|
||||
|
||||
The upstream_utils directory contains scripts for updating copies of thirdparty code in the repository.
|
||||
|
||||
|
||||
@@ -17,41 +17,35 @@ Program Locations
|
||||
------- ---------
|
||||
RoboRIO Libraries ni-libraries
|
||||
Google Test gtest
|
||||
LLVM wpiutil/src/main/native/include/wpi/{various files}
|
||||
wpiutil/src/main/native/cpp/llvm/
|
||||
wpiutil/src/main/native/cpp/leb128.cpp
|
||||
wpiutil/src/test/native/cpp/leb128Test.cpp
|
||||
JSON for Modern C++ wpiutil/src/main/native/include/wpi/json.h
|
||||
wpiutil/src/main/native/cpp/json_*.cpp
|
||||
LLVM wpiutil/src/main/native/thirdparty/llvm
|
||||
wpiutil/src/test/native/cpp/llvm/
|
||||
JSON for Modern C++ wpiutil/src/main/native/thirdparty/json
|
||||
wpiutil/src/test/native/cpp/json/
|
||||
libuv wpinet/src/main/native/thirdparty/libuv/
|
||||
fmtlib wpiutil/src/main/native/fmtlib/
|
||||
sigslot wpiutil/src/main/native/include/wpi/Signal.h
|
||||
wpiutil/src/test/native/cpp/sigslot/
|
||||
tcpsockets wpiutil/src/main/native/cpp/TCP{Stream,Connector,Acceptor}.cpp
|
||||
wpiutil/src/main/native/include/wpi/TCP*.h
|
||||
MPack wpiutil/src/main/native/include/mpack.h
|
||||
wpiutil/src/main/native/cpp/mpack.cpp
|
||||
fmtlib wpiutil/src/main/native/thirdparty/fmtlib/
|
||||
sigslot wpiutil/src/main/native/thirdparty/sigslot
|
||||
tcpsockets wpinet/src/main/native/thirdparty/tcpsockets
|
||||
MPack wpiutil/src/main/native/thirdparty/mpack
|
||||
Bootstrap wpinet/src/main/native/resources/bootstrap-*
|
||||
CoreUI wpinet/src/main/native/resources/coreui-*
|
||||
Feather Icons wpinet/src/main/native/resources/feather-*
|
||||
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/eigeninclude/
|
||||
wpimath/src/main/native/include/unsupported/
|
||||
Eigen wpimath/src/main/native/thirdparty/eigen/include/
|
||||
StackWalker wpiutil/src/main/native/windows/StackWalker.*
|
||||
TCB span wpiutil/src/main/native/include/wpi/span.h
|
||||
TCB span wpiutil/src/main/native/thirdparty/include/wpi/span.h
|
||||
wpiutil/src/test/native/cpp/span/
|
||||
GHC filesystem wpiutil/src/main/native/include/wpi/ghc/
|
||||
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
|
||||
Portable File Dialogs wpigui/src/main/native/include/portable-file-dialogs.h
|
||||
Drake wpimath/src/main/native/cpp/drake/common/drake_assert_and_throw.cpp
|
||||
wpimath/src/main/native/cpp/drake/math/discrete_algebraic_riccati_equation.cpp
|
||||
Drake wpimath/src/main/native/thirdparty/drake/
|
||||
wpimath/src/test/native/cpp/drake/
|
||||
wpimath/src/test/native/include/drake/
|
||||
V8 export-template wpiutil/src/main/native/include/wpi/SymbolExports.h
|
||||
|
||||
==============================================================================
|
||||
|
||||
@@ -23,7 +23,7 @@ plugins {
|
||||
id 'net.ltgt.errorprone' version '2.0.2' apply false
|
||||
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
|
||||
id 'com.diffplug.spotless' version '6.4.2' apply false
|
||||
id 'com.github.spotbugs' version '5.0.6' apply false
|
||||
id 'com.github.spotbugs' version '5.0.8' apply false
|
||||
}
|
||||
|
||||
wpilibVersioning.buildServerMode = project.hasProperty('buildServer')
|
||||
@@ -87,7 +87,12 @@ task copyAllOutputs(type: Copy) {
|
||||
build.dependsOn copyAllOutputs
|
||||
copyAllOutputs.dependsOn outputVersions
|
||||
|
||||
def copyReleaseOnly = project.hasProperty('ciReleaseOnly')
|
||||
|
||||
ext.addTaskToCopyAllOutputs = { task ->
|
||||
if (copyReleaseOnly && task.name.contains('debug')) {
|
||||
return
|
||||
}
|
||||
copyAllOutputs.dependsOn task
|
||||
copyAllOutputs.inputs.file task.archivePath
|
||||
copyAllOutputs.from task.archivePath
|
||||
@@ -151,5 +156,5 @@ ext.getCurrentArch = {
|
||||
}
|
||||
|
||||
wrapper {
|
||||
gradleVersion = '7.3.3'
|
||||
gradleVersion = '7.5.1'
|
||||
}
|
||||
|
||||
@@ -5,5 +5,5 @@ repositories {
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
implementation "edu.wpi.first:native-utils:2023.0.1"
|
||||
implementation "edu.wpi.first:native-utils:2023.1.0"
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ dependencies {
|
||||
model {
|
||||
components {
|
||||
multiCameraServerCpp(NativeExecutableSpec) {
|
||||
targetBuildTypes 'release'
|
||||
sources {
|
||||
cpp {
|
||||
source {
|
||||
|
||||
@@ -33,12 +33,10 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
* Singleton class for creating and keeping camera servers. Also publishes camera information to
|
||||
* NetworkTables.
|
||||
*/
|
||||
@SuppressWarnings("PMD.UnusedPrivateField")
|
||||
public final class CameraServer {
|
||||
public static final int kBasePort = 1181;
|
||||
|
||||
private static final String kPublishName = "/CameraPublisher";
|
||||
private static CameraServer server;
|
||||
|
||||
private static final AtomicInteger m_defaultUsbDevice = new AtomicInteger();
|
||||
private static String m_primarySourceName;
|
||||
@@ -63,6 +61,7 @@ public final class CameraServer {
|
||||
// - "PropertyInfo/{Property}" - Property supporting information
|
||||
|
||||
// Listener for video events
|
||||
@SuppressWarnings("PMD.UnusedPrivateField")
|
||||
private static final VideoListener m_videoListener =
|
||||
new VideoListener(
|
||||
event -> {
|
||||
@@ -185,6 +184,7 @@ public final class CameraServer {
|
||||
0x4fff,
|
||||
true);
|
||||
|
||||
@SuppressWarnings("PMD.UnusedPrivateField")
|
||||
private static final int m_tableListener =
|
||||
NetworkTableInstance.getDefault()
|
||||
.addEntryListener(
|
||||
@@ -243,10 +243,15 @@ public final class CameraServer {
|
||||
}
|
||||
},
|
||||
EntryListenerFlags.kImmediate | EntryListenerFlags.kUpdate);
|
||||
|
||||
private static int m_nextPort = kBasePort;
|
||||
private static String[] m_addresses = new String[0];
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Return URI of source with the given index.
|
||||
*
|
||||
* @param source Source index.
|
||||
*/
|
||||
private static String makeSourceValue(int source) {
|
||||
switch (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))) {
|
||||
case kUsb:
|
||||
@@ -267,12 +272,21 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Return URI of stream with the given address and port.
|
||||
*
|
||||
* @param address Stream IP address.
|
||||
* @param port Stream remote port.
|
||||
*/
|
||||
private static String makeStreamValue(String address, int port) {
|
||||
return "mjpg:http://" + address + ":" + port + "/?action=stream";
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Return URI of sink stream with the given index.
|
||||
*
|
||||
* @param sink Sink index.
|
||||
*/
|
||||
private static synchronized String[] getSinkStreamValues(int sink) {
|
||||
// Ignore all but MjpegServer
|
||||
if (VideoSink.getKindFromInt(CameraServerJNI.getSinkKind(sink)) != VideoSink.Kind.kMjpeg) {
|
||||
@@ -302,7 +316,11 @@ public final class CameraServer {
|
||||
return values.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Return list of stream source URIs for the given source index.
|
||||
*
|
||||
* @param source Source index.
|
||||
*/
|
||||
private static synchronized String[] getSourceStreamValues(int source) {
|
||||
// Ignore all but HttpCamera
|
||||
if (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source))
|
||||
@@ -337,7 +355,7 @@ public final class CameraServer {
|
||||
return values;
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/** Update list of stream URIs. */
|
||||
private static synchronized void updateStreamValues() {
|
||||
// Over all the sinks...
|
||||
for (VideoSink i : m_sinks.values()) {
|
||||
@@ -383,7 +401,7 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/** Provide string description of pixel format. */
|
||||
private static String pixelFormatToString(PixelFormat pixelFormat) {
|
||||
switch (pixelFormat) {
|
||||
case kMJPEG:
|
||||
@@ -401,9 +419,11 @@ public final class CameraServer {
|
||||
}
|
||||
}
|
||||
|
||||
/// Provide string description of video mode.
|
||||
/// The returned string is "{width}x{height} {format} {fps} fps".
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Provide string description of video mode.
|
||||
*
|
||||
* <p>The returned string is "{width}x{height} {format} {fps} fps".
|
||||
*/
|
||||
private static String videoModeToString(VideoMode mode) {
|
||||
return mode.width
|
||||
+ "x"
|
||||
@@ -415,7 +435,11 @@ public final class CameraServer {
|
||||
+ " fps";
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Get list of video modes for the given source handle.
|
||||
*
|
||||
* @param sourceHandle Source handle.
|
||||
*/
|
||||
private static String[] getSourceModeValues(int sourceHandle) {
|
||||
VideoMode[] modes = CameraServerJNI.enumerateSourceVideoModes(sourceHandle);
|
||||
String[] modeStrings = new String[modes.length];
|
||||
@@ -425,7 +449,13 @@ public final class CameraServer {
|
||||
return modeStrings;
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Publish a source property value to NetworkTables.
|
||||
*
|
||||
* @param table NetworkTable to which to push value.
|
||||
* @param event Video event.
|
||||
* @param isNew Whether the property value hasn't been pushed to NetworkTables before.
|
||||
*/
|
||||
private static void putSourcePropertyValue(NetworkTable table, VideoEvent event, boolean isNew) {
|
||||
String name;
|
||||
String infoName;
|
||||
|
||||
@@ -609,7 +609,7 @@ cs::CvSink CameraServer::GetVideo(const cs::VideoSource& camera) {
|
||||
if (kind != cs::VideoSink::kCv) {
|
||||
auto csShared = GetCameraServerShared();
|
||||
csShared->SetCameraServerError("expected OpenCV sink, but got {}",
|
||||
kind);
|
||||
static_cast<int>(kind));
|
||||
return cs::CvSink{};
|
||||
}
|
||||
return *static_cast<cs::CvSink*>(&it->second);
|
||||
|
||||
@@ -27,20 +27,17 @@ class CameraServerShared {
|
||||
|
||||
template <typename S, typename... Args>
|
||||
inline void SetCameraServerError(const S& format, Args&&... args) {
|
||||
SetCameraServerErrorV(format,
|
||||
fmt::make_args_checked<Args...>(format, args...));
|
||||
SetCameraServerErrorV(format, fmt::make_format_args(args...));
|
||||
}
|
||||
|
||||
template <typename S, typename... Args>
|
||||
inline void SetVisionRunnerError(const S& format, Args&&... args) {
|
||||
SetVisionRunnerErrorV(format,
|
||||
fmt::make_args_checked<Args...>(format, args...));
|
||||
SetVisionRunnerErrorV(format, fmt::make_format_args(args...));
|
||||
}
|
||||
|
||||
template <typename S, typename... Args>
|
||||
inline void ReportDriverStationError(const S& format, Args&&... args) {
|
||||
ReportDriverStationErrorV(format,
|
||||
fmt::make_args_checked<Args...>(format, args...));
|
||||
ReportDriverStationErrorV(format, fmt::make_format_args(args...));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,4 +4,12 @@ macro(wpilib_target_warnings target)
|
||||
else()
|
||||
target_compile_options(${target} PRIVATE /wd4146 /wd4244 /wd4251 /wd4267 /WX /D_CRT_SECURE_NO_WARNINGS ${WPILIB_TARGET_WARNINGS})
|
||||
endif()
|
||||
|
||||
# Suppress C++-specific OpenCV warning; C compiler rejects it with an error
|
||||
# https://github.com/opencv/opencv/issues/20269
|
||||
if(UNIX AND NOT APPLE)
|
||||
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-enum-enum-conversion>)
|
||||
elseif(UNIX AND APPLE)
|
||||
target_compile_options(${target} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Wno-deprecated-anon-enum-enum-conversion>)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -100,8 +100,9 @@ void TestTimingDMA(int squelch, std::pair<int, int> param) {
|
||||
auto value = HAL_GetDMASampleDigitalSource(&dmaSamples[startIndex],
|
||||
dioHandle, &status);
|
||||
ASSERT_EQ(0, status);
|
||||
if (value)
|
||||
if (value) {
|
||||
break;
|
||||
}
|
||||
startIndex++;
|
||||
}
|
||||
ASSERT_LT(startIndex, 6);
|
||||
|
||||
@@ -23,8 +23,8 @@ model {
|
||||
enableCheckTask true
|
||||
javaCompileTasks << compileJava
|
||||
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.roborio)
|
||||
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.raspbian)
|
||||
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.aarch64bionic)
|
||||
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm32)
|
||||
jniCrossCompileOptions << JniCrossCompileOptions(nativeUtils.wpi.platforms.linuxarm64)
|
||||
|
||||
sources {
|
||||
cpp {
|
||||
@@ -180,7 +180,7 @@ model {
|
||||
components {
|
||||
examplesMap.each { key, value ->
|
||||
if (key == "usbviewer") {
|
||||
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) {
|
||||
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) {
|
||||
"${key}"(NativeExecutableSpec) {
|
||||
targetBuildTypes 'debug'
|
||||
binaries.all {
|
||||
@@ -189,7 +189,7 @@ model {
|
||||
lib project: ':wpigui', library: 'wpigui', linkage: 'static'
|
||||
lib library: 'cscore', linkage: 'shared'
|
||||
nativeUtils.useRequiredLibrary(it, 'imgui_static')
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) {
|
||||
it.buildable = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package edu.wpi.first.cscore;
|
||||
|
||||
/** USB camera information. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class UsbCameraInfo {
|
||||
/**
|
||||
* Create a new set of UsbCameraInfo.
|
||||
@@ -28,26 +29,20 @@ public class UsbCameraInfo {
|
||||
}
|
||||
|
||||
/** Device number (e.g. N in '/dev/videoN' on Linux). */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int dev;
|
||||
|
||||
/** Path to device if available (e.g. '/dev/video0' on Linux). */
|
||||
@SuppressWarnings("MemberName")
|
||||
public String path;
|
||||
|
||||
/** Vendor/model name of the camera as provided by the USB driver. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public String name;
|
||||
|
||||
/** Other path aliases to device (e.g. '/dev/v4l/by-id/...' etc on Linux). */
|
||||
@SuppressWarnings("MemberName")
|
||||
public String[] otherPaths;
|
||||
|
||||
/** USB vendor id. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int vendorId;
|
||||
|
||||
/** USB product id. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int productId;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package edu.wpi.first.cscore;
|
||||
|
||||
/** Video event. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class VideoEvent {
|
||||
public enum Kind {
|
||||
kUnknown(0x0000),
|
||||
@@ -117,39 +118,29 @@ public class VideoEvent {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public Kind kind;
|
||||
|
||||
// Valid for kSource* and kSink* respectively
|
||||
@SuppressWarnings("MemberName")
|
||||
public int sourceHandle;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public int sinkHandle;
|
||||
|
||||
// Source/sink/property name
|
||||
@SuppressWarnings("MemberName")
|
||||
public String name;
|
||||
|
||||
// Fields for kSourceVideoModeChanged event
|
||||
@SuppressWarnings("MemberName")
|
||||
public VideoMode mode;
|
||||
|
||||
// Fields for kSourceProperty* events
|
||||
@SuppressWarnings("MemberName")
|
||||
public int propertyHandle;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public VideoProperty.Kind propertyKind;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public int value;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public String valueStr;
|
||||
|
||||
// Listener that was triggered
|
||||
@SuppressWarnings("MemberName")
|
||||
public int listener;
|
||||
|
||||
public VideoSource getSource() {
|
||||
|
||||
@@ -64,7 +64,6 @@ public class VideoListener implements AutoCloseable {
|
||||
private static boolean s_waitQueue;
|
||||
private static final Condition s_waitQueueCond = s_lock.newCondition();
|
||||
|
||||
@SuppressWarnings("PMD.AvoidCatchingThrowable")
|
||||
private static void startThread() {
|
||||
s_thread =
|
||||
new Thread(
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package edu.wpi.first.cscore;
|
||||
|
||||
/** Video mode. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class VideoMode {
|
||||
public enum PixelFormat {
|
||||
kUnknown(0),
|
||||
@@ -62,18 +63,14 @@ public class VideoMode {
|
||||
}
|
||||
|
||||
/** Pixel format. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public PixelFormat pixelFormat;
|
||||
|
||||
/** Width in pixels. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int width;
|
||||
|
||||
/** Height in pixels. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int height;
|
||||
|
||||
/** Frames per second. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int fps;
|
||||
}
|
||||
|
||||
@@ -523,7 +523,8 @@ Image* Frame::GetImageImpl(int width, int height,
|
||||
|
||||
WPI_DEBUG4(Instance::GetInstance().logger,
|
||||
"converting image from {}x{} type {} to {}x{} type {}", cur->width,
|
||||
cur->height, cur->pixelFormat, width, height, pixelFormat);
|
||||
cur->height, static_cast<int>(cur->pixelFormat), width, height,
|
||||
static_cast<int>(pixelFormat));
|
||||
|
||||
// If the source image is a JPEG, we need to decode it before we can do
|
||||
// anything else with it. Note that if the destination format is JPEG, we
|
||||
|
||||
@@ -22,7 +22,9 @@ class Image {
|
||||
|
||||
public:
|
||||
#ifndef __linux__
|
||||
explicit Image(size_t capacity) { m_data.reserve(capacity); }
|
||||
explicit Image(size_t capacity) {
|
||||
m_data.reserve(capacity);
|
||||
}
|
||||
#else
|
||||
explicit Image(size_t capacity)
|
||||
: m_data{capacity, default_init_allocator<uchar>{}} {
|
||||
@@ -34,20 +36,38 @@ class Image {
|
||||
Image& operator=(const Image&) = delete;
|
||||
|
||||
// Getters
|
||||
operator std::string_view() const { return str(); } // NOLINT
|
||||
std::string_view str() const { return {data(), size()}; }
|
||||
size_t capacity() const { return m_data.capacity(); }
|
||||
operator std::string_view() const { // NOLINT
|
||||
return str();
|
||||
}
|
||||
std::string_view str() const {
|
||||
return {data(), size()};
|
||||
}
|
||||
size_t capacity() const {
|
||||
return m_data.capacity();
|
||||
}
|
||||
const char* data() const {
|
||||
return reinterpret_cast<const char*>(m_data.data());
|
||||
}
|
||||
char* data() { return reinterpret_cast<char*>(m_data.data()); }
|
||||
size_t size() const { return m_data.size(); }
|
||||
char* data() {
|
||||
return reinterpret_cast<char*>(m_data.data());
|
||||
}
|
||||
size_t size() const {
|
||||
return m_data.size();
|
||||
}
|
||||
|
||||
const std::vector<uchar>& vec() const { return m_data; }
|
||||
std::vector<uchar>& vec() { return m_data; }
|
||||
const std::vector<uchar>& vec() const {
|
||||
return m_data;
|
||||
}
|
||||
std::vector<uchar>& vec() {
|
||||
return m_data;
|
||||
}
|
||||
|
||||
void resize(size_t size) { m_data.resize(size); }
|
||||
void SetSize(size_t size) { m_data.resize(size); }
|
||||
void resize(size_t size) {
|
||||
m_data.resize(size);
|
||||
}
|
||||
void SetSize(size_t size) {
|
||||
m_data.resize(size);
|
||||
}
|
||||
|
||||
cv::Mat AsMat() {
|
||||
int type;
|
||||
@@ -68,7 +88,9 @@ class Image {
|
||||
return cv::Mat{height, width, type, m_data.data()};
|
||||
}
|
||||
|
||||
cv::_InputArray AsInputArray() { return cv::_InputArray{m_data}; }
|
||||
cv::_InputArray AsInputArray() {
|
||||
return cv::_InputArray{m_data};
|
||||
}
|
||||
|
||||
bool Is(int width_, int height_) {
|
||||
return width == width_ && height == height_;
|
||||
@@ -90,8 +112,12 @@ class Image {
|
||||
bool IsLarger(const Image& oth) {
|
||||
return width >= oth.width && height >= oth.height;
|
||||
}
|
||||
bool IsSmaller(int width_, int height_) { return !IsLarger(width_, height_); }
|
||||
bool IsSmaller(const Image& oth) { return !IsLarger(oth); }
|
||||
bool IsSmaller(int width_, int height_) {
|
||||
return !IsLarger(width_, height_);
|
||||
}
|
||||
bool IsSmaller(const Image& oth) {
|
||||
return !IsLarger(oth);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<uchar> m_data;
|
||||
|
||||
@@ -21,7 +21,7 @@ inline void NamedLog(wpi::Logger& logger, unsigned int level, const char* file,
|
||||
Args&&... args) {
|
||||
if (logger.HasLogger() && level >= logger.min_level()) {
|
||||
NamedLogV(logger, level, file, line, name, format,
|
||||
fmt::make_args_checked<Args...>(format, args...));
|
||||
fmt::make_format_args(args...));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ void MjpegServerImpl::ConnThread::SendJSON(wpi::raw_ostream& os,
|
||||
auto kind = source.GetPropertyKind(prop);
|
||||
fmt::print(os, "\n\"name\": \"{}\"", name);
|
||||
fmt::print(os, ",\n\"id\": \"{}\"", prop);
|
||||
fmt::print(os, ",\n\"type\": \"{}\"", kind);
|
||||
fmt::print(os, ",\n\"type\": \"{}\"", static_cast<int>(kind));
|
||||
fmt::print(os, ",\n\"min\": \"{}\"", source.GetPropertyMin(prop, &status));
|
||||
fmt::print(os, ",\n\"max\": \"{}\"", source.GetPropertyMax(prop, &status));
|
||||
fmt::print(os, ",\n\"step\": \"{}\"",
|
||||
|
||||
@@ -58,13 +58,13 @@ static std::string GetUsbNameFromFile(int vendor, int product) {
|
||||
// next vendor, but didn't match product?
|
||||
if (line[0] != '\t') {
|
||||
buf += "Unknown";
|
||||
return buf;
|
||||
return std::string{buf};
|
||||
}
|
||||
|
||||
// look for product
|
||||
if (wpi::starts_with(wpi::substr(line, 1), productStr)) {
|
||||
buf += wpi::trim(wpi::substr(line, 6));
|
||||
return buf;
|
||||
return std::string{buf};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,19 +279,23 @@ static bool IsPercentageProperty(std::string_view name) {
|
||||
|
||||
void UsbCameraImpl::ProcessFrame(IMFSample* videoSample,
|
||||
const VideoMode& mode) {
|
||||
if (!videoSample)
|
||||
if (!videoSample) {
|
||||
return;
|
||||
}
|
||||
|
||||
ComPtr<IMFMediaBuffer> buf;
|
||||
|
||||
if (!SUCCEEDED(videoSample->ConvertToContiguousBuffer(buf.GetAddressOf()))) {
|
||||
DWORD bcnt = 0;
|
||||
if (!SUCCEEDED(videoSample->GetBufferCount(&bcnt)))
|
||||
if (!SUCCEEDED(videoSample->GetBufferCount(&bcnt))) {
|
||||
return;
|
||||
if (bcnt == 0)
|
||||
}
|
||||
if (bcnt == 0) {
|
||||
return;
|
||||
if (!SUCCEEDED(videoSample->GetBufferByIndex(0, buf.GetAddressOf())))
|
||||
}
|
||||
if (!SUCCEEDED(videoSample->GetBufferByIndex(0, buf.GetAddressOf()))) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BYTE* ptr = NULL;
|
||||
@@ -474,11 +478,13 @@ static cs::VideoMode::PixelFormat GetFromGUID(const GUID& guid) {
|
||||
}
|
||||
|
||||
bool UsbCameraImpl::DeviceConnect() {
|
||||
if (m_mediaSource && m_sourceReader)
|
||||
if (m_mediaSource && m_sourceReader) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (m_connectVerbose)
|
||||
if (m_connectVerbose) {
|
||||
SINFO("Connecting to USB camera on {}", m_path);
|
||||
}
|
||||
|
||||
SDEBUG3("{}", "opening device");
|
||||
|
||||
@@ -580,8 +586,9 @@ template void UsbCameraImpl::DeviceAddProperty(std::string_view name_,
|
||||
DeviceAddProperty(#val, CameraControl_##val, pCamControl);
|
||||
|
||||
void UsbCameraImpl::DeviceCacheProperties() {
|
||||
if (!m_sourceReader)
|
||||
if (!m_sourceReader) {
|
||||
return;
|
||||
}
|
||||
|
||||
IAMVideoProcAmp* pProcAmp = NULL;
|
||||
|
||||
@@ -778,22 +785,25 @@ CS_StatusValue UsbCameraImpl::DeviceCmdSetProperty(
|
||||
|
||||
// Look up
|
||||
auto prop = static_cast<UsbCameraProperty*>(GetProperty(property));
|
||||
if (!prop)
|
||||
if (!prop) {
|
||||
return CS_INVALID_PROPERTY;
|
||||
}
|
||||
|
||||
// If setting before we get, guess initial type based on set
|
||||
if (prop->propKind == CS_PROP_NONE) {
|
||||
if (setString)
|
||||
if (setString) {
|
||||
prop->propKind = CS_PROP_STRING;
|
||||
else
|
||||
} else {
|
||||
prop->propKind = CS_PROP_INTEGER;
|
||||
}
|
||||
}
|
||||
|
||||
// Check kind match
|
||||
if ((setString && prop->propKind != CS_PROP_STRING) ||
|
||||
(!setString && (prop->propKind &
|
||||
(CS_PROP_BOOLEAN | CS_PROP_INTEGER | CS_PROP_ENUM)) == 0))
|
||||
(!setString && (prop->propKind & (CS_PROP_BOOLEAN | CS_PROP_INTEGER |
|
||||
CS_PROP_ENUM)) == 0)) {
|
||||
return CS_WRONG_PROPERTY_TYPE;
|
||||
}
|
||||
|
||||
// Handle percentage property
|
||||
int percentageProperty = prop->propPair;
|
||||
@@ -810,8 +820,9 @@ CS_StatusValue UsbCameraImpl::DeviceCmdSetProperty(
|
||||
|
||||
// Actually set the new value on the device (if possible)
|
||||
if (!prop->device) {
|
||||
if (prop->id == kPropConnectVerboseId)
|
||||
if (prop->id == kPropConnectVerboseId) {
|
||||
m_connectVerbose = value;
|
||||
}
|
||||
} else {
|
||||
if (!prop->DeviceSet(lock, m_sourceReader.Get())) {
|
||||
return CS_PROPERTY_WRITE_FAILED;
|
||||
@@ -913,11 +924,13 @@ bool UsbCameraImpl::DeviceStreamOff() {
|
||||
}
|
||||
|
||||
void UsbCameraImpl::DeviceCacheMode() {
|
||||
if (!m_sourceReader)
|
||||
if (!m_sourceReader) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_windowsVideoModes.size() == 0)
|
||||
if (m_windowsVideoModes.size() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_currentMode) {
|
||||
// First, see if our set mode is valid
|
||||
@@ -982,8 +995,9 @@ CS_StatusValue UsbCameraImpl::DeviceSetMode() {
|
||||
}
|
||||
|
||||
void UsbCameraImpl::DeviceCacheVideoModes() {
|
||||
if (!m_sourceReader)
|
||||
if (!m_sourceReader) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<VideoMode> modes;
|
||||
m_windowsVideoModes.clear();
|
||||
@@ -1098,13 +1112,13 @@ std::vector<UsbCameraInfo> EnumerateUsbCameras(CS_Status* status) {
|
||||
sizeof(buf) / sizeof(WCHAR), &characters);
|
||||
storage.clear();
|
||||
wpi::sys::windows::UTF16ToUTF8(buf, characters, storage);
|
||||
info.name = storage.string();
|
||||
info.name = std::string{storage};
|
||||
ppDevices[i]->GetString(
|
||||
MF_DEVSOURCE_ATTRIBUTE_SOURCE_TYPE_VIDCAP_SYMBOLIC_LINK, buf,
|
||||
sizeof(buf) / sizeof(WCHAR), &characters);
|
||||
storage.clear();
|
||||
wpi::sys::windows::UTF16ToUTF8(buf, characters, storage);
|
||||
info.path = storage.string();
|
||||
info.path = std::string{storage};
|
||||
|
||||
// Try to parse path from symbolic link
|
||||
ParseVidAndPid(info.path, &info.productId, &info.vendorId);
|
||||
|
||||
@@ -96,10 +96,10 @@ class UsbCameraImpl : public SourceImpl,
|
||||
};
|
||||
|
||||
explicit Message(Kind kind_)
|
||||
: kind(kind_), data{0}, from(std::this_thread::get_id()) {}
|
||||
: kind(kind_), from(std::this_thread::get_id()) {}
|
||||
|
||||
Kind kind;
|
||||
int data[4];
|
||||
int data[4]{0};
|
||||
std::string dataStr;
|
||||
std::thread::id from;
|
||||
};
|
||||
|
||||
@@ -40,8 +40,9 @@ UsbCameraProperty::UsbCameraProperty(std::string_view name_,
|
||||
|
||||
bool UsbCameraProperty::DeviceGet(std::unique_lock<wpi::mutex>& lock,
|
||||
IAMVideoProcAmp* pProcAmp) {
|
||||
if (!pProcAmp)
|
||||
if (!pProcAmp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
long newValue = 0, paramFlag = 0; // NOLINT(runtime/int)
|
||||
@@ -60,8 +61,9 @@ bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock,
|
||||
bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock,
|
||||
IAMVideoProcAmp* pProcAmp,
|
||||
int newValue) const {
|
||||
if (!pProcAmp)
|
||||
if (!pProcAmp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
if (SUCCEEDED(
|
||||
@@ -104,8 +106,9 @@ UsbCameraProperty::UsbCameraProperty(std::string_view name_,
|
||||
|
||||
bool UsbCameraProperty::DeviceGet(std::unique_lock<wpi::mutex>& lock,
|
||||
IAMCameraControl* pProcAmp) {
|
||||
if (!pProcAmp)
|
||||
if (!pProcAmp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
long newValue = 0, paramFlag = 0; // NOLINT(runtime/int)
|
||||
@@ -124,8 +127,9 @@ bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock,
|
||||
bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock,
|
||||
IAMCameraControl* pProcAmp,
|
||||
int newValue) const {
|
||||
if (!pProcAmp)
|
||||
if (!pProcAmp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
if (SUCCEEDED(pProcAmp->Set(tagCameraControl, newValue,
|
||||
@@ -139,8 +143,9 @@ bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock,
|
||||
|
||||
bool UsbCameraProperty::DeviceGet(std::unique_lock<wpi::mutex>& lock,
|
||||
IMFSourceReader* sourceReader) {
|
||||
if (!sourceReader)
|
||||
if (!sourceReader) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isControlProperty) {
|
||||
ComPtr<IAMCameraControl> pProcAmp;
|
||||
@@ -169,8 +174,9 @@ bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock,
|
||||
bool UsbCameraProperty::DeviceSet(std::unique_lock<wpi::mutex>& lock,
|
||||
IMFSourceReader* sourceReader,
|
||||
int newValue) const {
|
||||
if (!sourceReader)
|
||||
if (!sourceReader) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isControlProperty) {
|
||||
ComPtr<IAMCameraControl> pProcAmp;
|
||||
|
||||
@@ -20,7 +20,7 @@ endif()
|
||||
add_executable(datalogtool ${datalogtool_src} ${datalogtool_resources_src} ${datalogtool_rc} ${APP_ICON_MACOSX})
|
||||
wpilib_link_macos_gui(datalogtool)
|
||||
target_link_libraries(datalogtool libglass ${LIBSSH_LIBRARIES})
|
||||
target_include_directories(datalogtool PRIVATE ${LIBSSH_INCLUDE_DIRS})
|
||||
target_include_directories(datalogtool SYSTEM PRIVATE ${LIBSSH_INCLUDE_DIRS})
|
||||
|
||||
if (WIN32)
|
||||
set_target_properties(datalogtool PROPERTIES WIN32_EXECUTABLE YES)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) {
|
||||
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) {
|
||||
|
||||
description = "roboRIO Team Number Setter"
|
||||
|
||||
@@ -27,12 +27,12 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra
|
||||
nativeUtils {
|
||||
nativeDependencyContainer {
|
||||
libssh(getNativeDependencyTypeClass('WPIStaticMavenDependency')) {
|
||||
groupId = "edu.wpi.first.thirdparty.frc2022"
|
||||
groupId = "edu.wpi.first.thirdparty.frc2023"
|
||||
artifactId = "libssh"
|
||||
headerClassifier = "headers"
|
||||
sourceClassifier = "sources"
|
||||
ext = "zip"
|
||||
version = '0.95-1'
|
||||
version = '0.95-3'
|
||||
targetPlatforms.addAll(nativeUtils.wpi.platforms.desktopPlatforms)
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra
|
||||
}
|
||||
}
|
||||
binaries.all {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) {
|
||||
it.buildable = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ model {
|
||||
tasks {
|
||||
// Create the run task.
|
||||
$.components.datalogtool.binaries.each { bin ->
|
||||
if (bin.buildable && bin.name.toLowerCase().contains("debug")) {
|
||||
if (bin.buildable && bin.name.toLowerCase().contains("debug") && nativeUtils.isNativeDesktopPlatform(bin.targetPlatform)) {
|
||||
Task run = project.tasks.create("run", Exec) {
|
||||
commandLine bin.tasks.install.runScriptFile.get().asFile.toString()
|
||||
}
|
||||
@@ -30,10 +30,10 @@ model {
|
||||
def icon = file("$project.projectDir/src/main/native/mac/datalogtool.icns")
|
||||
|
||||
// Create the macOS bundle.
|
||||
def bundleTask = project.tasks.create("bundleDataLogToolOsxApp", Copy) {
|
||||
def bundleTask = project.tasks.create("bundleDataLogToolOsxApp" + binary.targetPlatform.architecture.name, Copy) {
|
||||
description("Creates a macOS application bundle for DataLogTool")
|
||||
from(file("$project.projectDir/Info.plist"))
|
||||
into(file("$project.buildDir/outputs/bundles/DataLogTool.app/Contents"))
|
||||
into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/DataLogTool.app/Contents"))
|
||||
into("MacOS") { with copySpec { from binary.executable.file } }
|
||||
into("Resources") { with copySpec { from icon } }
|
||||
|
||||
@@ -48,7 +48,7 @@ model {
|
||||
"codesign --force --strict --deep " +
|
||||
"--timestamp --options=runtime " +
|
||||
"--verbose -s ${project.findProperty("developerID")} " +
|
||||
"$project.buildDir/outputs/bundles/DataLogTool.app/"
|
||||
"$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/DataLogTool.app/"
|
||||
]
|
||||
commandLine args
|
||||
}
|
||||
@@ -58,12 +58,12 @@ model {
|
||||
|
||||
// Reset the application path if we are creating a bundle.
|
||||
if (binary.targetPlatform.operatingSystem.isMacOsX()) {
|
||||
applicationPath = file("$project.buildDir/outputs/bundles")
|
||||
applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name")
|
||||
project.build.dependsOn bundleTask
|
||||
}
|
||||
|
||||
// Create the ZIP.
|
||||
def task = project.tasks.create("copyDataLogToolExecutable", Zip) {
|
||||
def task = project.tasks.create("copyDataLogToolExecutable" + binary.targetPlatform.architecture.name, Zip) {
|
||||
description("Copies the DataLogTool executable to the outputs directory.")
|
||||
destinationDirectory = outputsFolder
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ cppProjectZips.add(project(':wpilibNewCommands').cppHeadersZip)
|
||||
|
||||
doxygen {
|
||||
executables {
|
||||
doxygen version : '1.9.2',
|
||||
doxygen version : '1.9.4',
|
||||
baseURI : 'https://frcmaven.wpi.edu/artifactory/generic-release-mirror/doxygen'
|
||||
}
|
||||
}
|
||||
@@ -115,6 +115,9 @@ doxygen {
|
||||
// json
|
||||
exclude 'wpi/json.h'
|
||||
|
||||
// memory
|
||||
exclude 'wpi/memory/**'
|
||||
|
||||
// mpack
|
||||
exclude 'wpi/mpack.h'
|
||||
|
||||
|
||||
@@ -7,6 +7,9 @@ if (WITH_JAVA)
|
||||
find_package(Java REQUIRED)
|
||||
include(UseJava)
|
||||
|
||||
file(GLOB JACKSON_JARS "${WPILIB_BINARY_DIR}/wpiutil/thirdparty/jackson/*.jar")
|
||||
set(CMAKE_JAVA_INCLUDE_PATH fieldImages.jar ${JACKSON_JARS})
|
||||
|
||||
file(GLOB_RECURSE JAVA_SOURCES src/main/java/*.java)
|
||||
file(GLOB_RECURSE JAVA_RESOURCES src/main/native/resources/*.json src/main/native/resources/*.png src/main/native/resources/*.jpg)
|
||||
add_jar(field_images_jar SOURCES ${JAVA_SOURCES} RESOURCES NAMESPACE "edu/wpi/first/fields" ${JAVA_RESOURCES} OUTPUT_NAME fieldImages)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) {
|
||||
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) {
|
||||
|
||||
apply plugin: 'cpp'
|
||||
apply plugin: 'c'
|
||||
@@ -13,6 +13,12 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra
|
||||
apply plugin: 'windows-resources'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation "com.fasterxml.jackson.core:jackson-annotations:2.12.4"
|
||||
implementation "com.fasterxml.jackson.core:jackson-core:2.12.4"
|
||||
implementation "com.fasterxml.jackson.core:jackson-databind:2.12.4"
|
||||
}
|
||||
|
||||
ext {
|
||||
nativeName = 'fieldImages'
|
||||
baseId = nativeName
|
||||
|
||||
90
fieldImages/src/main/java/edu/wpi/fields/FieldConfig.java
Normal file
90
fieldImages/src/main/java/edu/wpi/fields/FieldConfig.java
Normal file
@@ -0,0 +1,90 @@
|
||||
// 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.fields;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class FieldConfig {
|
||||
public static class Corners {
|
||||
@JsonProperty("top-left")
|
||||
public double[] m_topLeft;
|
||||
|
||||
@JsonProperty("bottom-right")
|
||||
public double[] m_bottomRight;
|
||||
}
|
||||
|
||||
@JsonProperty("game")
|
||||
public String m_game;
|
||||
|
||||
@JsonProperty("field-image")
|
||||
public String m_fieldImage;
|
||||
|
||||
@JsonProperty("field-corners")
|
||||
public Corners m_fieldCorners;
|
||||
|
||||
@JsonProperty("field-size")
|
||||
public double[] m_fieldSize;
|
||||
|
||||
@JsonProperty("field-unit")
|
||||
public String m_fieldUnit;
|
||||
|
||||
public FieldConfig() {}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public URL getImageUrl() {
|
||||
return getClass().getResource(Fields.kBaseResourceDir + m_fieldImage);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public InputStream getImageAsStream() {
|
||||
return getClass().getResourceAsStream(Fields.kBaseResourceDir + m_fieldImage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a predefined field configuration from a resource file.
|
||||
*
|
||||
* @param field The predefined field
|
||||
* @return The field configuration
|
||||
* @throws IOException Throws if the file could not be loaded
|
||||
*/
|
||||
public static FieldConfig loadField(Fields field) throws IOException {
|
||||
return loadFromResource(field.m_resourceFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a field configuration from a file on disk.
|
||||
*
|
||||
* @param file The json file to load
|
||||
* @return The field configuration
|
||||
* @throws IOException Throws if the file could not be loaded
|
||||
*/
|
||||
public static FieldConfig loadFromFile(Path file) throws IOException {
|
||||
try (BufferedReader reader = Files.newBufferedReader(file)) {
|
||||
return new ObjectMapper().readerFor(FieldConfig.class).readValue(reader);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a field configuration from a resource file located inside the programs jar file.
|
||||
*
|
||||
* @param resourcePath The path to the resource file
|
||||
* @return The field configuration
|
||||
* @throws IOException Throws if the resoure could not be loaded
|
||||
*/
|
||||
public static FieldConfig loadFromResource(String resourcePath) throws IOException {
|
||||
try (InputStream stream = FieldConfig.class.getResourceAsStream(resourcePath);
|
||||
InputStreamReader reader = new InputStreamReader(stream)) {
|
||||
return new ObjectMapper().readerFor(FieldConfig.class).readValue(reader);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// 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.fields;
|
||||
|
||||
public class FieldImages {
|
||||
public static final String k2018PowerUpFieldConfig = "/edu/wpi/first/fields/2018-powerup.json";
|
||||
public static final String k2019DeepSpaceFieldConfig =
|
||||
"/edu/wpi/first/fields/2019-deepspace.json";
|
||||
public static final String k2020InfiniteRechargeFieldConfig =
|
||||
"/edu/wpi/first/fields/2020-infiniterecharge.json";
|
||||
public static final String k2021InfiniteRechargeFieldConfig =
|
||||
"/edu/wpi/first/fields/2021-infiniterecharge.json";
|
||||
public static final String k2021BarrelFieldConfig =
|
||||
"/edu/wpi/first/fields/2021-barrelracingpath.json";
|
||||
public static final String k2021BounceFieldConfig = "/edu/wpi/first/fields/2021-bouncepath.json";
|
||||
public static final String k2021GalacticSearchAFieldConfig =
|
||||
"/edu/wpi/first/fields/2021-galacticsearcha.json";
|
||||
public static final String k2021GalacticSearchBFieldConfig =
|
||||
"/edu/wpi/first/fields/2021-galacticsearchb.json";
|
||||
public static final String k2021SlalomFieldConfig = "/edu/wpi/first/fields/2021-slalompath.json";
|
||||
public static final String k2022RapidReactFieldConfig =
|
||||
"/edu/wpi/first/fields/2022-rapidreact.json";
|
||||
}
|
||||
29
fieldImages/src/main/java/edu/wpi/fields/Fields.java
Normal file
29
fieldImages/src/main/java/edu/wpi/fields/Fields.java
Normal file
@@ -0,0 +1,29 @@
|
||||
// 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.fields;
|
||||
|
||||
public enum Fields {
|
||||
k2018PowerUp("2018-powerup.json"),
|
||||
k2019DeepSpace("2019-deepspace.json"),
|
||||
k2020InfiniteRecharge("2020-infiniterecharge.json"),
|
||||
k2021InfiniteRecharge("2021-infiniterecharge.json"),
|
||||
k2021Barrel("2021-barrelracingpath.json"),
|
||||
k2021Bounce("2021-bouncepath.json"),
|
||||
k2021GalacticSearchA("2021-galacticsearcha.json"),
|
||||
k2021GalacticSearchB("2021-galacticsearchb.json"),
|
||||
k2021Slalom("2021-slalompath.json"),
|
||||
k2022RapidReact("2022-rapidreact.json");
|
||||
|
||||
public static final String kBaseResourceDir = "/edu/wpi/first/fields/";
|
||||
|
||||
/** Alias to the current game. */
|
||||
public static final Fields kDefaultField = k2022RapidReact;
|
||||
|
||||
public final String m_resourceFile;
|
||||
|
||||
Fields(String resourceFile) {
|
||||
m_resourceFile = kBaseResourceDir + resourceFile;
|
||||
}
|
||||
}
|
||||
19
fieldImages/src/test/java/edu/wpi/fields/LoadConfigTest.java
Normal file
19
fieldImages/src/test/java/edu/wpi/fields/LoadConfigTest.java
Normal file
@@ -0,0 +1,19 @@
|
||||
// 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.fields;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.EnumSource;
|
||||
|
||||
class LoadConfigTest {
|
||||
@ParameterizedTest
|
||||
@EnumSource(Fields.class)
|
||||
void testLoad(Fields field) {
|
||||
FieldConfig config = Assertions.assertDoesNotThrow(() -> FieldConfig.loadField(field));
|
||||
|
||||
Assertions.assertNotNull(config.getImageUrl());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
|
||||
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxraspbian') && !project.hasProperty('onlylinuxaarch64bionic')) {
|
||||
if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxarm32') && !project.hasProperty('onlylinuxarm64')) {
|
||||
|
||||
description = "A different kind of dashboard"
|
||||
|
||||
@@ -100,7 +100,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra
|
||||
}
|
||||
}
|
||||
binaries.all {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) {
|
||||
it.buildable = false
|
||||
return
|
||||
}
|
||||
@@ -128,7 +128,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra
|
||||
}
|
||||
}
|
||||
binaries.all {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) {
|
||||
it.buildable = false
|
||||
return
|
||||
}
|
||||
@@ -169,7 +169,7 @@ if (!project.hasProperty('onlylinuxathena') && !project.hasProperty('onlylinuxra
|
||||
}
|
||||
}
|
||||
binaries.all {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.raspbian || it.targetPlatform.name == nativeUtils.wpi.platforms.aarch64bionic) {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm32 || it.targetPlatform.name == nativeUtils.wpi.platforms.linuxarm64) {
|
||||
it.buildable = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -64,7 +64,8 @@ model {
|
||||
tasks {
|
||||
// Create the run task.
|
||||
$.components.glassApp.binaries.each { bin ->
|
||||
if (bin.buildable && bin.name.toLowerCase().contains("debug")) {
|
||||
if (bin.buildable && bin.name.toLowerCase().contains("debug") && nativeUtils.isNativeDesktopPlatform(bin.targetPlatform)) {
|
||||
|
||||
Task run = project.tasks.create("run", Exec) {
|
||||
commandLine bin.tasks.install.runScriptFile.get().asFile.toString()
|
||||
}
|
||||
@@ -84,10 +85,10 @@ model {
|
||||
def icon = file("$project.projectDir/src/app/native/mac/glass.icns")
|
||||
|
||||
// Create the macOS bundle.
|
||||
def bundleTask = project.tasks.create("bundleGlassOsxApp", Copy) {
|
||||
def bundleTask = project.tasks.create("bundleGlassOsxApp" + binary.targetPlatform.architecture.name, Copy) {
|
||||
description("Creates a macOS application bundle for Glass")
|
||||
from(file("$project.projectDir/Info.plist"))
|
||||
into(file("$project.buildDir/outputs/bundles/Glass.app/Contents"))
|
||||
into(file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/Glass.app/Contents"))
|
||||
into("MacOS") { with copySpec { from binary.executable.file } }
|
||||
into("Resources") { with copySpec { from icon } }
|
||||
|
||||
@@ -102,7 +103,7 @@ model {
|
||||
"codesign --force --strict --deep " +
|
||||
"--timestamp --options=runtime " +
|
||||
"--verbose -s ${project.findProperty("developerID")} " +
|
||||
"$project.buildDir/outputs/bundles/Glass.app/"
|
||||
"$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name/Glass.app/"
|
||||
]
|
||||
commandLine args
|
||||
}
|
||||
@@ -112,12 +113,12 @@ model {
|
||||
|
||||
// Reset the application path if we are creating a bundle.
|
||||
if (binary.targetPlatform.operatingSystem.isMacOsX()) {
|
||||
applicationPath = file("$project.buildDir/outputs/bundles")
|
||||
applicationPath = file("$project.buildDir/outputs/bundles/$binary.targetPlatform.architecture.name")
|
||||
project.build.dependsOn bundleTask
|
||||
}
|
||||
|
||||
// Create the ZIP.
|
||||
def task = project.tasks.create("copyGlassExecutable", Zip) {
|
||||
def task = project.tasks.create("copyGlassExecutable" + binary.targetPlatform.architecture.name, Zip) {
|
||||
description("Copies the Glass executable to the outputs directory.")
|
||||
destinationDirectory = outputsFolder
|
||||
|
||||
|
||||
@@ -179,6 +179,11 @@ int main(int argc, char** argv) {
|
||||
gui::AddIcon(glass::GetResource_glass_256_png());
|
||||
gui::AddIcon(glass::GetResource_glass_512_png());
|
||||
|
||||
gui::AddEarlyExecute(
|
||||
[] { ImGui::DockSpaceOverViewport(ImGui::GetMainViewport()); });
|
||||
|
||||
gui::AddInit([] { ImGui::GetIO().ConfigDockingWithShift = true; });
|
||||
|
||||
gPlotProvider = std::make_unique<glass::PlotProvider>(
|
||||
glass::GetStorageRoot().GetChild("Plots"));
|
||||
gNtProvider = std::make_unique<glass::NetworkTablesProvider>(
|
||||
@@ -291,7 +296,8 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
});
|
||||
|
||||
gui::Initialize("Glass - DISCONNECTED", 1024, 768);
|
||||
gui::Initialize("Glass - DISCONNECTED", 1024, 768,
|
||||
ImGuiConfigFlags_DockingEnable);
|
||||
gEnterKey = &glass::GetStorageRoot().GetInt("enterKey", GLFW_KEY_ENTER);
|
||||
if (auto win = gui::GetSystemWindow()) {
|
||||
gPrevKeyCallback = glfwSetKeyCallback(win, RemapEnterKeyCallback);
|
||||
|
||||
@@ -69,6 +69,9 @@ static bool JsonToWindow(const wpi::json& jfile, const char* filename) {
|
||||
wpi::raw_string_ostream ini{iniStr};
|
||||
|
||||
for (auto&& jsection : jfile.items()) {
|
||||
if (jsection.key() == "Docking") {
|
||||
continue;
|
||||
}
|
||||
if (!jsection.value().is_object()) {
|
||||
ImGui::LogText("%s section %s is not object", filename,
|
||||
jsection.key().c_str());
|
||||
@@ -95,6 +98,31 @@ static bool JsonToWindow(const wpi::json& jfile, const char* filename) {
|
||||
ini << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
// emit Docking section last
|
||||
auto docking = jfile.find("Docking");
|
||||
if (docking != jfile.end()) {
|
||||
for (auto&& jsubsection : docking->items()) {
|
||||
if (!jsubsection.value().is_array()) {
|
||||
ImGui::LogText("%s section %s subsection %s is not array", filename,
|
||||
"Docking", jsubsection.key().c_str());
|
||||
return false;
|
||||
}
|
||||
ini << "[Docking][" << jsubsection.key() << "]\n";
|
||||
for (auto&& jv : jsubsection.value()) {
|
||||
try {
|
||||
auto& value = jv.get_ref<const std::string&>();
|
||||
ini << value << "\n";
|
||||
} catch (wpi::json::exception&) {
|
||||
ImGui::LogText("%s section %s subsection %s value is not string",
|
||||
filename, "Docking", jsubsection.key().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
ini << '\n';
|
||||
}
|
||||
}
|
||||
|
||||
ini.flush();
|
||||
|
||||
ImGui::LoadIniSettingsFromMemory(iniStr.data(), iniStr.size());
|
||||
@@ -204,7 +232,11 @@ static wpi::json WindowToJson() {
|
||||
}
|
||||
curSection = &jsection[subsection];
|
||||
if (curSection->is_null()) {
|
||||
*curSection = wpi::json::object();
|
||||
if (section == "Docking") {
|
||||
*curSection = wpi::json::array();
|
||||
} else {
|
||||
*curSection = wpi::json::object();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// value
|
||||
@@ -212,7 +244,11 @@ static wpi::json WindowToJson() {
|
||||
continue; // shouldn't happen, but just in case
|
||||
}
|
||||
auto [name, value] = wpi::split(line, '=');
|
||||
(*curSection)[name] = value;
|
||||
if (curSection->is_object()) {
|
||||
(*curSection)[name] = value;
|
||||
} else if (curSection->is_array()) {
|
||||
curSection->emplace_back(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,6 @@ class Plot {
|
||||
bool& m_legendHorizontal;
|
||||
int& m_legendLocation;
|
||||
bool& m_crosshairs;
|
||||
bool& m_antialiased;
|
||||
bool& m_mousePosition;
|
||||
bool& m_yAxis2;
|
||||
bool& m_yAxis3;
|
||||
@@ -327,7 +326,7 @@ PlotSeries::Action PlotSeries::EmitPlot(PlotView& view, double now, size_t i,
|
||||
int offset;
|
||||
};
|
||||
GetterData getterData = {now, GetZeroTime() * 1.0e-6, m_data, size, offset};
|
||||
auto getter = [](void* data, int idx) {
|
||||
auto getter = [](int idx, void* data) {
|
||||
auto d = static_cast<GetterData*>(data);
|
||||
if (idx == d->size) {
|
||||
return ImPlotPoint{
|
||||
@@ -487,7 +486,6 @@ Plot::Plot(Storage& storage)
|
||||
m_legendLocation{
|
||||
storage.GetInt("legendLocation", ImPlotLocation_NorthWest)},
|
||||
m_crosshairs{storage.GetBool("crosshairs", false)},
|
||||
m_antialiased{storage.GetBool("antialiased", false)},
|
||||
m_mousePosition{storage.GetBool("mousePosition", true)},
|
||||
m_yAxis2{storage.GetBool("yaxis2", false)},
|
||||
m_yAxis3{storage.GetBool("yaxis3", false)},
|
||||
@@ -573,7 +571,6 @@ void Plot::EmitPlot(PlotView& view, double now, bool paused, size_t i) {
|
||||
static_cast<int>(i));
|
||||
ImPlotFlags plotFlags = (m_legend ? 0 : ImPlotFlags_NoLegend) |
|
||||
(m_crosshairs ? ImPlotFlags_Crosshairs : 0) |
|
||||
(m_antialiased ? ImPlotFlags_AntiAliased : 0) |
|
||||
(m_mousePosition ? 0 : ImPlotFlags_NoMouseText);
|
||||
|
||||
if (ImPlot::BeginPlot(label, ImVec2(-1, m_height), plotFlags)) {
|
||||
@@ -608,7 +605,6 @@ void Plot::EmitPlot(PlotView& view, double now, bool paused, size_t i) {
|
||||
(m_axis[i].lockMin ? ImPlotAxisFlags_LockMin : 0) |
|
||||
(m_axis[i].lockMax ? ImPlotAxisFlags_LockMax : 0) |
|
||||
(m_axis[i].autoFit ? ImPlotAxisFlags_AutoFit : 0) |
|
||||
(m_axis[i].logScale ? ImPlotAxisFlags_AutoFit : 0) |
|
||||
(m_axis[i].invert ? ImPlotAxisFlags_Invert : 0) |
|
||||
(m_axis[i].opposite ? ImPlotAxisFlags_Opposite : 0) |
|
||||
(m_axis[i].gridLines ? 0 : ImPlotAxisFlags_NoGridLines) |
|
||||
@@ -620,6 +616,9 @@ void Plot::EmitPlot(PlotView& view, double now, bool paused, size_t i) {
|
||||
ImPlot::SetupAxisLimits(
|
||||
ImAxis_Y1 + i, m_axis[i].min, m_axis[i].max,
|
||||
m_axis[i].apply ? ImGuiCond_Always : ImGuiCond_Once);
|
||||
ImPlot::SetupAxisScale(ImAxis_Y1 + i, m_axis[i].logScale
|
||||
? ImPlotScale_Log10
|
||||
: ImPlotScale_Linear);
|
||||
m_axis[i].apply = false;
|
||||
}
|
||||
|
||||
@@ -656,7 +655,6 @@ void Plot::EmitPlot(PlotView& view, double now, bool paused, size_t i) {
|
||||
// copy plot settings back to storage
|
||||
m_legend = (plot->Flags & ImPlotFlags_NoLegend) == 0;
|
||||
m_crosshairs = (plot->Flags & ImPlotFlags_Crosshairs) != 0;
|
||||
m_antialiased = (plot->Flags & ImPlotFlags_AntiAliased) != 0;
|
||||
m_legendOutside =
|
||||
(plot->Items.Legend.Flags & ImPlotLegendFlags_Outside) != 0;
|
||||
m_legendHorizontal =
|
||||
@@ -671,12 +669,12 @@ void Plot::EmitPlot(PlotView& view, double now, bool paused, size_t i) {
|
||||
m_axis[i].lockMin = (flags & ImPlotAxisFlags_LockMin) != 0;
|
||||
m_axis[i].lockMax = (flags & ImPlotAxisFlags_LockMax) != 0;
|
||||
m_axis[i].autoFit = (flags & ImPlotAxisFlags_AutoFit) != 0;
|
||||
m_axis[i].logScale = (flags & ImPlotAxisFlags_LogScale) != 0;
|
||||
m_axis[i].invert = (flags & ImPlotAxisFlags_Invert) != 0;
|
||||
m_axis[i].opposite = (flags & ImPlotAxisFlags_Opposite) != 0;
|
||||
m_axis[i].gridLines = (flags & ImPlotAxisFlags_NoGridLines) == 0;
|
||||
m_axis[i].tickMarks = (flags & ImPlotAxisFlags_NoTickMarks) == 0;
|
||||
m_axis[i].tickLabels = (flags & ImPlotAxisFlags_NoTickLabels) == 0;
|
||||
m_axis[i].logScale = plot->Axes[ImAxis_Y1 + i].Scale == ImPlotScale_Log10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,7 +368,8 @@ static std::shared_ptr<nt::Value> StringToStringArray(std::string_view in) {
|
||||
return nt::NetworkTableValue::MakeStringArray(std::move(out));
|
||||
}
|
||||
|
||||
static void EmitEntryValueReadonly(NetworkTablesModel::Entry& entry) {
|
||||
static void EmitEntryValueReadonly(NetworkTablesModel::Entry& entry,
|
||||
NetworkTablesFlags flags) {
|
||||
auto& val = entry.value;
|
||||
if (!val) {
|
||||
return;
|
||||
@@ -378,9 +379,20 @@ static void EmitEntryValueReadonly(NetworkTablesModel::Entry& entry) {
|
||||
case NT_BOOLEAN:
|
||||
ImGui::LabelText("boolean", "%s", val->GetBoolean() ? "true" : "false");
|
||||
break;
|
||||
case NT_DOUBLE:
|
||||
ImGui::LabelText("double", "%.6f", val->GetDouble());
|
||||
case NT_DOUBLE: {
|
||||
unsigned char precision = (flags & NetworkTablesFlags_Precision) >>
|
||||
kNetworkTablesFlags_PrecisionBitShift;
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
ImGui::LabelText("double", fmt::format("%.{}f", precision).c_str(),
|
||||
val->GetDouble());
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case NT_STRING: {
|
||||
// GetString() comes from a std::string, so it's null terminated
|
||||
ImGui::LabelText("string", "%s", val->GetString().data());
|
||||
@@ -417,7 +429,8 @@ static char* GetTextBuffer(std::string_view in) {
|
||||
return textBuffer;
|
||||
}
|
||||
|
||||
static void EmitEntryValueEditable(NetworkTablesModel::Entry& entry) {
|
||||
static void EmitEntryValueEditable(NetworkTablesModel::Entry& entry,
|
||||
NetworkTablesFlags flags) {
|
||||
auto& val = entry.value;
|
||||
if (!val) {
|
||||
return;
|
||||
@@ -435,10 +448,20 @@ static void EmitEntryValueEditable(NetworkTablesModel::Entry& entry) {
|
||||
}
|
||||
case NT_DOUBLE: {
|
||||
double v = val->GetDouble();
|
||||
if (ImGui::InputDouble("double", &v, 0, 0, "%.6f",
|
||||
unsigned char precision = (flags & NetworkTablesFlags_Precision) >>
|
||||
kNetworkTablesFlags_PrecisionBitShift;
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
|
||||
#endif
|
||||
if (ImGui::InputDouble("double", &v, 0, 0,
|
||||
fmt::format("%.{}f", precision).c_str(),
|
||||
ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
nt::SetEntryValue(entry.entry, nt::NetworkTableValue::MakeDouble(v));
|
||||
}
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case NT_STRING: {
|
||||
@@ -600,9 +623,9 @@ static void EmitEntry(NetworkTablesModel::Entry& entry, const char* name,
|
||||
ImGui::NextColumn();
|
||||
|
||||
if (flags & NetworkTablesFlags_ReadOnly) {
|
||||
EmitEntryValueReadonly(entry);
|
||||
EmitEntryValueReadonly(entry, flags);
|
||||
} else {
|
||||
EmitEntryValueEditable(entry);
|
||||
EmitEntryValueEditable(entry, flags);
|
||||
}
|
||||
ImGui::NextColumn();
|
||||
|
||||
@@ -743,19 +766,23 @@ void NetworkTablesFlagsSettings::Update() {
|
||||
m_pCreateNoncanonicalKeys = &storage.GetBool(
|
||||
"createNonCanonical",
|
||||
m_defaultFlags & NetworkTablesFlags_CreateNoncanonicalKeys);
|
||||
m_pPrecision = &storage.GetInt(
|
||||
"precision", (m_defaultFlags & NetworkTablesFlags_Precision) >>
|
||||
kNetworkTablesFlags_PrecisionBitShift);
|
||||
}
|
||||
|
||||
m_flags &=
|
||||
~(NetworkTablesFlags_TreeView | NetworkTablesFlags_ShowConnections |
|
||||
NetworkTablesFlags_ShowFlags | NetworkTablesFlags_ShowTimestamp |
|
||||
NetworkTablesFlags_CreateNoncanonicalKeys);
|
||||
m_flags &= ~(
|
||||
NetworkTablesFlags_TreeView | NetworkTablesFlags_ShowConnections |
|
||||
NetworkTablesFlags_ShowFlags | NetworkTablesFlags_ShowTimestamp |
|
||||
NetworkTablesFlags_CreateNoncanonicalKeys | NetworkTablesFlags_Precision);
|
||||
m_flags |=
|
||||
(*m_pTreeView ? NetworkTablesFlags_TreeView : 0) |
|
||||
(*m_pShowConnections ? NetworkTablesFlags_ShowConnections : 0) |
|
||||
(*m_pShowFlags ? NetworkTablesFlags_ShowFlags : 0) |
|
||||
(*m_pShowTimestamp ? NetworkTablesFlags_ShowTimestamp : 0) |
|
||||
(*m_pCreateNoncanonicalKeys ? NetworkTablesFlags_CreateNoncanonicalKeys
|
||||
: 0);
|
||||
: 0) |
|
||||
(*m_pPrecision << kNetworkTablesFlags_PrecisionBitShift);
|
||||
}
|
||||
|
||||
void NetworkTablesFlagsSettings::DisplayMenu() {
|
||||
@@ -766,6 +793,17 @@ void NetworkTablesFlagsSettings::DisplayMenu() {
|
||||
ImGui::MenuItem("Show Connections", "", m_pShowConnections);
|
||||
ImGui::MenuItem("Show Flags", "", m_pShowFlags);
|
||||
ImGui::MenuItem("Show Timestamp", "", m_pShowTimestamp);
|
||||
if (ImGui::BeginMenu("Decimal Precision")) {
|
||||
static const char* precisionOptions[] = {"1", "2", "3", "4", "5",
|
||||
"6", "7", "8", "9", "10"};
|
||||
for (int i = 1; i <= 10; i++) {
|
||||
if (ImGui::MenuItem(precisionOptions[i - 1], nullptr,
|
||||
i == *m_pPrecision)) {
|
||||
*m_pPrecision = i;
|
||||
}
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::Separator();
|
||||
ImGui::MenuItem("Allow creation of non-canonical keys", "",
|
||||
m_pCreateNoncanonicalKeys);
|
||||
|
||||
@@ -88,6 +88,8 @@ class NetworkTablesModel : public Model {
|
||||
|
||||
using NetworkTablesFlags = int;
|
||||
|
||||
static constexpr const int kNetworkTablesFlags_PrecisionBitShift = 6;
|
||||
|
||||
enum NetworkTablesFlags_ {
|
||||
NetworkTablesFlags_TreeView = 1 << 0,
|
||||
NetworkTablesFlags_ReadOnly = 1 << 1,
|
||||
@@ -95,8 +97,10 @@ enum NetworkTablesFlags_ {
|
||||
NetworkTablesFlags_ShowFlags = 1 << 3,
|
||||
NetworkTablesFlags_ShowTimestamp = 1 << 4,
|
||||
NetworkTablesFlags_CreateNoncanonicalKeys = 1 << 5,
|
||||
NetworkTablesFlags_Default = 1 & ~NetworkTablesFlags_ReadOnly &
|
||||
~NetworkTablesFlags_CreateNoncanonicalKeys
|
||||
NetworkTablesFlags_Precision = 0xff << kNetworkTablesFlags_PrecisionBitShift,
|
||||
NetworkTablesFlags_Default = (1 & ~NetworkTablesFlags_ReadOnly &
|
||||
~NetworkTablesFlags_CreateNoncanonicalKeys) |
|
||||
(6 << kNetworkTablesFlags_PrecisionBitShift),
|
||||
};
|
||||
|
||||
void DisplayNetworkTables(
|
||||
@@ -120,6 +124,7 @@ class NetworkTablesFlagsSettings {
|
||||
bool* m_pShowFlags = nullptr;
|
||||
bool* m_pShowTimestamp = nullptr;
|
||||
bool* m_pCreateNoncanonicalKeys = nullptr;
|
||||
int* m_pPrecision = nullptr;
|
||||
NetworkTablesFlags m_defaultFlags; // NOLINT
|
||||
NetworkTablesFlags m_flags; // NOLINT
|
||||
};
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
6
gradlew
vendored
6
gradlew
vendored
@@ -205,6 +205,12 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
||||
14
gradlew.bat
vendored
14
gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +25,7 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -100,6 +100,11 @@ ext {
|
||||
}
|
||||
}
|
||||
}
|
||||
exeSplitSetup = {
|
||||
if (it.targetPlatform.name == nativeUtils.wpi.platforms.roborio) {
|
||||
nativeUtils.useRequiredLibrary(it, 'ni_link_libraries', 'ni_runtime_libraries')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
apply from: "${rootDir}/shared/jni/setupBuild.gradle"
|
||||
|
||||
@@ -7,7 +7,6 @@ package edu.wpi.first.hal;
|
||||
/**
|
||||
* JNI wrapper for library <b>FRC_NetworkCommunication</b><br>.
|
||||
*/
|
||||
@SuppressWarnings({"MethodName", "LineLength"})
|
||||
public class FRCNetComm {
|
||||
/**
|
||||
* Resource type from UsageReporting.
|
||||
|
||||
@@ -5,12 +5,11 @@
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Structure for holding the values stored in an accumulator. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class AccumulatorResult {
|
||||
/** The total value accumulated. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public long value;
|
||||
/** The number of sample value was accumulated over. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public long count;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class AddressableLEDJNI extends JNIWrapper {
|
||||
public static native int initialize(int pwmHandle);
|
||||
|
||||
|
||||
@@ -111,6 +111,5 @@ public class AnalogJNI extends JNIWrapper {
|
||||
|
||||
public static native boolean getAnalogTriggerOutput(int analogTriggerHandle, int type);
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public static native int getAnalogTriggerFPGAIndex(int analogTriggerHandle);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class CANAPIJNI extends JNIWrapper {
|
||||
public static native int initializeCAN(int manufacturer, int deviceId, int deviceType);
|
||||
|
||||
|
||||
@@ -4,14 +4,10 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public class CANData {
|
||||
@SuppressWarnings("MemberName")
|
||||
public final byte[] data = new byte[8];
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public int length;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public long timestamp;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class CTREPCMJNI extends JNIWrapper {
|
||||
public static native int initialize(int module);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class DIOJNI extends JNIWrapper {
|
||||
public static native int initializeDIOPort(int halPortHandle, boolean input);
|
||||
|
||||
@@ -22,7 +21,9 @@ public class DIOJNI extends JNIWrapper {
|
||||
|
||||
public static native boolean getDIODirection(int dioPortHandle);
|
||||
|
||||
public static native void pulse(int dioPortHandle, double pulseLength);
|
||||
public static native void pulse(int dioPortHandle, double pulseLengthSeconds);
|
||||
|
||||
public static native void pulseMultiple(long channelMask, double pulseLengthSeconds);
|
||||
|
||||
public static native boolean isPulsing(int dioPortHandle);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class DMAJNI extends JNIWrapper {
|
||||
public static native int initialize();
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ package edu.wpi.first.hal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class DMAJNISample {
|
||||
private static final int kEnable_Accumulator0 = 8;
|
||||
private static final int kEnable_Accumulator1 = 9;
|
||||
|
||||
@@ -17,6 +17,5 @@ public class DutyCycleJNI extends JNIWrapper {
|
||||
|
||||
public static native int getOutputScaleFactor(int handle);
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public static native int getFPGAIndex(int handle);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,6 @@ public class EncoderJNI extends JNIWrapper {
|
||||
public static native void setEncoderIndexSource(
|
||||
int encoderHandle, int digitalSourceHandle, int analogTriggerType, int indexingType);
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public static native int getEncoderFPGAIndex(int encoderHandle);
|
||||
|
||||
public static native int getEncoderEncodingScale(int encoderHandle);
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
* JNI Wrapper for HAL<br>
|
||||
* .
|
||||
*/
|
||||
@SuppressWarnings({"AbbreviationAsWordInName", "MethodName"})
|
||||
public final class HAL extends JNIWrapper {
|
||||
public static native void waitForDSData();
|
||||
|
||||
@@ -153,7 +152,11 @@ public final class HAL extends JNIWrapper {
|
||||
|
||||
public static native int nativeGetControlWord();
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Get the current DriverStation control word.
|
||||
*
|
||||
* @param controlWord Storage for control word.
|
||||
*/
|
||||
public static void getControlWord(ControlWord controlWord) {
|
||||
int word = nativeGetControlWord();
|
||||
controlWord.update(
|
||||
@@ -167,7 +170,11 @@ public final class HAL extends JNIWrapper {
|
||||
|
||||
private static native int nativeGetAllianceStation();
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Get the alliance station.
|
||||
*
|
||||
* @return The alliance station.
|
||||
*/
|
||||
public static AllianceStationID getAllianceStation() {
|
||||
switch (nativeGetAllianceStation()) {
|
||||
case 0:
|
||||
@@ -187,13 +194,10 @@ public final class HAL extends JNIWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static native boolean isNewControlData();
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static native void releaseDSMutex();
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public static native boolean waitForDSDataTimeout(double timeout);
|
||||
|
||||
public static final int kMaxJoystickAxes = 12;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public final class HALUtil extends JNIWrapper {
|
||||
public static final int NULL_PARAMETER = -1005;
|
||||
public static final int SAMPLE_RATE_TOO_HIGH = 1001;
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public final class HALValue {
|
||||
public static final int kUnassigned = 0;
|
||||
public static final int kBoolean = 0x01;
|
||||
|
||||
@@ -6,7 +6,6 @@ package edu.wpi.first.hal;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class I2CJNI extends JNIWrapper {
|
||||
public static native void i2CInitialize(int port);
|
||||
|
||||
|
||||
@@ -5,25 +5,21 @@
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Structure for holding the match info data request. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class MatchInfoData {
|
||||
/** Stores the event name. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public String eventName = "";
|
||||
|
||||
/** Stores the game specific message. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public String gameSpecificMessage = "";
|
||||
|
||||
/** Stores the match number. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int matchNumber;
|
||||
|
||||
/** Stores the replay number. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int replayNumber;
|
||||
|
||||
/** Stores the match type. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int matchType;
|
||||
|
||||
/**
|
||||
@@ -35,7 +31,6 @@ public class MatchInfoData {
|
||||
* @param replayNumber Replay number.
|
||||
* @param matchType Match type.
|
||||
*/
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
public void setData(
|
||||
String eventName,
|
||||
String gameSpecificMessage,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
/** Structure for holding the config data result for PWM. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class PWMConfigDataResult {
|
||||
PWMConfigDataResult(int max, int deadbandMax, int center, int deadbandMin, int min) {
|
||||
this.max = max;
|
||||
@@ -15,22 +16,17 @@ public class PWMConfigDataResult {
|
||||
}
|
||||
|
||||
/** The maximum PWM value. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int max;
|
||||
|
||||
/** The deadband maximum PWM value. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int deadbandMax;
|
||||
|
||||
/** The center PWM value. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int center;
|
||||
|
||||
/** The deadband minimum PWM value. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int deadbandMin;
|
||||
|
||||
/** The minimum PWM value. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int min;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class PWMJNI extends DIOJNI {
|
||||
public static native int initializePWMPort(int halPortHandle);
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class PortsJNI extends JNIWrapper {
|
||||
public static native int getNumAccumulators();
|
||||
|
||||
|
||||
@@ -4,86 +4,60 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public class PowerDistributionFaults {
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel0BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel1BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel2BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel3BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel4BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel5BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel6BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel7BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel8BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel9BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel10BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel11BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel12BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel13BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel14BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel15BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel16BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel17BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel18BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel19BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel20BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel21BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel22BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel23BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Brownout;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CanWarning;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean HardwareFault;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class PowerDistributionJNI extends JNIWrapper {
|
||||
public static final int AUTOMATIC_TYPE = 0;
|
||||
public static final int CTRE_TYPE = 1;
|
||||
|
||||
@@ -4,89 +4,62 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public class PowerDistributionStickyFaults {
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel0BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel1BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel2BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel3BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel4BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel5BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel6BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel7BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel8BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel9BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel10BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel11BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel12BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel13BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel14BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel15BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel16BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel17BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel18BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel19BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel20BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel21BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel22BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel23BreakerFault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Brownout;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CanWarning;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CanBusOff;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean HasReset;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,23 +4,18 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public class PowerDistributionVersion {
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int firmwareMajor;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int firmwareMinor;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int firmwareFix;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int hardwareMinor;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int hardwareMajor;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int uniqueId;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,72 +4,50 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
@SuppressWarnings("MemberName")
|
||||
public class REVPHFaults {
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel0Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel1Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel2Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel3Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel4Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel5Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel6Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel7Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel8Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel9Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel10Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel11Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel12Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel13Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel14Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Channel15Fault;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CompressorOverCurrent;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CompressorOpen;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean SolenoidOverCurrent;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Brownout;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CanWarning;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean HardwareFault;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class REVPHJNI extends JNIWrapper {
|
||||
public static final int COMPRESSOR_CONFIG_TYPE_DISABLED = 0;
|
||||
public static final int COMPRESSOR_CONFIG_TYPE_DIGITAL = 1;
|
||||
|
||||
@@ -4,27 +4,20 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
@SuppressWarnings("MemberName")
|
||||
public class REVPHStickyFaults {
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CompressorOverCurrent;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CompressorOpen;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean SolenoidOverCurrent;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean Brownout;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CanWarning;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean CanBusOff;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final boolean HasReset;
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,24 +4,18 @@
|
||||
|
||||
package edu.wpi.first.hal;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
@SuppressWarnings("MemberName")
|
||||
public class REVPHVersion {
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int firmwareMajor;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int firmwareMinor;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int firmwareFix;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int hardwareMinor;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int hardwareMajor;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public final int uniqueId;
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,19 @@ package edu.wpi.first.hal;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class SPIJNI extends JNIWrapper {
|
||||
public static final int INVALID_PORT = -1;
|
||||
public static final int ONBOARD_CS0_PORT = 0;
|
||||
public static final int ONBOARD_CS1_PORT = 1;
|
||||
public static final int ONBOARD_CS2_PORT = 2;
|
||||
public static final int ONBOARD_CS3_PORT = 3;
|
||||
public static final int MXP_PORT = 4;
|
||||
|
||||
public static final int SPI_MODE0 = 0;
|
||||
public static final int SPI_MODE1 = 1;
|
||||
public static final int SPI_MODE2 = 2;
|
||||
public static final int SPI_MODE3 = 3;
|
||||
|
||||
public static native void spiInitialize(int port);
|
||||
|
||||
public static native int spiTransaction(
|
||||
@@ -28,8 +39,9 @@ public class SPIJNI extends JNIWrapper {
|
||||
|
||||
public static native void spiSetSpeed(int port, int speed);
|
||||
|
||||
public static native void spiSetOpts(
|
||||
int port, int msbFirst, int sampleOnTrailing, int clkIdleHigh);
|
||||
public static native void spiSetMode(int port, int mode);
|
||||
|
||||
public static native int spiGetMode(int port);
|
||||
|
||||
public static native void spiSetChipSelectActiveHigh(int port);
|
||||
|
||||
|
||||
@@ -106,22 +106,6 @@ public class SimDevice implements AutoCloseable {
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a value on the simulated device.
|
||||
*
|
||||
* <p>Returns null if not in simulation.
|
||||
*
|
||||
* @param name value name
|
||||
* @param readonly if the value should not be written from simulation side
|
||||
* @param initialValue initial value
|
||||
* @return simulated value object
|
||||
* @deprecated Use direction function instead
|
||||
*/
|
||||
@Deprecated
|
||||
public SimValue createValue(String name, boolean readonly, HALValue initialValue) {
|
||||
return createValue(name, readonly ? Direction.kOutput : Direction.kInput, initialValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a value on the simulated device.
|
||||
*
|
||||
@@ -176,22 +160,6 @@ public class SimDevice implements AutoCloseable {
|
||||
return new SimLong(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double value on the simulated device.
|
||||
*
|
||||
* <p>Returns null if not in simulation.
|
||||
*
|
||||
* @param name value name
|
||||
* @param readonly if the value should not be written from simulation side
|
||||
* @param initialValue initial value
|
||||
* @return simulated double value object
|
||||
* @deprecated Use direction function instead
|
||||
*/
|
||||
@Deprecated
|
||||
public SimDouble createDouble(String name, boolean readonly, double initialValue) {
|
||||
return createDouble(name, readonly ? Direction.kOutput : Direction.kInput, initialValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double value on the simulated device.
|
||||
*
|
||||
@@ -210,25 +178,6 @@ public class SimDevice implements AutoCloseable {
|
||||
return new SimDouble(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an enumerated value on the simulated device.
|
||||
*
|
||||
* <p>Enumerated values are always in the range 0 to numOptions-1.
|
||||
*
|
||||
* <p>Returns null if not in simulation.
|
||||
*
|
||||
* @param name value name
|
||||
* @param readonly if the value should not be written from simulation side
|
||||
* @param options array of option descriptions
|
||||
* @param initialValue initial value (selection)
|
||||
* @return simulated enum value object
|
||||
* @deprecated Use direction function instead
|
||||
*/
|
||||
@Deprecated
|
||||
public SimEnum createEnum(String name, boolean readonly, String[] options, int initialValue) {
|
||||
return createEnum(name, readonly ? Direction.kOutput : Direction.kInput, options, initialValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an enumerated value on the simulated device.
|
||||
*
|
||||
@@ -276,22 +225,6 @@ public class SimDevice implements AutoCloseable {
|
||||
return new SimEnum(handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a boolean value on the simulated device.
|
||||
*
|
||||
* <p>Returns null if not in simulation.
|
||||
*
|
||||
* @param name value name
|
||||
* @param readonly if the value should not be written from simulation side
|
||||
* @param initialValue initial value
|
||||
* @return simulated boolean value object
|
||||
* @deprecated Use direction function instead
|
||||
*/
|
||||
@Deprecated
|
||||
public SimBoolean createBoolean(String name, boolean readonly, boolean initialValue) {
|
||||
return createBoolean(name, readonly ? Direction.kOutput : Direction.kInput, initialValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a boolean value on the simulated device.
|
||||
*
|
||||
|
||||
@@ -36,30 +36,6 @@ public class SimDeviceJNI extends JNIWrapper {
|
||||
private static native int createSimValueNative(
|
||||
int device, String name, int direction, int type, long value1, double value2);
|
||||
|
||||
/**
|
||||
* Creates a value on a simulated device.
|
||||
*
|
||||
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
|
||||
*
|
||||
* @param device simulated device handle
|
||||
* @param name value name
|
||||
* @param readonly if the value should not be written from simulation side
|
||||
* @param initialValue initial value
|
||||
* @return simulated value handle
|
||||
* @deprecated Use direction-taking function instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static int createSimValue(
|
||||
int device, String name, boolean readonly, HALValue initialValue) {
|
||||
return createSimValueNative(
|
||||
device,
|
||||
name,
|
||||
readonly ? kOutput : kInput,
|
||||
initialValue.getType(),
|
||||
initialValue.getNativeLong(),
|
||||
initialValue.getNativeDouble());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a value on a simulated device.
|
||||
*
|
||||
@@ -111,25 +87,6 @@ public class SimDeviceJNI extends JNIWrapper {
|
||||
return createSimValueNative(device, name, direction, HALValue.kLong, initialValue, 0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double value on a simulated device.
|
||||
*
|
||||
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
|
||||
*
|
||||
* @param device simulated device handle
|
||||
* @param name value name
|
||||
* @param readonly if the value should not be written from simulation side
|
||||
* @param initialValue initial value
|
||||
* @return simulated value handle
|
||||
* @deprecated Use direction-taking function instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static int createSimValueDouble(
|
||||
int device, String name, boolean readonly, double initialValue) {
|
||||
return createSimValueNative(
|
||||
device, name, readonly ? kOutput : kInput, HALValue.kDouble, 0, initialValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a double value on a simulated device.
|
||||
*
|
||||
@@ -146,27 +103,6 @@ public class SimDeviceJNI extends JNIWrapper {
|
||||
return createSimValueNative(device, name, direction, HALValue.kDouble, 0, initialValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an enumerated value on a simulated device.
|
||||
*
|
||||
* <p>Enumerated values are always in the range 0 to numOptions-1.
|
||||
*
|
||||
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
|
||||
*
|
||||
* @param device simulated device handle
|
||||
* @param name value name
|
||||
* @param readonly if the value should not be written from simulation side
|
||||
* @param options array of option descriptions
|
||||
* @param initialValue initial value (selection)
|
||||
* @return simulated value handle
|
||||
* @deprecated Use direction-taking function instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static int createSimValueEnum(
|
||||
int device, String name, boolean readonly, String[] options, int initialValue) {
|
||||
return createSimValueEnum(device, name, readonly ? kOutput : kInput, options, initialValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an enumerated value on a simulated device.
|
||||
*
|
||||
@@ -207,25 +143,6 @@ public class SimDeviceJNI extends JNIWrapper {
|
||||
double[] optionValues,
|
||||
int initialValue);
|
||||
|
||||
/**
|
||||
* Creates a boolean value on a simulated device.
|
||||
*
|
||||
* <p>Returns 0 if not in simulation; this can be used to avoid calls to Set/Get functions.
|
||||
*
|
||||
* @param device simulated device handle
|
||||
* @param name value name
|
||||
* @param readonly if the value should not be written from simulation side
|
||||
* @param initialValue initial value
|
||||
* @return simulated value handle
|
||||
* @deprecated Use direction-taking function instead
|
||||
*/
|
||||
@Deprecated
|
||||
public static int createSimValueBoolean(
|
||||
int device, String name, boolean readonly, boolean initialValue) {
|
||||
return createSimValueNative(
|
||||
device, name, readonly ? kOutput : kInput, HALValue.kBoolean, initialValue ? 1 : 0, 0.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a boolean value on a simulated device.
|
||||
*
|
||||
|
||||
@@ -8,7 +8,7 @@ import edu.wpi.first.hal.JNIWrapper;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
@SuppressWarnings("MethodName")
|
||||
public class CANJNI extends JNIWrapper {
|
||||
public static final int CAN_SEND_PERIOD_NO_REPEAT = 0;
|
||||
public static final int CAN_SEND_PERIOD_STOP_REPEATING = -1;
|
||||
@@ -17,14 +17,11 @@ public class CANJNI extends JNIWrapper {
|
||||
public static final int CAN_IS_FRAME_REMOTE = 0x80000000;
|
||||
public static final int CAN_IS_FRAME_11BIT = 0x40000000;
|
||||
|
||||
@SuppressWarnings("MethodName")
|
||||
public static native void FRCNetCommCANSessionMuxSendMessage(
|
||||
int messageID, byte[] data, int periodMs);
|
||||
|
||||
@SuppressWarnings("MethodName")
|
||||
public static native byte[] FRCNetCommCANSessionMuxReceiveMessage(
|
||||
IntBuffer messageID, int messageIDMask, ByteBuffer timeStamp);
|
||||
|
||||
@SuppressWarnings("MethodName")
|
||||
public static native void getCANStatus(CANStatus status);
|
||||
}
|
||||
|
||||
@@ -5,28 +5,32 @@
|
||||
package edu.wpi.first.hal.can;
|
||||
|
||||
/** Structure for holding the result of a CAN Status request. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public class CANStatus {
|
||||
/** The utilization of the CAN Bus. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public double percentBusUtilization;
|
||||
|
||||
/** The CAN Bus off count. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int busOffCount;
|
||||
|
||||
/** The CAN Bus TX full count. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int txFullCount;
|
||||
|
||||
/** The CAN Bus receive error count. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int receiveErrorCount;
|
||||
|
||||
/** The CAN Bus transmit error count. */
|
||||
@SuppressWarnings("MemberName")
|
||||
public int transmitErrorCount;
|
||||
|
||||
@SuppressWarnings("MissingJavadocMethod")
|
||||
/**
|
||||
* Set CAN bus status.
|
||||
*
|
||||
* @param percentBusUtilization CAN bus utilization as a percent.
|
||||
* @param busOffCount Bus off event count.
|
||||
* @param txFullCount TX buffer full event count.
|
||||
* @param receiveErrorCount Receive error event count.
|
||||
* @param transmitErrorCount Transmit error event count.
|
||||
*/
|
||||
public void setStatus(
|
||||
double percentBusUtilization,
|
||||
int busOffCount,
|
||||
|
||||
@@ -6,7 +6,6 @@ package edu.wpi.first.hal.simulation;
|
||||
|
||||
import edu.wpi.first.hal.JNIWrapper;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class CTREPCMDataJNI extends JNIWrapper {
|
||||
public static native int registerInitializedCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
@@ -6,7 +6,6 @@ package edu.wpi.first.hal.simulation;
|
||||
|
||||
import edu.wpi.first.hal.JNIWrapper;
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public class REVPHDataJNI extends JNIWrapper {
|
||||
public static native int registerInitializedCallback(
|
||||
int index, NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
@@ -7,17 +7,13 @@ package edu.wpi.first.hal.simulation;
|
||||
import edu.wpi.first.hal.JNIWrapper;
|
||||
|
||||
public class RoboRioDataJNI extends JNIWrapper {
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public static native int registerFPGAButtonCallback(
|
||||
NotifyCallback callback, boolean initialNotify);
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public static native void cancelFPGAButtonCallback(int uid);
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public static native boolean getFPGAButton();
|
||||
|
||||
@SuppressWarnings("AbbreviationAsWordInName")
|
||||
public static native void setFPGAButton(boolean fPGAButton);
|
||||
|
||||
public static native int registerVInVoltageCallback(
|
||||
|
||||
@@ -28,18 +28,21 @@ public class SimDeviceDataJNI extends JNIWrapper {
|
||||
|
||||
public static native int getSimValueDeviceHandle(int handle);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public static class SimDeviceInfo {
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
public String name;
|
||||
public int handle;
|
||||
|
||||
/**
|
||||
* SimDeviceInfo constructor.
|
||||
*
|
||||
* @param name SimDevice name.
|
||||
* @param handle SimDevice handle.
|
||||
*/
|
||||
public SimDeviceInfo(String name, int handle) {
|
||||
this.name = name;
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public String name;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public int handle;
|
||||
}
|
||||
|
||||
public static native SimDeviceInfo[] enumerateSimDevices(String prefix);
|
||||
@@ -70,32 +73,30 @@ public class SimDeviceDataJNI extends JNIWrapper {
|
||||
|
||||
public static native int getSimValueHandle(int device, String name);
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public static class SimValueInfo {
|
||||
@SuppressWarnings("JavadocMethod")
|
||||
public String name;
|
||||
public int handle;
|
||||
public int direction;
|
||||
public HALValue value;
|
||||
|
||||
/**
|
||||
* SimValueInfo constructor.
|
||||
*
|
||||
* @param name SimValue name.
|
||||
* @param handle SimValue handle.
|
||||
* @param direction SimValue direction.
|
||||
* @param type SimValue type.
|
||||
* @param value1 Value 1.
|
||||
* @param value2 Value 2.
|
||||
*/
|
||||
public SimValueInfo(
|
||||
String name, int handle, int direction, int type, long value1, double value2) {
|
||||
this.name = name;
|
||||
this.handle = handle;
|
||||
this.readonly = direction == 1;
|
||||
this.direction = direction;
|
||||
this.value = HALValue.fromNative(type, value1, value2);
|
||||
}
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public String name;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public int handle;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
@Deprecated
|
||||
public boolean readonly;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public int direction;
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
public HALValue value;
|
||||
}
|
||||
|
||||
public static native SimValueInfo[] enumerateSimValues(int device);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
package edu.wpi.first.hal.util;
|
||||
|
||||
/** Exception indicating that the resource is already allocated. */
|
||||
@SuppressWarnings("serial")
|
||||
public class AllocationException extends RuntimeException {
|
||||
/**
|
||||
* Create a new AllocationException.
|
||||
|
||||
@@ -7,7 +7,6 @@ package edu.wpi.first.hal.util;
|
||||
/**
|
||||
* This exception represents an error in which a lower limit was set as higher than an upper limit.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class BoundaryException extends RuntimeException {
|
||||
/**
|
||||
* Create a new exception with the given message.
|
||||
|
||||
@@ -8,7 +8,6 @@ package edu.wpi.first.hal.util;
|
||||
* Exception indicating that the resource is already allocated This is meant to be thrown by the
|
||||
* resource class.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class CheckedAllocationException extends Exception {
|
||||
/**
|
||||
* Create a new CheckedAllocationException.
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
package edu.wpi.first.hal.util;
|
||||
|
||||
/** Exception indicating that an error has occurred with a HAL Handle. */
|
||||
@SuppressWarnings("serial")
|
||||
public class HalHandleException extends RuntimeException {
|
||||
/**
|
||||
* Create a new HalHandleException.
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
package edu.wpi.first.hal.util;
|
||||
|
||||
/** Exception for bad status codes from the chip object. */
|
||||
@SuppressWarnings("serial")
|
||||
public final class UncleanStatusException extends IllegalStateException {
|
||||
private final int m_statusCode;
|
||||
|
||||
|
||||
@@ -121,8 +121,9 @@ static void writeRegister(Register reg, uint8_t data) {
|
||||
// Execute and wait until it's done (up to a millisecond)
|
||||
initialTime = HAL_GetFPGATime(&status);
|
||||
while (accel->readSTAT(&status) & 1) {
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000)
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Send a stop transmit/receive message with the data
|
||||
@@ -133,8 +134,9 @@ static void writeRegister(Register reg, uint8_t data) {
|
||||
// Execute and wait until it's done (up to a millisecond)
|
||||
initialTime = HAL_GetFPGATime(&status);
|
||||
while (accel->readSTAT(&status) & 1) {
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000)
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,8 +153,9 @@ static uint8_t readRegister(Register reg) {
|
||||
// Execute and wait until it's done (up to a millisecond)
|
||||
initialTime = HAL_GetFPGATime(&status);
|
||||
while (accel->readSTAT(&status) & 1) {
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000)
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Receive a message with the data and stop
|
||||
@@ -163,8 +166,9 @@ static uint8_t readRegister(Register reg) {
|
||||
// Execute and wait until it's done (up to a millisecond)
|
||||
initialTime = HAL_GetFPGATime(&status);
|
||||
while (accel->readSTAT(&status) & 1) {
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000)
|
||||
if (HAL_GetFPGATime(&status) > initialTime + 1000) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return accel->readDATI(&status);
|
||||
|
||||
@@ -23,8 +23,9 @@ HAL_Bool HAL_IsAccumulatorChannel(HAL_AnalogInputHandle analogPortHandle,
|
||||
return false;
|
||||
}
|
||||
for (int32_t i = 0; i < kNumAccumulators; i++) {
|
||||
if (port->channel == kAccumulatorChannels[i])
|
||||
if (port->channel == kAccumulatorChannels[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -233,9 +233,11 @@ void HAL_SetCTREPCMClosedLoopControl(HAL_CTREPCMHandle handle, HAL_Bool enabled,
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t can_status = 0;
|
||||
|
||||
std::scoped_lock lock{pcm->lock};
|
||||
pcm->control.bits.closedLoopEnable = enabled ? 1 : 0;
|
||||
SendControl(pcm.get(), status);
|
||||
SendControl(pcm.get(), &can_status);
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetCTREPCMClosedLoopControl(HAL_CTREPCMHandle handle,
|
||||
@@ -394,9 +396,8 @@ void HAL_SetCTREPCMOneShotDuration(HAL_CTREPCMHandle handle, int32_t index,
|
||||
}
|
||||
|
||||
std::scoped_lock lock{pcm->lock};
|
||||
pcm->oneShot.sol10MsPerUnit[index] =
|
||||
(std::min)(static_cast<uint32_t>(durMs) / 10,
|
||||
static_cast<uint32_t>(0xFF));
|
||||
pcm->oneShot.sol10MsPerUnit[index] = (std::min)(
|
||||
static_cast<uint32_t>(durMs) / 10, static_cast<uint32_t>(0xFF));
|
||||
HAL_WriteCANPacketRepeating(pcm->canHandle, pcm->oneShot.sol10MsPerUnit, 8,
|
||||
Control3, SendPeriod, status);
|
||||
}
|
||||
|
||||
@@ -133,8 +133,9 @@ HAL_Bool HAL_CheckDIOChannel(int32_t channel) {
|
||||
void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
// no status, so no need to check for a proper free.
|
||||
if (port == nullptr)
|
||||
if (port == nullptr) {
|
||||
return;
|
||||
}
|
||||
digitalChannelHandles->Free(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
|
||||
// Wait for no other object to hold this handle.
|
||||
@@ -407,13 +408,24 @@ HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
}
|
||||
}
|
||||
|
||||
void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
|
||||
void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLengthSeconds,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
if (port == nullptr) {
|
||||
*status = HAL_HANDLE_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t pulseLengthMicroseconds =
|
||||
static_cast<uint32_t>(pulseLengthSeconds * 1e6);
|
||||
|
||||
if (pulseLengthMicroseconds <= 0 || pulseLengthMicroseconds > 0xFFFF) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status,
|
||||
"Length must be between 1 and 65535 microseconds");
|
||||
return;
|
||||
}
|
||||
|
||||
tDIO::tPulse pulse;
|
||||
|
||||
if (port->channel >= kNumDigitalHeaders + kNumDigitalMXPChannels) {
|
||||
@@ -425,9 +437,29 @@ void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
|
||||
}
|
||||
|
||||
digitalSystem->writePulseLength(
|
||||
static_cast<uint16_t>(1.0e9 * pulseLength /
|
||||
(pwmSystem->readLoopTiming(status) * 25)),
|
||||
status);
|
||||
static_cast<uint16_t>(pulseLengthMicroseconds), status);
|
||||
digitalSystem->writePulse(pulse, status);
|
||||
}
|
||||
|
||||
void HAL_PulseMultiple(uint32_t channelMask, double pulseLengthSeconds,
|
||||
int32_t* status) {
|
||||
uint32_t pulseLengthMicroseconds =
|
||||
static_cast<uint32_t>(pulseLengthSeconds * 1e6);
|
||||
|
||||
if (pulseLengthMicroseconds <= 0 || pulseLengthMicroseconds > 0xFFFF) {
|
||||
*status = PARAMETER_OUT_OF_RANGE;
|
||||
hal::SetLastError(status,
|
||||
"Length must be between 1 and 65535 microseconds");
|
||||
return;
|
||||
}
|
||||
|
||||
tDIO::tPulse pulse;
|
||||
pulse.Headers = channelMask & 0x2FF;
|
||||
pulse.MXP = (channelMask & 0xFFFF) >> 10;
|
||||
pulse.SPIPort = (channelMask & 0x1F) >> 26;
|
||||
|
||||
digitalSystem->writePulseLength(
|
||||
static_cast<uint16_t>(pulseLengthMicroseconds), status);
|
||||
digitalSystem->writePulse(pulse, status);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user