mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-05 03:21:40 +00:00
Split photon-server and photon-core (#211)
Uses multiple Gradle projects to support the split.
This commit is contained in:
34
.github/workflows/main.yml
vendored
34
.github/workflows/main.yml
vendored
@@ -50,11 +50,6 @@ jobs:
|
|||||||
path: photon-client/dist/
|
path: photon-client/dist/
|
||||||
|
|
||||||
build-server:
|
build-server:
|
||||||
# Let all steps run within the photon-server dir.
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: photon-server
|
|
||||||
|
|
||||||
# The type of runner that the job will run on.
|
# The type of runner that the job will run on.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -84,11 +79,16 @@ jobs:
|
|||||||
run: ./gradlew jacocoTestReport
|
run: ./gradlew jacocoTestReport
|
||||||
|
|
||||||
# Publish Coverage Report.
|
# Publish Coverage Report.
|
||||||
- name: Publish Coverage Report
|
- name: Publish Server Coverage Report
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v1
|
||||||
with:
|
with:
|
||||||
file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml
|
file: ./photon-server/build/reports/jacoco/test/jacocoTestReport.xml
|
||||||
|
|
||||||
|
- name: Publish Core Coverage Report
|
||||||
|
uses: codecov/codecov-action@v1
|
||||||
|
with:
|
||||||
|
file: ./photon-core/build/reports/jacoco/test/jacocoTestReport.xml
|
||||||
|
|
||||||
build-offline-docs:
|
build-offline-docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -128,11 +128,6 @@ jobs:
|
|||||||
build-package:
|
build-package:
|
||||||
needs: [build-client, build-server, build-offline-docs]
|
needs: [build-client, build-server, build-offline-docs]
|
||||||
|
|
||||||
# Let all steps run within the photon-server dir.
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: photon-server
|
|
||||||
|
|
||||||
# The type of runner that the job will run on.
|
# The type of runner that the job will run on.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -147,8 +142,8 @@ jobs:
|
|||||||
|
|
||||||
# Clear any existing web resources.
|
# Clear any existing web resources.
|
||||||
- run: |
|
- run: |
|
||||||
rm -rf src/main/resources/web/*
|
rm -rf photon-server/src/main/resources/web/*
|
||||||
mkdir -p src/main/resources/web/docs
|
mkdir -p photon-server/src/main/resources/web/docs
|
||||||
|
|
||||||
# Download client artifact to resources folder.
|
# Download client artifact to resources folder.
|
||||||
- uses: actions/download-artifact@v2
|
- uses: actions/download-artifact@v2
|
||||||
@@ -162,16 +157,10 @@ jobs:
|
|||||||
name: built-docs
|
name: built-docs
|
||||||
path: photon-server/src/main/resources/web/docs
|
path: photon-server/src/main/resources/web/docs
|
||||||
|
|
||||||
|
|
||||||
# Print folder contents.
|
|
||||||
- run: ls
|
|
||||||
working-directory: photon-server/src/main/resources/web/
|
|
||||||
|
|
||||||
# Build fat jar.
|
# Build fat jar.
|
||||||
- run: |
|
- run: |
|
||||||
chmod +x gradlew
|
chmod +x gradlew
|
||||||
./gradlew shadowJar
|
./gradlew photon-server:shadowJar
|
||||||
working-directory: photon-server
|
|
||||||
|
|
||||||
# Upload final fat jar as artifact.
|
# Upload final fat jar as artifact.
|
||||||
- uses: actions/upload-artifact@master
|
- uses: actions/upload-artifact@master
|
||||||
@@ -189,11 +178,6 @@ jobs:
|
|||||||
if: github.event_name == 'push'
|
if: github.event_name == 'push'
|
||||||
|
|
||||||
check-lint:
|
check-lint:
|
||||||
# Let all steps run within the photon-server dir.
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: photon-server
|
|
||||||
|
|
||||||
# The type of runner that the job will run on.
|
# The type of runner that the job will run on.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -126,3 +126,8 @@ photon-server/photon-vision
|
|||||||
photon-server/src/main/resources/web
|
photon-server/src/main/resources/web
|
||||||
photon-server/src/main/java/org/photonvision/PhotonVersion.java
|
photon-server/src/main/java/org/photonvision/PhotonVersion.java
|
||||||
photon-server/src/main/generated/native/include/org_photonvision_raspi_PicamJNI.h
|
photon-server/src/main/generated/native/include/org_photonvision_raspi_PicamJNI.h
|
||||||
|
*.bin
|
||||||
|
.gradle
|
||||||
|
.gradle/*
|
||||||
|
photonvision_config
|
||||||
|
build/spotlessJava
|
||||||
|
|||||||
32
build.gradle
Normal file
32
build.gradle
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
plugins {
|
||||||
|
id "com.diffplug.gradle.spotless" version "3.28.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
|
maven {
|
||||||
|
url = "https://maven.photonvision.org/repository/internal/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url = 'https://frcmaven.wpi.edu:443/artifactory/development'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
spotless {
|
||||||
|
java {
|
||||||
|
googleJavaFormat()
|
||||||
|
paddedCell()
|
||||||
|
indentWithTabs(2)
|
||||||
|
indentWithSpaces(4)
|
||||||
|
removeUnusedImports()
|
||||||
|
}
|
||||||
|
java {
|
||||||
|
target '**/*.java'
|
||||||
|
licenseHeaderFile "$rootDir/LicenseHeader.txt"
|
||||||
|
|
||||||
|
targetExclude('photon-core/src/main/java/org/photonvision/PhotonVersion.java')
|
||||||
|
}
|
||||||
|
}
|
||||||
93
common.gradle
Normal file
93
common.gradle
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
// Plugins
|
||||||
|
apply plugin: 'jacoco'
|
||||||
|
apply plugin: 'java'
|
||||||
|
|
||||||
|
sourceCompatibility = 11
|
||||||
|
|
||||||
|
// Common version config
|
||||||
|
ext {
|
||||||
|
wpilibVersion = '2020.3.2-99-g9f4de91'
|
||||||
|
joglVersion = '2.4.0-rc-20200307'
|
||||||
|
openCVVersion = '3.4.7-2'
|
||||||
|
}
|
||||||
|
|
||||||
|
// Common deps
|
||||||
|
dependencies {
|
||||||
|
// Jackson
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-annotations:2.10.0"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-core:2.10.0"
|
||||||
|
implementation "com.fasterxml.jackson.core:jackson-databind:2.10.0"
|
||||||
|
|
||||||
|
// Apache commons
|
||||||
|
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.9'
|
||||||
|
implementation 'org.apache.commons:commons-math3:3.6.1'
|
||||||
|
implementation group: 'commons-io', name: 'commons-io', version: '2.6'
|
||||||
|
implementation group: 'commons-cli', name: 'commons-cli', version: '1.4'
|
||||||
|
implementation 'org.apache.commons:commons-collections4:4.4'
|
||||||
|
implementation 'org.apache.commons:commons-exec:1.3'
|
||||||
|
|
||||||
|
// WPILib deps
|
||||||
|
implementation "edu.wpi.first.wpiutil:wpiutil-java:$wpilibVersion"
|
||||||
|
implementation "edu.wpi.first.cameraserver:cameraserver-java:$wpilibVersion"
|
||||||
|
|
||||||
|
implementation "edu.wpi.first.cscore:cscore-java:$wpilibVersion"
|
||||||
|
compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxaarch64bionic"
|
||||||
|
compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxraspbian"
|
||||||
|
compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:linuxx86-64"
|
||||||
|
compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:osxx86-64"
|
||||||
|
compile "edu.wpi.first.cscore:cscore-jni:$wpilibVersion:windowsx86-64"
|
||||||
|
|
||||||
|
implementation "edu.wpi.first.ntcore:ntcore-java:$wpilibVersion"
|
||||||
|
compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxaarch64bionic"
|
||||||
|
compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxraspbian"
|
||||||
|
compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:linuxx86-64"
|
||||||
|
compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:osxx86-64"
|
||||||
|
compile "edu.wpi.first.ntcore:ntcore-jni:$wpilibVersion:windowsx86-64"
|
||||||
|
|
||||||
|
implementation "edu.wpi.first.thirdparty.frc2020.opencv:opencv-java:$openCVVersion"
|
||||||
|
compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:linuxaarch64bionic"
|
||||||
|
compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:linuxraspbian"
|
||||||
|
compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:linuxx86-64"
|
||||||
|
compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:osxx86-64"
|
||||||
|
compile "edu.wpi.first.thirdparty.frc2020.opencv:opencv-jni:$openCVVersion:windowsx86-64"
|
||||||
|
|
||||||
|
implementation 'edu.wpi.first.wpimath:wpimath-java:2021.1.2-9-g26584ff'
|
||||||
|
|
||||||
|
// test stuff
|
||||||
|
testImplementation('org.junit.jupiter:junit-jupiter:5.6.0')
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
testLogging {
|
||||||
|
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task testHeadless(type: Test) {
|
||||||
|
group = 'verification'
|
||||||
|
systemProperty("java.awt.headless", "true")
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
|
|
||||||
|
task generateJavaDocs(type: Javadoc) {
|
||||||
|
source = sourceSets.main.allJava
|
||||||
|
classpath = sourceSets.main.compileClasspath
|
||||||
|
destinationDir = file("${projectDir}/build/docs")
|
||||||
|
}
|
||||||
|
|
||||||
|
jacocoTestReport {
|
||||||
|
dependsOn test // Tests are required to run before generating the report
|
||||||
|
|
||||||
|
reports {
|
||||||
|
xml.enabled true
|
||||||
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
|
classDirectories.setFrom(files(classDirectories.files.collect {
|
||||||
|
fileTree(dir: it,
|
||||||
|
exclude: 'edu/wpi/**'
|
||||||
|
)
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||||
distributionSha256Sum=5a3578b9f0bb162f5e08cf119f447dfb8fa950cedebb4d2a977e912a11a74b91
|
distributionSha256Sum=3239b5ed86c3838a37d983ac100573f64c1f3fd8e1eb6c89fa5f9529b5ec091d
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
0
photon-server/gradlew → gradlew
vendored
Executable file → Normal file
0
photon-server/gradlew → gradlew
vendored
Executable file → Normal file
0
photon-server/gradlew.bat → gradlew.bat
vendored
0
photon-server/gradlew.bat → gradlew.bat
vendored
13
photon-core/.gitignore
vendored
Normal file
13
photon-core/.gitignore
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
bin/*
|
||||||
|
.settings/*
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
*.prefs
|
||||||
|
.gradle
|
||||||
|
.gradle/*
|
||||||
|
build
|
||||||
|
build/*
|
||||||
|
photonvision/*
|
||||||
|
photonvision_config/*
|
||||||
|
|
||||||
|
src/main/java/org/photonvision/PhotonVersion.java
|
||||||
19
photon-core/build.gradle
Normal file
19
photon-core/build.gradle
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
apply from: '../common.gradle'
|
||||||
|
apply from: 'versioningHelper.gradle'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'io.javalin:javalin:3.7.0'
|
||||||
|
|
||||||
|
implementation 'org.msgpack:msgpack-core:0.8.20'
|
||||||
|
implementation 'org.msgpack:jackson-dataformat-msgpack:0.8.20'
|
||||||
|
|
||||||
|
// JOGL stuff (currently we only distribute for aarch64, which is Pi 4)
|
||||||
|
implementation "org.jogamp.gluegen:gluegen-rt:$joglVersion"
|
||||||
|
implementation "org.jogamp.jogl:jogl-all:$joglVersion"
|
||||||
|
|
||||||
|
implementation "org.jogamp.gluegen:gluegen-rt:$joglVersion:natives-linux-aarch64"
|
||||||
|
implementation "org.jogamp.jogl:jogl-all:$joglVersion:natives-linux-aarch64"
|
||||||
|
|
||||||
|
// Zip
|
||||||
|
compile 'org.zeroturnaround:zt-zip:1.14'
|
||||||
|
}
|
||||||
BIN
photon-core/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
photon-core/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
photon-core/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
photon-core/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||||
|
distributionSha256Sum=3239b5ed86c3838a37d983ac100573f64c1f3fd8e1eb6c89fa5f9529b5ec091d
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
2
photon-core/settings.gradle
Normal file
2
photon-core/settings.gradle
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
rootProject.name = 'photon-core'
|
||||||
|
|
||||||
@@ -34,6 +34,13 @@ public class OutgoingUIEvent<T> extends DataChangeEvent<T> {
|
|||||||
this.originContext = originContext;
|
this.originContext = originContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static OutgoingUIEvent<HashMap<String, Object>> wrappedOf(
|
||||||
|
String commandName, Object value) {
|
||||||
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
|
data.put(commandName, value);
|
||||||
|
return new OutgoingUIEvent<>(commandName, data);
|
||||||
|
}
|
||||||
|
|
||||||
public static OutgoingUIEvent<HashMap<String, Object>> wrappedOf(
|
public static OutgoingUIEvent<HashMap<String, Object>> wrappedOf(
|
||||||
String commandName, String propertyName, Object value, WsContext originContext) {
|
String commandName, String propertyName, Object value, WsContext originContext) {
|
||||||
HashMap<String, Object> data = new HashMap<>();
|
HashMap<String, Object> data = new HashMap<>();
|
||||||
@@ -17,14 +17,13 @@
|
|||||||
|
|
||||||
package org.photonvision.common.dataflow.websocket;
|
package org.photonvision.common.dataflow.websocket;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import org.photonvision.common.dataflow.CVPipelineResultConsumer;
|
import org.photonvision.common.dataflow.CVPipelineResultConsumer;
|
||||||
|
import org.photonvision.common.dataflow.DataChangeService;
|
||||||
|
import org.photonvision.common.dataflow.events.OutgoingUIEvent;
|
||||||
import org.photonvision.common.logging.LogGroup;
|
import org.photonvision.common.logging.LogGroup;
|
||||||
import org.photonvision.common.logging.Logger;
|
import org.photonvision.common.logging.Logger;
|
||||||
import org.photonvision.server.SocketHandler;
|
|
||||||
import org.photonvision.vision.pipeline.result.CVPipelineResult;
|
import org.photonvision.vision.pipeline.result.CVPipelineResult;
|
||||||
|
|
||||||
public class UIDataPublisher implements CVPipelineResultConsumer {
|
public class UIDataPublisher implements CVPipelineResultConsumer {
|
||||||
@@ -57,18 +56,10 @@ public class UIDataPublisher implements CVPipelineResultConsumer {
|
|||||||
uiTargets.add(t.toHashMap());
|
uiTargets.add(t.toHashMap());
|
||||||
}
|
}
|
||||||
dataMap.put("targets", uiTargets);
|
dataMap.put("targets", uiTargets);
|
||||||
|
|
||||||
uiMap.put(index, dataMap);
|
uiMap.put(index, dataMap);
|
||||||
var retMap = new HashMap<String, Object>();
|
|
||||||
retMap.put("updatePipelineResult", uiMap);
|
|
||||||
|
|
||||||
try {
|
|
||||||
SocketHandler.getInstance().broadcastMessage(retMap, null);
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
logger.error(e.getMessage());
|
|
||||||
logger.error(Arrays.toString(e.getStackTrace()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
DataChangeService.getInstance()
|
||||||
|
.publishEvent(OutgoingUIEvent.wrappedOf("updatePipelineResult", uiMap));
|
||||||
lastUIResultUpdateTime = now;
|
lastUIResultUpdateTime = now;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,13 +17,13 @@
|
|||||||
|
|
||||||
package org.photonvision.common.hardware.metrics;
|
package org.photonvision.common.hardware.metrics;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import org.photonvision.common.dataflow.DataChangeService;
|
||||||
|
import org.photonvision.common.dataflow.events.OutgoingUIEvent;
|
||||||
import org.photonvision.common.hardware.Platform;
|
import org.photonvision.common.hardware.Platform;
|
||||||
import org.photonvision.common.logging.LogGroup;
|
import org.photonvision.common.logging.LogGroup;
|
||||||
import org.photonvision.common.logging.Logger;
|
import org.photonvision.common.logging.Logger;
|
||||||
import org.photonvision.common.util.TimedTaskManager;
|
import org.photonvision.common.util.TimedTaskManager;
|
||||||
import org.photonvision.server.SocketHandler;
|
|
||||||
|
|
||||||
public class MetricsPublisher {
|
public class MetricsPublisher {
|
||||||
private static final Logger logger = new Logger(MetricsPublisher.class, LogGroup.General);
|
private static final Logger logger = new Logger(MetricsPublisher.class, LogGroup.General);
|
||||||
@@ -65,14 +65,7 @@ public class MetricsPublisher {
|
|||||||
metrics.put("gpuMemUtil", gpuMetrics.getMallocedMemory());
|
metrics.put("gpuMemUtil", gpuMetrics.getMallocedMemory());
|
||||||
metrics.put("diskUtilPct", diskMetrics.getUsedDiskPct());
|
metrics.put("diskUtilPct", diskMetrics.getUsedDiskPct());
|
||||||
|
|
||||||
var retMap = new HashMap<String, Object>();
|
DataChangeService.getInstance().publishEvent(OutgoingUIEvent.wrappedOf("metrics", metrics));
|
||||||
retMap.put("metrics", metrics);
|
|
||||||
|
|
||||||
try {
|
|
||||||
SocketHandler.getInstance().broadcastMessage(retMap, null);
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
logger.error("Exception while sending metrics!", e);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Singleton {
|
private static class Singleton {
|
||||||
@@ -33,7 +33,6 @@ import org.photonvision.common.configuration.ConfigManager;
|
|||||||
import org.photonvision.common.dataflow.DataChangeService;
|
import org.photonvision.common.dataflow.DataChangeService;
|
||||||
import org.photonvision.common.dataflow.events.OutgoingUIEvent;
|
import org.photonvision.common.dataflow.events.OutgoingUIEvent;
|
||||||
import org.photonvision.common.util.TimedTaskManager;
|
import org.photonvision.common.util.TimedTaskManager;
|
||||||
import org.photonvision.server.SocketHandler;
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class Logger {
|
public class Logger {
|
||||||
@@ -302,12 +301,12 @@ public class Logger {
|
|||||||
private static class UILogAppender implements LogAppender {
|
private static class UILogAppender implements LogAppender {
|
||||||
@Override
|
@Override
|
||||||
public void log(String message, LogLevel level) {
|
public void log(String message, LogLevel level) {
|
||||||
var messageMap = new SocketHandler.UIMap();
|
var messageMap = new HashMap<String, Object>();
|
||||||
messageMap.put("logMessage", message);
|
messageMap.put("logMessage", message);
|
||||||
messageMap.put("logLevel", level.code);
|
messageMap.put("logLevel", level.code);
|
||||||
var superMap = new SocketHandler.UIMap();
|
var superMap = new HashMap<String, Object>();
|
||||||
superMap.put("logMessage", messageMap);
|
superMap.put("logMessage", messageMap);
|
||||||
DataChangeService.getInstance().publishEvent(new OutgoingUIEvent<>("log", superMap));
|
DataChangeService.getInstance().publishEvent(OutgoingUIEvent.wrappedOf("log", superMap));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,4 +59,17 @@ public class MathUtils {
|
|||||||
public static int map(int value, int inMin, int inMax, int outMin, int outMax) {
|
public static int map(int value, int inMin, int inMax, int outMin, int outMax) {
|
||||||
return (int) Math.floor(map((double) value, inMin, inMax, outMin, outMax) + 0.5);
|
return (int) Math.floor(map((double) value, inMin, inMax, outMin, outMax) + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Linearly interpolates between two values.
|
||||||
|
*
|
||||||
|
* @param startValue The start value.
|
||||||
|
* @param endValue The end value.
|
||||||
|
* @param t The fraction for interpolation.
|
||||||
|
* @return The interpolated value.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("ParameterName")
|
||||||
|
public static double lerp(double startValue, double endValue, double t) {
|
||||||
|
return startValue + (endValue - startValue) * t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user