Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream' into opencv-dnn
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 committed Oct 15, 2023
2 parents c503958 + 760de0f commit fb87f9a
Show file tree
Hide file tree
Showing 144 changed files with 658 additions and 611 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ jobs:
run: |
chmod +x gradlew
./gradlew copyPhotonlib -x check
./gradlew buildAllExamples -x check --max-workers 2
./gradlew build -x check --max-workers 2
- name: Build C++ examples
working-directory: photonlib-cpp-examples
run: |
chmod +x gradlew
./gradlew copyPhotonlib -x check
./gradlew buildAllExamples -x check --max-workers 2
./gradlew build -x check --max-workers 2
photon-build-all:
# The type of runner that the job will run on.
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -225,6 +225,7 @@ jobs:
include:
- os: windows-2022
artifact-name: Win64
architecture: x64
# Mac builds are broken due to opencv class loading issues -- disable for now
# - os: macos-11
# artifact-name: macOS
Expand Down Expand Up @@ -255,7 +256,7 @@ jobs:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2023-22.04
- container: wpilib/roborio-cross-ubuntu:2024-22.04
artifact-name: Athena
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
artifact-name: Raspbian
Expand Down
23 changes: 0 additions & 23 deletions LICENSE_MathUtils_orthogonalizeRotationMatrix.txt

This file was deleted.

