diff --git a/.github/workflows/build_ci.yml b/.github/workflows/build_ci.yml index 561e7b6b..0075d40a 100644 --- a/.github/workflows/build_ci.yml +++ b/.github/workflows/build_ci.yml @@ -35,7 +35,7 @@ jobs: run: ./gradlew test test_mac: - runs-on: macos-latest + runs-on: macos-13 steps: - uses: actions/checkout@v2 diff --git a/Common/src/main/java/com/github/serivesmejia/eocvsim/util/LogExt.kt b/Common/src/main/java/com/github/serivesmejia/eocvsim/util/LogExt.kt index b499ac9d..40dac066 100644 --- a/Common/src/main/java/com/github/serivesmejia/eocvsim/util/LogExt.kt +++ b/Common/src/main/java/com/github/serivesmejia/eocvsim/util/LogExt.kt @@ -6,4 +6,4 @@ import kotlin.reflect.KClass fun Any.loggerFor(clazz: KClass<*>) = lazy { LoggerFactory.getLogger(clazz.java) } fun Any.loggerForThis() = lazy { LoggerFactory.getLogger(this::class.java) } -fun Any.loggerOf(name: String) = lazy { LoggerFactory.getLogger(name) } \ No newline at end of file +fun loggerOf(name: String) = lazy { LoggerFactory.getLogger(name) } \ No newline at end of file diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt index fd5b8000..4f4d30bc 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt @@ -261,7 +261,6 @@ class EOCVSim(val params: Parameters = Parameters()) { ) } - updateVisualizerTitle() // update current pipeline in title } diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/Main.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/Main.kt index d10ca12e..4793c94c 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/Main.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/Main.kt @@ -62,7 +62,6 @@ class EOCVSimCommandInterface : Runnable { parameters.initialPipelineSource = initialPipelineSource } - if (opencvNativePath != null) { parameters.opencvNativeLibrary = checkPath("OpenCV Native", opencvNativePath!!, false) } diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/pipeline/PipelineManager.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/pipeline/PipelineManager.kt index 5538e733..3617079a 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/pipeline/PipelineManager.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/pipeline/PipelineManager.kt @@ -356,9 +356,7 @@ class PipelineManager( if(!hasInitCurrentPipeline) { pipelineExceptionTracker.addMessage("Error while initializing requested pipeline, \"$currentPipelineName\". Falling back to previous one.") pipelineExceptionTracker.addMessage( - StrUtil.cutStringBy( - StrUtil.fromException(ex), "\n", 9 - ).trim() + StrUtil.fromException(ex).trim() ) eocvSim.visualizer.pipelineSelectorPanel.selectedIndex = previousPipelineIndex @@ -795,7 +793,8 @@ enum class PipelineFps(val fps: Int, val coolName: String) { LOW(10, "Low (10 FPS)"), MEDIUM(30, "Medium (30 FPS)"), HIGH(60, "High (60 FPS)"), - HIGHEST(100, "Highest (100 FPS)"); + HIGHEST(100, "Highest (100 FPS)"), + UNLIMITED_POWER(Int.MAX_VALUE, "Unlimited Power! (no FPS cap)"); companion object { @JvmStatic diff --git a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/util/compiler/CompilerProvider.kt b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/util/compiler/CompilerProvider.kt index ad13dd0e..d66b0096 100644 --- a/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/util/compiler/CompilerProvider.kt +++ b/EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/util/compiler/CompilerProvider.kt @@ -23,12 +23,20 @@ package com.github.serivesmejia.eocvsim.util.compiler +import com.github.serivesmejia.eocvsim.util.loggerOf import org.eclipse.jdt.internal.compiler.tool.EclipseCompiler import javax.tools.JavaCompiler import javax.tools.ToolProvider +private val logger by loggerOf("CompilerProvider") + val compiler by lazy { - val toolProviderCompiler = ToolProvider.getSystemJavaCompiler() + val toolProviderCompiler = try { + ToolProvider.getSystemJavaCompiler() + } catch(e: Exception) { + logger.warn("ToolProvider threw an exception on getSystemJavaCompiler()", e) + null + } try { if (toolProviderCompiler == null) { @@ -37,6 +45,7 @@ val compiler by lazy { Compiler("JDK", toolProviderCompiler) } } catch(e: Exception) { + logger.warn("Unexpected exception while providing a java compiler", e) null } } diff --git a/README.md b/README.md index ac5c9bfd..e13575f8 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ ![Java CI with Gradle](https://github.com/deltacv/EOCV-Sim/workflows/Build%20and%20test%20with%20Gradle/badge.svg) [![](https://jitpack.io/v/deltacv/EOCV-Sim.svg)](https://jitpack.io/#deltacv/EOCV-Sim) -[![Run on Repl.it](https://repl.it/badge/github/deltacv/EOCV-Sim)](https://repl.it/github/deltacv/EOCV-Sim) +[![Run on Repl.it](https://repl.it/badge/github/deltacv/EOCV-Sim)](https://repl.it/github/deltacv/EOCV-Sim) # Welcome! @@ -14,7 +14,13 @@ transfer it onto your robot! -## Learn how to install and use the simulator in the [documentation here](https://deltacv.gitbook.io/eocv-sim/) +### Learn how to install and use the simulator in the [documentation here](https://deltacv.gitbook.io/eocv-sim/) + +# [Buy me a coffee](https://buymeacoffee.com/serivesmejia) + +For the past 4 years I've been developing and maintaining learning tools for robotics kids to have a better understanding of programming and computer vision. Now that I've graduated from the robotics competition and I'm headed to college it is my goal to keep maintaining and improving these tools for future generations to keep learning, completely cost-free and open source. Your donation in [buy me a coffee](https://buymeacoffee.com/serivesmejia) will help me maintain those goals through the following years as life gets busier. It is completely voluntary, but your donation through Buy Me a Coffee will help ensure these tools remain accessible and continuously improved for future robotics enthusiasts. Thank you for considering supporting my passion for robotics! + +\- Sebastian Erives, deltacv's main dev # Compatibility @@ -72,6 +78,11 @@ For bug reporting or feature requesting, use the [issues tab](https://github.com ### Formerly, EOCV-Sim was hosted on a [personal account repo](https://github.com/serivesmejia/EOCV-Sim/). Released prior to 3.0.0 can be found there for historic purposes. +### [v3.5.3 - CenterStage AprilTags](https://github.com/deltacv/EOCV-Sim/releases/tag/v3.5.3) + - This is the 21st release for EOCV-Sim + - Bug fixes: + - Addresses #110 by properly cloning underlying skiko Paint in android.graphics.Paint(Paint) constructor + ### [v3.5.2 - CenterStage AprilTags](https://github.com/deltacv/EOCV-Sim/releases/tag/v3.5.2) - This is the 20th release for EOCV-Sim - Changelog diff --git a/Vision/src/main/java/android/graphics/Paint.java b/Vision/src/main/java/android/graphics/Paint.java index 1aff5285..2abbccb1 100644 --- a/Vision/src/main/java/android/graphics/Paint.java +++ b/Vision/src/main/java/android/graphics/Paint.java @@ -186,7 +186,7 @@ public Paint() { } public Paint(Paint paint) { - thePaint = paint.thePaint; + thePaint = paint.thePaint.makeClone(); typeface = paint.typeface; textSize = paint.textSize; diff --git a/Vision/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java b/Vision/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java index 540015f0..779bfe32 100644 --- a/Vision/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java +++ b/Vision/src/main/java/com/qualcomm/robotcore/eventloop/opmode/OpMode.java @@ -136,7 +136,7 @@ public final Mat processFrame(Mat input, long captureTimeNanos) { switch(notification) { case INIT: - if(notifier.getState() == OpModeState.START) break; + if(notifier.getState() != OpModeState.SELECTED) break; init(); notifier.notify(OpModeState.INIT); diff --git a/Vision/src/main/java/io/github/deltacv/vision/external/SourcedOpenCvCamera.java b/Vision/src/main/java/io/github/deltacv/vision/external/SourcedOpenCvCamera.java index f4908445..5d6257e6 100644 --- a/Vision/src/main/java/io/github/deltacv/vision/external/SourcedOpenCvCamera.java +++ b/Vision/src/main/java/io/github/deltacv/vision/external/SourcedOpenCvCamera.java @@ -24,13 +24,13 @@ package io.github.deltacv.vision.external; import io.github.deltacv.vision.external.source.VisionSource; -import io.github.deltacv.vision.external.source.VisionSourced; +import io.github.deltacv.vision.external.source.FrameReceiver; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.Size; import org.openftc.easyopencv.*; -public class SourcedOpenCvCamera extends OpenCvCameraBase implements OpenCvWebcam, VisionSourced { +public class SourcedOpenCvCamera extends OpenCvCameraBase implements OpenCvWebcam, FrameReceiver { private final VisionSource source; OpenCvViewport handedViewport; diff --git a/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSourced.java b/Vision/src/main/java/io/github/deltacv/vision/external/source/FrameReceiver.java similarity index 97% rename from Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSourced.java rename to Vision/src/main/java/io/github/deltacv/vision/external/source/FrameReceiver.java index 4274c289..1ce3f3e6 100644 --- a/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSourced.java +++ b/Vision/src/main/java/io/github/deltacv/vision/external/source/FrameReceiver.java @@ -25,7 +25,7 @@ import org.opencv.core.Mat; -public interface VisionSourced { +public interface FrameReceiver { default void onFrameStart() {} diff --git a/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSource.java b/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSource.java index 213251b0..5efe9d0e 100644 --- a/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSource.java +++ b/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSource.java @@ -31,8 +31,8 @@ public interface VisionSource { boolean start(Size requestedSize); - boolean attach(VisionSourced sourced); - boolean remove(VisionSourced sourced); + boolean attach(FrameReceiver sourced); + boolean remove(FrameReceiver sourced); boolean stop(); diff --git a/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSourceBase.java b/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSourceBase.java index 360944ac..57793412 100644 --- a/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSourceBase.java +++ b/Vision/src/main/java/io/github/deltacv/vision/external/source/VisionSourceBase.java @@ -31,13 +31,12 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; -import java.util.Arrays; public abstract class VisionSourceBase implements VisionSource { private final Object lock = new Object(); - ArrayList sourceds = new ArrayList<>(); + ArrayList sourceds = new ArrayList<>(); SourceBaseHelperThread helperThread; @@ -61,14 +60,14 @@ public final boolean start(Size size) { public abstract boolean startSource(Size size); @Override - public boolean attach(VisionSourced sourced) { + public boolean attach(FrameReceiver sourced) { synchronized (lock) { return sourceds.add(sourced); } } @Override - public boolean remove(VisionSourced sourced) { + public boolean remove(FrameReceiver sourced) { synchronized (lock) { return sourceds.remove(sourced); } @@ -88,7 +87,7 @@ public final boolean stop() { public abstract Timestamped pullFrame(); private Timestamped pullFrameInternal() { - for(VisionSourced sourced : sourceds) { + for(FrameReceiver sourced : sourceds) { synchronized (sourced) { sourced.onFrameStart(); } @@ -116,7 +115,7 @@ public SourceBaseHelperThread(VisionSourceBase sourcedBase, ThrowableHandler thr @Override public void run() { - VisionSourced[] sourceds = new VisionSourced[0]; + FrameReceiver[] sourceds = new FrameReceiver[0]; logger.info("starting"); @@ -134,10 +133,10 @@ public void run() { } synchronized (sourceBase.lock) { - sourceds = sourceBase.sourceds.toArray(new VisionSourced[0]); + sourceds = sourceBase.sourceds.toArray(new FrameReceiver[0]); } - for (VisionSourced sourced : sourceds) { + for (FrameReceiver sourced : sourceds) { try { sourced.onNewFrame(frame.getValue(), frame.getTimestamp()); } catch(Throwable e) { @@ -150,7 +149,7 @@ public void run() { } } - for(VisionSourced sourced : sourceds) { + for(FrameReceiver sourced : sourceds) { sourced.stop(); } diff --git a/build.gradle b/build.gradle index 30ab8308..397db7b8 100644 --- a/build.gradle +++ b/build.gradle @@ -37,7 +37,7 @@ plugins { allprojects { group 'com.github.deltacv' - version '3.5.2' + version '3.5.3' apply plugin: 'java'