mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-29 02:21:41 +00:00
Initial hardware support for Rubik pi (#1989)
This commit is contained in:
@@ -29,6 +29,7 @@ import org.photonvision.common.hardware.metrics.cmds.CmdBase;
|
||||
import org.photonvision.common.hardware.metrics.cmds.FileCmds;
|
||||
import org.photonvision.common.hardware.metrics.cmds.LinuxCmds;
|
||||
import org.photonvision.common.hardware.metrics.cmds.PiCmds;
|
||||
import org.photonvision.common.hardware.metrics.cmds.QCS6490Cmds;
|
||||
import org.photonvision.common.hardware.metrics.cmds.RK3588Cmds;
|
||||
import org.photonvision.common.logging.LogGroup;
|
||||
import org.photonvision.common.logging.Logger;
|
||||
@@ -49,6 +50,8 @@ public class MetricsManager {
|
||||
cmds = new PiCmds(); // Pi's can use a hardcoded command set
|
||||
} else if (Platform.isRK3588()) {
|
||||
cmds = new RK3588Cmds(); // RK3588 chipset hardcoded command set
|
||||
} else if (Platform.isQCS6490()) {
|
||||
cmds = new QCS6490Cmds(); // QCS6490 chipset hardcoded command set
|
||||
} else if (Platform.isLinux()) {
|
||||
cmds = new LinuxCmds(); // Linux/Unix platforms assume a nominal command set
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) Photon Vision.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.photonvision.common.hardware.metrics.cmds;
|
||||
|
||||
import org.photonvision.common.configuration.HardwareConfig;
|
||||
|
||||
public class QCS6490Cmds extends LinuxCmds {
|
||||
/** Applies pi-specific commands, ignoring any input configuration */
|
||||
public void initCmds(HardwareConfig config) {
|
||||
super.initCmds(config);
|
||||
|
||||
/* Thermal zone information can be found in /sys/class/thermal/thermal_zone* directories:
|
||||
* zone/type: Contains the thermal zone type/name (e.g., "acpi", "x86_pkg_temp")
|
||||
* zone/temp: Current temperature in millidegrees Celsius (divide by 1000 for actual temp)
|
||||
* zone/policy: Thermal governor policy (e.g., "step_wise", "power_allocator")
|
||||
* Each thermal_zone* directory represents a different temperature sensor in the system
|
||||
*/
|
||||
|
||||
cpuTemperatureCommand =
|
||||
"cat /sys/class/thermal/thermal_zone10/temp | awk '{printf \"%.1f\", $1/1000}'";
|
||||
|
||||
// TODO: NPU usage, doesn't seem to be in the same place as the opi. We're gonna just wait on QC
|
||||
// to get back to us on this one.
|
||||
}
|
||||
}
|
||||
@@ -51,6 +51,13 @@ public enum Platform {
|
||||
false,
|
||||
OSType.LINUX,
|
||||
true),
|
||||
LINUX_QCS6490(
|
||||
"Linux AARCH 64-bit with QCS6490",
|
||||
Platform::getLinuxDeviceTreeModel,
|
||||
"linuxarm64",
|
||||
true,
|
||||
OSType.LINUX,
|
||||
true), // QCS6490 SBCs
|
||||
LINUX_AARCH64(
|
||||
"Linux AARCH64",
|
||||
Platform::getLinuxDeviceTreeModel,
|
||||
@@ -124,6 +131,10 @@ public enum Platform {
|
||||
return Platform.isOrangePi() || Platform.isCoolPi4b() || Platform.isRock5C();
|
||||
}
|
||||
|
||||
public static boolean isQCS6490() {
|
||||
return isRubik();
|
||||
}
|
||||
|
||||
public static boolean isRaspberryPi() {
|
||||
return currentPlatform.isPi;
|
||||
}
|
||||
@@ -162,6 +173,7 @@ public enum Platform {
|
||||
String.format("Unknown Platform. OS: %s, Architecture: %s", OS_NAME, OS_ARCH);
|
||||
private static final String UnknownDeviceModelString = "Unknown";
|
||||
|
||||
// TODO: add rubik, but waiting for more info on architecture
|
||||
public static Platform getCurrentPlatform() {
|
||||
String OS_NAME;
|
||||
if (Platform.OS_NAME != null) {
|
||||
@@ -219,6 +231,9 @@ public enum Platform {
|
||||
// TODO - os detection needed?
|
||||
if (isRK3588()) {
|
||||
return LINUX_RK3588_64;
|
||||
} else if (isQCS6490()) {
|
||||
return LINUX_QCS6490;
|
||||
|
||||
} else {
|
||||
return LINUX_AARCH64;
|
||||
}
|
||||
@@ -256,6 +271,10 @@ public enum Platform {
|
||||
return fileHasText("/proc/device-tree/model", "NVIDIA Jetson");
|
||||
}
|
||||
|
||||
private static boolean isRubik() {
|
||||
return fileHasText("/proc/device-tree/model", "Rubik");
|
||||
}
|
||||
|
||||
static String getLinuxDeviceTreeModel() {
|
||||
var deviceTreeModelPath = Paths.get("/proc/device-tree/model");
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user