11 changes: 9 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,12 @@ allprojects {
apply from: "versioningHelper.gradle"

ext {
wpilibVersion = "2023.4.2"
opencvVersion = "4.8.0-1"
wpilibVersion = "2024.1.1-beta-1"
openCVversion = "4.8.0-1"
joglVersion = "2.4.0-rc-20200307"
javalinVersion = "5.6.2"
frcYear = "2024"

pubVersion = versionString
isDev = pubVersion.startsWith("dev")

Expand Down Expand Up @@ -60,3 +63,7 @@ spotless {
targetExclude("photon-lib/src/main/java/org/photonvision/PhotonVersion.java")
}
}

wrapper {
gradleVersion '8.3'
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services\.gradle\.org/distributions/gradle-8\.3-bin\.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 2 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
Expand Down
3 changes: 2 additions & 1 deletion photon-client/src/assets/images/loading.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion photon-client/src/assets/images/logoLarge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion photon-client/src/assets/images/logoSmall.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions photon-client/src/components/app/photon-3d-visualizer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ import { onBeforeUnmount, onMounted, watchEffect } from "vue";
import {
ArrowHelper,
BoxGeometry,
Color,
ConeGeometry,
Mesh,
MeshNormalMaterial,
type Object3D,
PerspectiveCamera,
Quaternion,
Scene,
Vector3,
Color,
WebGLRenderer
} from "three";
import { TrackballControls } from "three/examples/jsm/controls/TrackballControls";
import { type Object3D } from "three";
const props = defineProps<{
targets: PhotonTarget[];
Expand Down
2 changes: 1 addition & 1 deletion photon-client/src/components/app/photon-log-view.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { computed, ref, inject } from "vue";
import { computed, inject, ref } from "vue";
import { LogLevel, type LogMessage } from "@/types/SettingTypes";
import { useStateStore } from "@/stores/StateStore";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup lang="ts">
import { computed, ref } from "vue";
import { useCameraSettingsStore } from "@/stores/settings/CameraSettingsStore";
import { CalibrationBoardTypes, type VideoFormat, type Resolution } from "@/types/SettingTypes";
import { CalibrationBoardTypes, type Resolution, type VideoFormat } from "@/types/SettingTypes";
import JsPDF from "jspdf";
import { font as PromptRegular } from "@/assets/fonts/PromptRegular";
import MonoLogo from "@/assets/images/logoMono.png";
Expand Down Expand Up @@ -150,7 +150,10 @@ const importCalibrationFromCalibDB = ref();
const openCalibUploadPrompt = () => {
importCalibrationFromCalibDB.value.click();
};
const readImportedCalibration = ({ files }: { files: FileList }) => {
const readImportedCalibration = (payload: Event) => {
if (payload.target == null || !payload.target?.files) return;
const files: FileList = payload.target.files as FileList;
files[0].text().then((text) => {
useCameraSettingsStore()
.importCalibDB({ payload: text, filename: files[0].name })
Expand Down
5 changes: 4 additions & 1 deletion photon-client/src/components/settings/DeviceControlCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,17 @@ const offlineUpdate = ref();
const openOfflineUpdatePrompt = () => {
offlineUpdate.value.click();
};
const handleOfflineUpdate = ({ files }: { files: FileList }) => {
const handleOfflineUpdate = (payload: Event) => {
useStateStore().showSnackbarMessage({
message: "New Software Upload in Progress...",
color: "secondary",
timeout: -1
});
const formData = new FormData();
if (payload.target == null || !payload.target?.files) return;
const files: FileList = payload.target.files as FileList;
formData.append("jarData", files[0]);
axios
Expand Down
7 changes: 2 additions & 5 deletions photon-client/src/stores/settings/CameraSettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import { PlaceholderCameraSettings } from "@/types/SettingTypes";
import { useStateStore } from "@/stores/StateStore";
import type { WebsocketCameraSettingsUpdate } from "@/types/WebsocketDataTypes";
import { WebsocketPipelineType } from "@/types/WebsocketDataTypes";
import type { ActiveConfigurablePipelineSettings, ActivePipelineSettings } from "@/types/PipelineTypes";
import type { PipelineType } from "@/types/PipelineTypes";
import type { ActiveConfigurablePipelineSettings, ActivePipelineSettings, PipelineType } from "@/types/PipelineTypes";
import axios from "axios";

interface CameraSettingsStore {
Expand Down Expand Up @@ -174,9 +173,7 @@ export const useCameraSettingsStore = defineStore("cameraSettings", {
settings: Partial<ActivePipelineSettings>,
cameraIndex: number = useStateStore().currentCameraIndex
) {
Object.entries(settings).forEach(([k, v]) => {
this.cameras[cameraIndex].pipelineSettings[k] = v;
});
Object.assign(this.cameras[cameraIndex].pipelineSettings, settings);
},
/**
* Change the nickname of the currently selected pipeline of the provided camera.
Expand Down
4 changes: 2 additions & 2 deletions photon-client/src/stores/settings/GeneralSettingsStore.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { defineStore } from "pinia";
import type {
ConfigurableNetworkSettings,
GeneralSettings,
LightingSettings,
MetricData,
NetworkSettings,
ConfigurableNetworkSettings
NetworkSettings
} from "@/types/SettingTypes";
import { NetworkConnectionType } from "@/types/SettingTypes";
import { useStateStore } from "@/stores/StateStore";
Expand Down
3 changes: 1 addition & 2 deletions photon-client/src/types/WebsocketDataTypes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { GeneralSettings, LightingSettings, MetricData, NetworkSettings } from "@/types/SettingTypes";
import type { GeneralSettings, LightingSettings, LogLevel, MetricData, NetworkSettings } from "@/types/SettingTypes";
import type { ActivePipelineSettings } from "@/types/PipelineTypes";
import type { LogLevel } from "@/types/SettingTypes";

export interface WebsocketLogMessage {
logMessage: {
Expand Down
5 changes: 1 addition & 4 deletions photon-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ apply from: "${rootDir}/shared/common.gradle"
dependencies {
implementation project(':photon-targeting')

implementation 'io.javalin:javalin:4.2.0'
implementation "io.javalin:javalin:$javalinVersion"

implementation 'org.msgpack:msgpack-core:0.9.0'
implementation 'org.msgpack:jackson-dataformat-msgpack:0.9.0'
Expand All @@ -27,9 +27,6 @@ dependencies {
implementation wpilibTools.deps.wpilibJava("apriltag")

implementation "org.xerial:sqlite-jdbc:3.41.0.0"

// NetworkManager
implementation "com.github.hypfvieh:dbus-java:3.3.2"
}

task writeCurrentVersionJava {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;
import java.util.*;
import java.util.Date;
import java.util.List;
import org.photonvision.common.logging.LogGroup;
import org.photonvision.common.logging.Logger;
import org.photonvision.common.util.file.FileUtils;
Expand All @@ -47,13 +48,13 @@ public class ConfigManager {

private final ConfigProvider m_provider;

private Thread settingsSaveThread;
private final Thread settingsSaveThread;
private long saveRequestTimestamp = -1;

enum ConfigSaveStrategy {
SQL,
LEGACY,
ATOMIC_ZIP;
ATOMIC_ZIP
}

// This logic decides which kind of ConfigManager we load as the default. If we want
Expand Down Expand Up @@ -115,9 +116,8 @@ private void translateLegacyIfPresent(Path folderPath) {
e1.printStackTrace();
}

// So we can't save the old config, and we couldn't copy the folder
// But we've loaded the config. So just try to delete the directory so we don't try to load
// form it next time. That does mean we have no backup recourse, tho
// Delete the directory because we were successfully able to load the config but were unable
// to save or copy the folder.
if (maybeCams.exists()) FileUtils.deleteDirectory(maybeCams.toPath());
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public String taToLogFname(TemporalAccessor date) {
}

public Date logFnameToDate(String fname) throws ParseException {
// Strip away known unneded portions of the log file name
// Strip away known unneeded portions of the log file name
fname = fname.replace(LOG_PREFIX, "").replace(LOG_EXT, "");
DateFormat format = new SimpleDateFormat(LOG_DATE_TIME_FORMAT);
return format.parse(fname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class LegacyConfigProvider extends ConfigProvider {
final File configDirectoryFile;

private long saveRequestTimestamp = -1;
private Thread settingsSaveThread;
private final Thread settingsSaveThread;

public static void saveUploadedSettingsZip(File uploadPath) {
var folderPath = Path.of(System.getProperty("java.io.tmpdir"), "photonvision").toFile();
Expand All @@ -67,7 +67,6 @@ public static void saveUploadedSettingsZip(File uploadPath) {
logger.info("Copied settings successfully!");
} catch (IOException e) {
logger.error("Exception copying uploaded settings!", e);
return;
}
}

Expand Down Expand Up @@ -371,7 +370,7 @@ public String taToLogFname(TemporalAccessor date) {
}

public Date logFnameToDate(String fname) throws ParseException {
// Strip away known unneded portions of the log file name
// Strip away known unneeded portions of the log file name
fname = fname.replace(LOG_PREFIX, "").replace(LOG_EXT, "");
DateFormat format = new SimpleDateFormat(LOG_DATE_TIME_FORMAT);
return format.parse(fname);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.photonvision.common.util.file.JacksonUtils;

public class NetworkConfig {
// Can be a integer team number, or a IP address
// Can be an integer team number, or an IP address
public String ntServerAddress = "0";
public NetworkMode connectionType = NetworkMode.DHCP;
public String staticIp = "";
Expand Down Expand Up @@ -58,7 +58,7 @@ public NetworkConfig() {
.orElse("Wired connection 1");
}

// We can (usually) manage networking on Linux devices, and if we can we should try to. Command
// We can (usually) manage networking on Linux devices, and if we can, we should try to. Command
// line inhibitions happen at a level above this class
setShouldManage(deviceCanManageNetwork());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@

// TODO rename this class
public class PhotonConfiguration {
private HardwareConfig hardwareConfig;
private HardwareSettings hardwareSettings;
private final HardwareConfig hardwareConfig;
private final HardwareSettings hardwareSettings;
private NetworkConfig networkConfig;
private HashMap<String, CameraConfiguration> cameraConfigurations;
private final HashMap<String, CameraConfiguration> cameraConfigurations;

public PhotonConfiguration(
HardwareConfig hardwareConfig,
Expand Down Expand Up @@ -113,7 +113,7 @@ public Map<String, Object> toHashMap() {

var lightingConfig = new UILightingConfig();
lightingConfig.brightness = hardwareSettings.ledBrightnessPercentage;
lightingConfig.supported = (hardwareConfig.ledPins.size() != 0);
lightingConfig.supported = !hardwareConfig.ledPins.isEmpty();
settingsSubmap.put("lighting", SerializationUtils.objectToHashMap(lightingConfig));

var generalSubmap = new HashMap<String, Object>();
Expand Down
Loading

0 comments on commit fb87f9a

Please sign in to comment.