Skip to content

Commit

Permalink
Merge branch 'main' into more-serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
KangarooKoala committed Jul 21, 2024
2 parents d1b955f + b4d42d8 commit e7d18a1
Show file tree
Hide file tree
Showing 162 changed files with 42,017 additions and 1,806 deletions.
18 changes: 18 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
*.adoc text eol=lf
*.c text eol=lf
*.cmake text eol=lf
*.clang-format text eol=lf
*.clang-tidy text eol=lf
*.cpp text eol=lf
*.gradle text eol=lf
*.groovy text eol=lf
*.h text eol=lf
*.hpp text eol=lf
*.in text eol=lf
*.inc text eol=lf
*.java text eol=lf
*.jinja text eol=lf
*.json text eol=lf
*.m text eol=lf
*.md text eol=lf
*.mm text eol=lf
*.patch text eol=lf
*.plist text eol=lf
*.proto text eol=lf
*.py text eol=lf
*.styleguide text eol=lf
*.txt text eol=lf
*.xml text eol=lf
*.yaml text eol=lf
*.yml text eol=lf

# Generated files
*/src/generated/** linguist-generated
4 changes: 2 additions & 2 deletions .github/workflows/lint-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
python-version: '3.10'
- name: Install wpiformat
run: pip3 install wpiformat==2024.34
run: pip3 install wpiformat==2024.38
- name: Run
run: wpiformat
- name: Check output
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:
with:
python-version: '3.10'
- name: Install wpiformat
run: pip3 install wpiformat==2024.34
run: pip3 install wpiformat==2024.38
- name: Create compile_commands.json
run: |
./gradlew generateCompileCommands -Ptoolchain-optional-roboRio
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/upstream-utils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ jobs:
cd upstream_utils
./gcem.py clone
./gcem.py copy-upstream-to-thirdparty
- name: Run googletest.py
run: |
cd upstream_utils
./googletest.py clone
./googletest.py copy-upstream-to-thirdparty
- name: Run json.py
run: |
cd upstream_utils
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ out/
# Fleet
.fleet

# jdtls
.factorypath

# Created by http://www.gitignore.io

### Linux ###
Expand Down
1 change: 1 addition & 0 deletions .styleguide
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cppSrcFileInclude {

modifiableFileExclude {
cmake/toolchains/
thirdparty/
\.patch$
gradlew
}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ set(CMAKE_SHARED_LINKER_FLAGS_UBSAN

if(WITH_TESTS)
enable_testing()
add_subdirectory(googletest)
add_subdirectory(thirdparty/googletest)
include(GoogleTest)
endif()

Expand Down
2 changes: 1 addition & 1 deletion apriltag/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -157,5 +157,5 @@ install(EXPORT apriltag DESTINATION share/apriltag)
if(WITH_TESTS)
wpilib_add_test(apriltag src/test/native/cpp)
target_include_directories(apriltag_test PRIVATE src/test/native/include)
target_link_libraries(apriltag_test apriltag gmock_main)
target_link_libraries(apriltag_test apriltag googletest)
endif()
1 change: 0 additions & 1 deletion apriltag/convert_apriltag_layouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import os

from wpimath import geometry, units
import numpy as np


def main():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ public boolean equals(Object obj) {
/** Quad threshold parameters. */
@SuppressWarnings("MemberName")
public static class QuadThresholdParameters {
/** Threshold used to reject quads containing too few pixels. Default is 5 pixels. */
public int minClusterPixels = 5;
/** Threshold used to reject quads containing too few pixels. Default is 300 pixels. */
public int minClusterPixels = 300;

/**
* How many corner candidates to consider when segmenting a group of pixels into a quad. Default
Expand All @@ -124,9 +124,9 @@ public static class QuadThresholdParameters {
/**
* Critical angle, in radians. The detector will reject quads where pairs of edges have angles
* that are close to straight or close to 180 degrees. Zero means that no quads are rejected.
* Default is 10 degrees.
* Default is 45 degrees.
*/
public double criticalAngle = 10 * Math.PI / 180.0;
public double criticalAngle = 45 * Math.PI / 180.0;

/**
* When fitting lines to the contours, the maximum mean squared error allowed. This is useful in
Expand Down Expand Up @@ -201,8 +201,10 @@ public boolean equals(Object obj) {
}

/** Constructs an AprilTagDetector. */
@SuppressWarnings("this-escape")
public AprilTagDetector() {
m_native = AprilTagJNI.createDetector();
setQuadThresholdParameters(new QuadThresholdParameters());
}

@Override
Expand Down
4 changes: 3 additions & 1 deletion apriltag/src/main/native/cpp/AprilTagDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ void AprilTagDetector::Results::Destroy() {
}
}

