Skip to content

Commit

Permalink
Merge branch 'main' into simplify-pose-estimator
Browse files Browse the repository at this point in the history
  • Loading branch information
KangarooKoala committed Jun 12, 2024
2 parents 7f90363 + 3d6b710 commit c987b3c
Show file tree
Hide file tree
Showing 219 changed files with 12,227 additions and 5,100 deletions.
5 changes: 2 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
*.h text eol=lf
*.inc text eol=lf
*.java text eol=lf
*.jinja text eol=lf
*.json text eol=lf
*.md text eol=lf
*.xml text eol=lf

# Generated files
hal/src/generated/** linguist-generated
ntcore/src/generated/** linguist-generated
wpimath/src/generated/** linguist-generated
*/src/generated/** linguist-generated
2 changes: 1 addition & 1 deletion .github/workflows/command-robotpy-pr.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Comment on PR for robotpy

on:
pull_request:
pull_request_target:
types:
- opened
paths:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pregenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
run: ./ntcore/generate_topics.py
- name: Run wpimath
run: ./wpimath/generate_numbers.py && ./wpimath/generate_quickbuf.py protoc protoc-gen-quickbuf-1.3.3-linux-x86_64.exe
- name: Run HIDs
run: ./wpilibj/generate_hids.py && ./wpilibc/generate_hids.py && ./wpilibNewCommands/generate_hids.py
- name: Add untracked files to index so they count as changes
run: git add -A
- name: Check output
Expand Down
144 changes: 144 additions & 0 deletions .github/workflows/tools.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Tools

on: [pull_request, push]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
YEAR: 2024

jobs:
build-artifacts:
name: "Build - WPILib"
runs-on: ubuntu-22.04
env:
DISPLAY: ':10'
steps:
- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build WPILib with Gradle
uses: addnab/docker-run-action@v3
with:
image: wpilib/roborio-cross-ubuntu:2024-22.04
options: -v ${{ github.workspace }}:/work -w /work -e GITHUB_REF -e CI -e DISPLAY
run: df . && rm -f semicolon_delimited_script && ./gradlew :wpilibc:publish :wpilibj:publish :wpilibNewCommands:publish :hal:publish :cameraserver:publish :ntcore:publish :cscore:publish :wpimath:publish :wpinet:publish :wpiutil:publish :apriltag:publish :wpiunits:publish :simulation:halsim_gui:publish :simulation:halsim_ds_socket:publish -x test -x Javadoc -x doxygen --build-cache && cp -r /root/releases/maven/development /work
- uses: actions/upload-artifact@v4
with:
name: MavenArtifacts
path: |
development
retention-days: 1

Robotbuilder:
name: "Build - RobotBuilder"
needs: [build-artifacts]
runs-on: ubuntu-22.04
env:
DISPLAY: ':10'
steps:
- uses: actions/checkout@v4
with:
repository: wpilibsuite/robotbuilder
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: MavenArtifacts
- name: Patch RobotBuilder to use local development
run: cd src/main/resources/export && echo "wpi.maven.useLocal = false" >> java/build.gradle && echo "wpi.maven.useFrcMavenLocalDevelopment = true" >> java/build.gradle && echo "wpi.versions.wpilibVersion = '$YEAR.424242.+'" >> java/build.gradle && echo "wpi.versions.wpimathVersion = '$YEAR.424242.+'" >> java/build.gradle && echo "wpi.maven.useLocal = false" >> cpp/build.gradle && echo "wpi.maven.useFrcMavenLocalDevelopment = true" >> cpp/build.gradle && echo "wpi.versions.wpilibVersion = '$YEAR.424242.+'" >> cpp/build.gradle && echo "wpi.versions.wpimathVersion = '$YEAR.424242.+'" >> cpp/build.gradle
- name: Install and run xvfb
run: sudo apt-get update && sudo apt-get install -y xvfb && Xvfb $DISPLAY &
- name: Move artifacts
run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Build RobotBuilder with Gradle
run: ./gradlew build test --tests 'robotbuilder.exporters.*' -x htmlSanityCheck -PbuildServer -PreleaseMode ; cat build/test-results/test/TEST-robotbuilder.exporters.*.xml ;
- name: Summarize RobotBuilder Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
build/test-results/test/TEST*.xml
- uses: actions/upload-artifact@v4
if: always()
with:
name: TestResults
path: |
build/reports/
- uses: actions/upload-artifact@v4
with:
name: RobotBuilder Build
path: |
build/libs/
retention-days: 7

Shuffleboard:
name: "Build - Shuffleboard"
needs: [build-artifacts]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
repository: wpilibsuite/shuffleboard
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: MavenArtifacts
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Move artifacts
run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development
- name: Install dependencies
run: sudo apt-get install -y libgtk2.0-0
- name: Build with Gradle
run: ./gradlew build -x Javadoc
- uses: actions/upload-artifact@v4
with:
name: Shuffleboard Build
path: |
build/allOutputs/
retention-days: 7

PathWeaver:
name: "Build - PathWeaver"
needs: [build-artifacts]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
repository: wpilibsuite/PathWeaver
fetch-depth: 0
- uses: actions/download-artifact@v4
with:
name: MavenArtifacts
- uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
- name: Move artifacts
run: mkdir -p ~/releases/maven/development && cp -r edu ~/releases/maven/development
- name: Build with Gradle
run: ./gradlew build
- uses: actions/upload-artifact@v4
with:
name: PathWeaver Build
path: |
build/allOutputs/
retention-days: 7
1 change: 1 addition & 0 deletions .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ generatedFileExclude {
simulation/gz_msgs/src/include/simulation/gz_msgs/msgs\.h$
fieldImages/src/main/native/resources/
apriltag/src/test/resources/
wpilibc/src/generated/
}

repoRootNameOverride {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ public int hashCode() {
private static class FieldDimensions {
@SuppressWarnings("MemberName")
@JsonProperty(value = "length")
public double fieldLength;
public final double fieldLength;

@SuppressWarnings("MemberName")
@JsonProperty(value = "width")
public double fieldWidth;
public final double fieldWidth;

@JsonCreator()
FieldDimensions(
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ repositories {
}
}
dependencies {
implementation "edu.wpi.first:native-utils:2025.0.0"
implementation "edu.wpi.first:native-utils:2025.1.0"
}
5 changes: 5 additions & 0 deletions cmake/modules/CompileWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,9 @@ macro(wpilib_target_warnings target)
)
target_compile_options(${target} PRIVATE -gz=zlib)
endif()

# Disable std::mutex constexpr constructor on MSCV; Workaround for MSVCP redist mismatch on GHA
if(MSVC)
target_compile_options(${target} PRIVATE /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
endif()
endmacro()
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class OpenCvLoader {
static boolean libraryLoaded;

/** Sets whether JNI should be loaded in the static block. */
public static class Helper {
public static final class Helper {
private static AtomicBoolean extractOnStaticLoad = new AtomicBoolean(true);

/**
Expand Down
3 changes: 3 additions & 0 deletions cscore/src/main/java/edu/wpi/first/cscore/VideoListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ public boolean isValid() {

private static final ReentrantLock s_lock = new ReentrantLock();
private static final Map<Integer, Consumer<VideoEvent>> s_listeners = new HashMap<>();

@SuppressWarnings("PMD.SingularField")
private static Thread s_thread;

private static int s_poller;
private static boolean s_waitQueue;
private static final Condition s_waitQueueCond = s_lock.newCondition();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,5 +212,5 @@ public String[] getChoices() {
}

int m_handle;
private Kind m_kind;
private final Kind m_kind;
}
4 changes: 0 additions & 4 deletions developerRobot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ model {
def filePath = it.tasks.install.installDirectory.get().toString() + File.separatorChar + 'lib'
run.dependsOn it.tasks.install
run.systemProperty 'java.library.path', filePath
run.environment 'LD_LIBRARY_PATH', filePath
run.environment 'DYLD_LIBRARY_PATH', filePath

def installTask = it.tasks.install

Expand All @@ -297,8 +295,6 @@ model {
runTask.doFirst doFirstTask
run.doFirst doFirstTask

run.workingDir filePath

found = true
}
}
Expand Down
1 change: 1 addition & 0 deletions hal/src/generate/FRCNetComm.java.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package edu.wpi.first.hal;
/**
* JNI wrapper for library <b>FRC_NetworkCommunication</b><br>.
*/
@SuppressWarnings("PMD.MissingStaticMethodInNonInstantiatableClass")
public final class FRCNetComm {
/**
* Resource type from UsageReporting.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions hal/src/main/java/edu/wpi/first/hal/HAL.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public final class HAL extends JNIWrapper {

private static final List<Runnable> s_simPeriodicBefore = new ArrayList<>();

public static class SimPeriodicBeforeCallback implements AutoCloseable {
public static final class SimPeriodicBeforeCallback implements AutoCloseable {
private SimPeriodicBeforeCallback(Runnable r) {
m_run = r;
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public static void simPeriodicBefore() {

private static final List<Runnable> s_simPeriodicAfter = new ArrayList<>();

public static class SimPeriodicAfterCallback implements AutoCloseable {
public static final class SimPeriodicAfterCallback implements AutoCloseable {
private SimPeriodicAfterCallback(Runnable r) {
m_run = r;
}
Expand Down
9 changes: 1 addition & 8 deletions ntcore/src/generate/main/java/NetworkTableEntry.java.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -541,14 +541,7 @@ public final class NetworkTableEntry implements Publisher, Subscriber {

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof NetworkTableEntry)) {
return false;
}

return m_handle == ((NetworkTableEntry) other).m_handle;
return other == this || other instanceof NetworkTableEntry entry && m_handle == entry.m_handle;
}

@Override
Expand Down
9 changes: 4 additions & 5 deletions ntcore/src/generate/main/java/NetworkTableInstance.java.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ import us.hebi.quickbuf.ProtoMessage;
* kept to the NetworkTableInstance returned by this function to keep it from being garbage
* collected.
*/
@SuppressWarnings("PMD.CouplingBetweenObjects")
public final class NetworkTableInstance implements AutoCloseable {
/** Client/server mode flag values (as returned by {@link #getNetworkMode()}). */
public enum NetworkMode {
Expand Down Expand Up @@ -493,7 +492,10 @@ public final class NetworkTableInstance implements AutoCloseable {
private static class ListenerStorage implements AutoCloseable {
private final ReentrantLock m_lock = new ReentrantLock();
private final Map<Integer, Consumer<NetworkTableEvent>> m_listeners = new HashMap<>();

@SuppressWarnings("PMD.SingularField")
private Thread m_thread;

private int m_poller;
private boolean m_waitQueue;
private final Event m_waitQueueEvent = new Event();
Expand Down Expand Up @@ -1239,10 +1241,7 @@ public final class NetworkTableInstance implements AutoCloseable {

@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
return other instanceof NetworkTableInstance inst && m_handle == inst.m_handle;
return other == this || other instanceof NetworkTableInstance inst && m_handle == inst.m_handle;
}

@Override
Expand Down
10 changes: 4 additions & 6 deletions ntcore/src/generate/main/java/NetworkTableValue.java.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,10 @@ public final class NetworkTableValue {
{% endfor %}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
return other instanceof NetworkTableValue ntOther
&& m_type == ntOther.m_type
&& m_value.equals(ntOther.m_value);
return other == this
|| other instanceof NetworkTableValue ntOther
&& m_type == ntOther.m_type
&& m_value.equals(ntOther.m_value);
}

@Override
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c987b3c

Please sign in to comment.