Skip to content

Commit

Permalink
Freeing lock file on restart
Browse files Browse the repository at this point in the history
  • Loading branch information
serivesmejia committed Oct 10, 2024
1 parent e1c283d commit 199cecc
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
6 changes: 4 additions & 2 deletions EOCV-Sim/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io.github.fvarrui.javapackager.gradle.PackageTask

import java.nio.file.Paths
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
Expand Down Expand Up @@ -33,7 +35,7 @@ test {

apply from: '../test-logging.gradle'

tasks.register('pack', io.github.fvarrui.javapackager.gradle.PackageTask) {
tasks.register('pack', PackageTask) {
dependsOn build
// mandatory
mainClass = 'com.github.serivesmejia.eocvsim.Main'
Expand Down Expand Up @@ -73,7 +75,7 @@ dependencies {
implementation "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"

implementation "com.github.deltacv:steve:1.1.1"
api(apriltag_plugin_dependency) {
api("com.github.deltacv:AprilTagDesktop:$apriltag_plugin_version") {
exclude group: 'com.github.deltacv.EOCVSim', module: 'Common'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ class EOCVSim(val params: Parameters = Parameters()) {

if (isRestarting) {
Thread.interrupted() //clear interrupted flag
EOCVSimFolder.lock?.lock?.close()
JavaProcess.exec(Main::class.java, null, null)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,14 @@ public class Config {

public volatile List<String> superAccessPluginHashes = new ArrayList<>();

public volatile HashMap<String, Boolean> flags = new HashMap<>();

public boolean hasFlag(String flagName) {
return flags.get(flagName) != null;
}

public boolean getFlag(String flagName) {
return flags.get(flagName) != null && flags.get(flagName);
}

}
1 change: 0 additions & 1 deletion TeamCode/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ apply from: '../build.common.gradle'

dependencies {
implementation project(':EOCV-Sim')

implementation "org.jetbrains.kotlin:kotlin-stdlib"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,10 @@ public AprilTagDetectionPipeline(Telemetry telemetry) {
@Override
public void init(Mat frame)
{
// Allocate a native context object. See the corresponding deletion in the finalizer
// Allocate a native context object.
nativeApriltagPtr = AprilTagDetectorJNI.createApriltagDetector(AprilTagDetectorJNI.TagFamily.TAG_36h11.string, 3, 3);
}

@Override
public void finalize()
{
// Delete the native context we created in the init() function
AprilTagDetectorJNI.releaseApriltagDetector(nativeApriltagPtr);
}

@Override
public Mat processFrame(Mat input)
{
Expand Down
2 changes: 1 addition & 1 deletion Vision/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ configurations.all {
dependencies {
implementation project(':Common')

implementation(apriltag_plugin_dependency) {
implementation("com.github.deltacv:AprilTagDesktop:$apriltag_plugin_version") {
exclude group: 'com.github.deltacv.EOCVSim', module: 'Common'
}

Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ buildscript {
log4j_version = "2.17.1"
opencv_version = "4.7.0-0"
apriltag_plugin_version = "2.1.0-B"
apriltag_plugin_dependency = "com.github.deltacv:AprilTagDesktop:$apriltag_plugin_version"

skiko_version = "0.8.15"

classgraph_version = "4.8.108"
classgraph_version = "4.8.112"
opencsv_version = "5.5.2"

env = findProperty('env') == 'release' ? 'release' : 'dev'
Expand Down

0 comments on commit 199cecc

Please sign in to comment.