AprilTagDetector::AprilTagDetector() : m_impl{apriltag_detector_create()} {}
AprilTagDetector::AprilTagDetector() : m_impl{apriltag_detector_create()} {
SetQuadThresholdParameters({});
}

AprilTagDetector& AprilTagDetector::operator=(AprilTagDetector&& rhs) {
Destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class WPILIB_DLLEXPORT AprilTagDetector {
bool operator==(const QuadThresholdParameters&) const = default;

/**
* Threshold used to reject quads containing too few pixels. Default is 5
* Threshold used to reject quads containing too few pixels. Default is 300
* pixels.
*/
int minClusterPixels = 5;
int minClusterPixels = 300;

/**
* How many corner candidates to consider when segmenting a group of pixels
Expand All @@ -97,9 +97,9 @@ class WPILIB_DLLEXPORT AprilTagDetector {
/**
* Critical angle. The detector will reject quads where pairs of edges have
* angles that are close to straight or close to 180 degrees. Zero means
* that no quads are rejected. Default is 10 degrees.
* that no quads are rejected. Default is 45 degrees.
*/
units::radian_t criticalAngle = 10_deg;
units::radian_t criticalAngle = 45_deg;

/**
* When fitting lines to the contours, the maximum mean squared error
Expand Down
140 changes: 70 additions & 70 deletions buildSrc/src/main/groovy/DisableBuildingGTest.groovy
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@

import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.language.base.internal.ProjectLayout;
import org.gradle.language.base.plugins.ComponentModelBasePlugin;
import org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask;
import org.gradle.model.ModelMap;
import edu.wpi.first.toolchain.ToolchainExtension
import org.gradle.model.Mutate;
import org.gradle.api.plugins.ExtensionContainer;
import org.gradle.nativeplatform.test.googletest.GoogleTestTestSuiteBinarySpec;
import org.gradle.model.RuleSource;
import org.gradle.model.Validate;
import org.gradle.nativeplatform.NativeExecutableBinarySpec
import org.gradle.nativeplatform.NativeBinarySpec;
import org.gradle.nativeplatform.NativeComponentSpec;
import org.gradle.nativeplatform.NativeLibrarySpec;
import org.gradle.nativeplatform.SharedLibraryBinarySpec;
import org.gradle.nativeplatform.StaticLibraryBinarySpec;
import org.gradle.nativeplatform.platform.internal.NativePlatformInternal;
import org.gradle.nativeplatform.toolchain.NativeToolChain;
import org.gradle.nativeplatform.toolchain.NativeToolChainRegistry;
import org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider;
import org.gradle.nativeplatform.toolchain.internal.ToolType;
import org.gradle.nativeplatform.toolchain.internal.gcc.AbstractGccCompatibleToolChain;
import org.gradle.nativeplatform.toolchain.internal.msvcpp.VisualCppToolChain;
import org.gradle.nativeplatform.toolchain.internal.tools.ToolRegistry;
import org.gradle.platform.base.BinarySpec;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.BinaryContainer;
import org.gradle.platform.base.ComponentType;
import org.gradle.platform.base.TypeBuilder;
import org.gradle.nativeplatform.tasks.ObjectFilesToBinary;
import groovy.transform.CompileStatic;
import groovy.transform.CompileDynamic
import org.gradle.nativeplatform.BuildTypeContainer

@CompileStatic
class DisableBuildingGTest implements Plugin<Project> {
@CompileStatic
public void apply(Project project) {

}

@CompileStatic
static class Rules extends RuleSource {
@CompileDynamic
private static void setBuildableFalseDynamically(NativeBinarySpec binary) {
binary.buildable = false
}

@Validate
@CompileStatic
// TODO: Move this to tc plugin
void disableCrossTests(BinaryContainer binaries, ExtensionContainer extContainer) {
final ToolchainExtension ext = extContainer.getByType(ToolchainExtension.class);

for (GoogleTestTestSuiteBinarySpec binary : binaries.withType(GoogleTestTestSuiteBinarySpec.class)) {
if (ext.getCrossCompilers().findByName(binary.getTargetPlatform().getName()) != null) {
setBuildableFalseDynamically(binary)
}
}
}
}
}

import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.FileTree;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.language.base.internal.ProjectLayout;
import org.gradle.language.base.plugins.ComponentModelBasePlugin;
import org.gradle.language.nativeplatform.tasks.AbstractNativeSourceCompileTask;
import org.gradle.model.ModelMap;
import edu.wpi.first.toolchain.ToolchainExtension
import org.gradle.model.Mutate;
import org.gradle.api.plugins.ExtensionContainer;
import org.gradle.nativeplatform.test.googletest.GoogleTestTestSuiteBinarySpec;
import org.gradle.model.RuleSource;
import org.gradle.model.Validate;
import org.gradle.nativeplatform.NativeExecutableBinarySpec
import org.gradle.nativeplatform.NativeBinarySpec;
import org.gradle.nativeplatform.NativeComponentSpec;
import org.gradle.nativeplatform.NativeLibrarySpec;
import org.gradle.nativeplatform.SharedLibraryBinarySpec;
import org.gradle.nativeplatform.StaticLibraryBinarySpec;
import org.gradle.nativeplatform.platform.internal.NativePlatformInternal;
import org.gradle.nativeplatform.toolchain.NativeToolChain;
import org.gradle.nativeplatform.toolchain.NativeToolChainRegistry;
import org.gradle.nativeplatform.toolchain.internal.PlatformToolProvider;
import org.gradle.nativeplatform.toolchain.internal.ToolType;
import org.gradle.nativeplatform.toolchain.internal.gcc.AbstractGccCompatibleToolChain;
import org.gradle.nativeplatform.toolchain.internal.msvcpp.VisualCppToolChain;
import org.gradle.nativeplatform.toolchain.internal.tools.ToolRegistry;
import org.gradle.platform.base.BinarySpec;
import org.gradle.platform.base.ComponentSpec;
import org.gradle.platform.base.ComponentSpecContainer;
import org.gradle.platform.base.BinaryContainer;
import org.gradle.platform.base.ComponentType;
import org.gradle.platform.base.TypeBuilder;
import org.gradle.nativeplatform.tasks.ObjectFilesToBinary;
import groovy.transform.CompileStatic;
import groovy.transform.CompileDynamic
import org.gradle.nativeplatform.BuildTypeContainer

@CompileStatic
class DisableBuildingGTest implements Plugin<Project> {
@CompileStatic
public void apply(Project project) {

}

@CompileStatic
static class Rules extends RuleSource {
@CompileDynamic
private static void setBuildableFalseDynamically(NativeBinarySpec binary) {
binary.buildable = false
}

@Validate
@CompileStatic
// TODO: Move this to tc plugin
void disableCrossTests(BinaryContainer binaries, ExtensionContainer extContainer) {
final ToolchainExtension ext = extContainer.getByType(ToolchainExtension.class);

for (GoogleTestTestSuiteBinarySpec binary : binaries.withType(GoogleTestTestSuiteBinarySpec.class)) {
if (ext.getCrossCompilers().findByName(binary.getTargetPlatform().getName()) != null) {
setBuildableFalseDynamically(binary)
}
}
}
}
}
Loading

0 comments on commit e7d18a1

Please sign in to comment.