Skip to content

Commit

Permalink
Merge pull request #112 from deltacv/dev
Browse files Browse the repository at this point in the history
3.4.3
  • Loading branch information
serivesmejia committed Jul 4, 2024
2 parents dedbbe4 + 10fa506 commit 6c76b60
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: ./gradlew test

test_mac:
runs-on: macos-latest
runs-on: macos-13

steps:
- uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
fun loggerOf(name: String) = lazy { LoggerFactory.getLogger(name) }
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ class EOCVSim(val params: Parameters = Parameters()) {
)
}


updateVisualizerTitle() // update current pipeline in title
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ class EOCVSimCommandInterface : Runnable {
parameters.initialPipelineSource = initialPipelineSource
}


if (opencvNativePath != null) {
parameters.opencvNativeLibrary = checkPath("OpenCV Native", opencvNativePath!!, false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
}
}
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!

Expand All @@ -14,7 +14,13 @@ transfer it onto your robot!

<img src='doc/images/eocvsim_screenshot_1.png' width='75%' height='75%'>

## 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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Vision/src/main/java/android/graphics/Paint.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public Paint() {
}

public Paint(Paint paint) {
thePaint = paint.thePaint;
thePaint = paint.thePaint.makeClone();

typeface = paint.typeface;
textSize = paint.textSize;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import org.opencv.core.Mat;

public interface VisionSourced {
public interface FrameReceiver {

default void onFrameStart() {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<VisionSourced> sourceds = new ArrayList<>();
ArrayList<FrameReceiver> sourceds = new ArrayList<>();

SourceBaseHelperThread helperThread;

Expand All @@ -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);
}
Expand All @@ -88,7 +87,7 @@ public final boolean stop() {
public abstract Timestamped<Mat> pullFrame();

private Timestamped<Mat> pullFrameInternal() {
for(VisionSourced sourced : sourceds) {
for(FrameReceiver sourced : sourceds) {
synchronized (sourced) {
sourced.onFrameStart();
}
Expand Down Expand Up @@ -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");

Expand All @@ -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) {
Expand All @@ -150,7 +149,7 @@ public void run() {
}
}

for(VisionSourced sourced : sourceds) {
for(FrameReceiver sourced : sourceds) {
sourced.stop();
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ plugins {

allprojects {
group 'com.github.deltacv'
version '3.5.2'
version '3.5.3'

apply plugin: 'java'

Expand Down

0 comments on commit 6c76b60

Please sign in to comment.