mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-19 00:41:41 +00:00
This PR changes the way that photonvision interacts with nmcli to control networking on the coprocessor. Instead of modifying an existing connection, Photonvision adds new connections for DHCP and Static IP configurations. It then activiates the proper one at startup and any time that the network configuration is changed. It also now uses the interface name and not the connection name and checks that the interface is available before making any changes. If the saved interface is not found, it updates the stored interface name and applies the network settings to the current interface. This should minimize the failure to control the network if the network interface wasn't available when PhotonVision first booted. One other benefit of not altering the default configuration is that, if PhotonVision fails to run for any reason, the device can be accessed using the original networking configuration. The code has been tested on an OrangePi5 and and a Raspberry Pi 4. Addresses: #1261
129 lines
5.0 KiB
Groovy
129 lines
5.0 KiB
Groovy
// Plugins
|
|
apply plugin: "java"
|
|
apply plugin: "jacoco"
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
wpilibTools.deps.wpilibVersion = wpilibVersion
|
|
|
|
// Tell gradlerio what version of things to use (that we care about)
|
|
// See: https://github.com/wpilibsuite/GradleRIO/blob/main/src/main/java/edu/wpi/first/gradlerio/wpi/WPIVersionsExtension.java
|
|
wpi.getVersions().getOpencvVersion().convention(openCVversion);
|
|
wpi.getVersions().getWpilibVersion().convention(wpilibVersion);
|
|
wpi.getVersions().getWpimathVersion().convention(wpimathVersion);
|
|
|
|
dependencies {
|
|
implementation project(':photon-targeting')
|
|
|
|
implementation "io.javalin:javalin:$javalinVersion"
|
|
|
|
implementation 'org.msgpack:msgpack-core:0.9.0'
|
|
implementation 'org.msgpack:jackson-dataformat-msgpack:0.9.0'
|
|
|
|
implementation wpilibTools.deps.wpilibJava("wpiutil")
|
|
implementation wpilibTools.deps.wpilibJava("cameraserver")
|
|
implementation wpilibTools.deps.wpilibJava("cscore")
|
|
implementation wpilibTools.deps.wpilibJava("wpinet")
|
|
implementation wpilibTools.deps.wpilibJava("wpimath")
|
|
implementation wpilibTools.deps.wpilibJava("ntcore")
|
|
implementation wpilibTools.deps.wpilibJava("hal")
|
|
implementation wpilibTools.deps.wpilibJava("wpilibj")
|
|
implementation wpilibTools.deps.wpilibJava("apriltag")
|
|
implementation wpilibTools.deps.wpilibJava("wpiunits")
|
|
implementation wpilibTools.deps.wpilibOpenCvJava("frc" + wpi.frcYear.get(), wpi.versions.opencvVersion.get())
|
|
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: wpi.versions.jacksonVersion.get()
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-core", version: wpi.versions.jacksonVersion.get()
|
|
implementation group: "com.fasterxml.jackson.core", name: "jackson-databind", version: wpi.versions.jacksonVersion.get()
|
|
|
|
implementation group: "org.ejml", name: "ejml-simple", version: wpi.versions.ejmlVersion.get()
|
|
implementation group: "us.hebi.quickbuf", name: "quickbuf-runtime", version: wpi.versions.quickbufVersion.get();
|
|
|
|
implementation "commons-io:commons-io:2.11.0"
|
|
implementation "commons-cli:commons-cli:1.5.0"
|
|
implementation "org.apache.commons:commons-lang3:3.12.0"
|
|
implementation "org.apache.commons:commons-collections4:4.4"
|
|
implementation "org.apache.commons:commons-exec:1.3"
|
|
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.10.0'
|
|
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.10.0'
|
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.10.0'
|
|
}
|
|
|
|
test {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events "passed", "skipped", "failed", "standardOut", "standardError"
|
|
}
|
|
workingDir = new File("${rootDir}")
|
|
finalizedBy jacocoTestReport
|
|
}
|
|
|
|
tasks.register('testHeadless', Test) {
|
|
group = "verification"
|
|
systemProperty("java.awt.headless", "true")
|
|
useJUnitPlatform()
|
|
exclude '**/*BenchmarkTest*'
|
|
workingDir = "../"
|
|
}
|
|
|
|
tasks.register('generateJavaDocs', Javadoc) {
|
|
source = sourceSets.main.allJava
|
|
classpath = sourceSets.main.compileClasspath
|
|
destinationDir = file("${projectDir}/build/docs")
|
|
|
|
options.addBooleanOption("Xdoclint:html,missing,reference,syntax", true)
|
|
options.addBooleanOption('html5', true)
|
|
|
|
if (JavaVersion.current().isJava8Compatible() && project.hasProperty('docWarningsAsErrors')) {
|
|
// Treat javadoc warnings as errors.
|
|
//
|
|
// The second argument '-quiet' is a hack. The one parameter
|
|
// addStringOption() doesn't work, so we add '-quiet', which is added
|
|
// anyway by gradle. See https://github.com/gradle/gradle/issues/2354.
|
|
//
|
|
// See JDK-8200363 (https://bugs.openjdk.java.net/browse/JDK-8200363)
|
|
// for information about the nonstandard -Xwerror option. JDK 15+ has
|
|
// -Werror.
|
|
options.addStringOption('Xwerror', '-quiet')
|
|
}
|
|
|
|
if (JavaVersion.current().isJava11Compatible()) {
|
|
if (!JavaVersion.current().isJava12Compatible()) {
|
|
options.addBooleanOption('-no-module-directories', true)
|
|
}
|
|
doLast {
|
|
// This is a work-around for https://bugs.openjdk.java.net/browse/JDK-8211194. Can be removed once that issue is fixed on JDK's side
|
|
// Since JDK 11, package-list is missing from javadoc output files and superseded by element-list file, but a lot of external tools still need it
|
|
// Here we generate this file manually
|
|
new File(destinationDir, 'package-list').text = new File(destinationDir, 'element-list').text
|
|
}
|
|
}
|
|
}
|
|
|
|
jacoco {
|
|
toolVersion = "0.8.10"
|
|
reportsDirectory = layout.buildDirectory.dir('customJacocoReportDir')
|
|
}
|
|
|
|
jacocoTestReport {
|
|
dependsOn testHeadless
|
|
|
|
reports {
|
|
xml.required = true
|
|
csv.required = false
|
|
html.outputLocation = layout.buildDirectory.dir('jacocoHtml')
|
|
}
|
|
|
|
afterEvaluate {
|
|
classDirectories.setFrom(files(classDirectories.files.collect {
|
|
fileTree(dir: it,
|
|
exclude: "edu/wpi/**"
|
|
)
|
|
}))
|
|
}
|
|
}
|