Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/source/docs/quick-start/common-setups.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ PhotonVision requires dedicated hardware, above and beyond a roboRIO. This page
The Orange Pi 5 is the only currently supported device for object detection.
:::

## SystemCore Support

The SystemCore is not supported by PhotonVision. PhotonVision is designed to utilize the entirety of the coprocessor's resources, and this could prove to be dangerous if attempted on the main robot controller.
There are no current plans to support running on SystemCore alongside robot code, and any attempts to do so are entirely at your own risk and will require a separate fork of PhotonVision.

## SD Cards

- 8GB or larger micro SD card
Expand Down
58 changes: 58 additions & 0 deletions photon-server/src/main/java/org/photonvision/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
package org.photonvision;

import edu.wpi.first.hal.HAL;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.cli.*;
Expand Down Expand Up @@ -172,6 +178,41 @@ public static void main(String[] args) {
+ Platform.getPlatformName()
+ (Platform.isRaspberryPi() ? (" (Pi " + PiVersion.getPiVersion() + ")") : ""));

if (Platform.isSystemCore()) {
logger.error(
"SystemCore is not a supported platform for PhotonVision!\n "
+ "PhotonVision will now proceed to uninstall itself from this device.\n"
+ "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support for more information.");

File jarLocation = getJarLocation();
if (jarLocation == null) {
System.exit(1);
}
// Make a file where the PV JAR is located indicating systemcore is not supported
try {
File notSupportedFile =
new File(jarLocation.getParent(), "SYSTEMCORE_NOT_SUPPORTED_BY_PHOTONVISION.txt");
try (FileWriter writer = new FileWriter(notSupportedFile)) {
writer.write("SystemCore is not a supported platform for PhotonVision.\n");
writer.write("PhotonVision has been uninstalled from this device.\n");
writer.write(
"Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support for more information.");
}
} catch (IOException e) {
logger.error("Failed to create SystemCore not supported file", e);
System.exit(1);
}

// Delete the PV JAR
if (!jarLocation.delete()) {
logger.error("Failed to delete PhotonVision JAR file on SystemCore!");
System.exit(1);
}

// Exit
System.exit(1);
}

if (OsImageVersion.IMAGE_VERSION.isPresent()) {
logger.info("PhotonVision image version: " + OsImageVersion.IMAGE_VERSION.get());
}
Expand Down Expand Up @@ -308,4 +349,21 @@ public static void main(String[] args) {
HardwareManager.getInstance().setRunning(true);
Server.initialize(DEFAULT_WEBPORT);
}

public static File getJarLocation() {
try {
ProtectionDomain protectionDomain = Main.class.getProtectionDomain();
CodeSource codeSource = protectionDomain.getCodeSource();
if (codeSource != null) {
URL location = codeSource.getLocation();
return new File(location.toURI());
} else {
logger.error("Could not determine JAR location: code source is null");
return null;
}
} catch (URISyntaxException e) {
logger.error("Error determining JAR location", e);
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public enum Platform {
true,
OSType.LINUX,
true), // Raspberry Pi 3/4 with a 64-bit image
LINUX_SYSTEMCORE(
"Linux Systemcore 64-bit NOT SUPPORTED",
Platform::getUnknownModel,
"linuxarm64",
false,
OSType.LINUX,
false), // SystemCore 64-bit
LINUX_RK3588_64(
"Linux AARCH 64-bit with RK3588",
Platform::getLinuxDeviceTreeModel,
Expand Down Expand Up @@ -131,6 +138,11 @@ public static boolean isRK3588() {
return Platform.isOrangePi() || Platform.isCoolPi4b() || Platform.isRock5C();
}

public static boolean isSystemCore() {
File sysCore = new File("/home/systemcore");
return sysCore.exists() | fileHasText("/etc/os-release", "systemcore");
}

public static boolean isQCS6490() {
return isRubik();
}
Expand Down Expand Up @@ -206,7 +218,9 @@ public static Platform getCurrentPlatform() {
}

if (OS_NAME.startsWith("Linux")) {
if (isPiSBC()) {
if (isSystemCore()) {
return LINUX_SYSTEMCORE;
} else if (isPiSBC()) {
if (OS_ARCH.equals("arm") || OS_ARCH.equals("arm32")) {
return LINUX_RASPBIAN32;
} else if (OS_ARCH.equals("aarch64") || OS_ARCH.equals("arm64")) {
Expand Down
Loading