Compare commits

...

6 Commits

Author SHA1 Message Date
Matt Morley
846528ce9c Remove NT reconnect loop entirely (#2398)
## Description

Back in
https://github.com/PhotonVision/photonvision/pull/467#issuecomment-1280964529
and
https://discord.com/channels/725836368059826228/725846784131203222/974498049609056266
we added code to poke our NT client every 5 seconds to "clicking the
save button in the settings window makes Photon show up again over
networktables". Total hack, but it seemed to work. We didn't at the time
dig any deeper in Wireshark or debug-level NT logs.

<img width="1373" height="679" alt="image"
src="https://github.com/user-attachments/assets/8cb2102e-0bae-4bfd-b9ac-55d31f8421b6"
/>

Now, it's 2026. 4 years on from the OG bug. And this code seems linked
to these issues

-
https://www.chiefdelphi.com/t/photonvision-coprocessor-not-sending-data-can-t-change-networking/516356/5
-
https://www.chiefdelphi.com/t/photonvision-network-tables-known-issue/515966

Craig collected these log files as well:


[craig-nt-never-connects.zip](https://github.com/user-attachments/files/26001809/craig-nt-never-connects.zip)

The code path that handles TCP re-connection was also changed entirely
since we first added this workaround. Regardless this hack was not
removed as part of the NT3 to NT4 upgrade:
- pre-NT4, reconnection was handled by `TCPConnector::connect_parallel`
which delegates to `TCPConnector`. This uses raw socket APIs
- post-NT4, reconnect is handled by `ParallelTcpConnector`. This uses
libuv exclusively

@crschardt did some really great debugging with a rio and radio in the
loop with a luma p1. In this test setup, removing this code improves
stability markedly. I'd still like to get this more on robot time, as
well as try to understand from Peter why we might have needed this code
in the first place.

## Changes

- Remove periodic stop/restart of NetworkTables client every 5 seconds
if `NetworkTablesInstance::isConnected` returns false.

## Meta

Merge checklist:
- [ ] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [ ] The description documents the _what_ and _why_, including events
that led to this PR
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with all settings going back to the previous seasons's last release
(seasons end after champs ends)
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added
- [ ] If this PR adds a dependency, the license has been checked for
compatibility and steps taken to follow it

---------

Co-authored-by: Craig Schardt <crschardt@fastem.com>
2026-03-15 21:57:09 -04:00
Ruthie
7383a9040d correct typo (#2395) 2026-03-14 17:16:24 +00:00
42
ab09e7fa14 Fix offline dev update confirm handler not starting upload (#2393)
Fixes a bug where offline update did not start after confirming the
dev-version warning dialog.

The confirm action was using an incorrect file reference in template
context, so the selected JAR was not passed correctly to the upload
handler. The dialog closed, but no upload request was sent.
This change corrects the confirm handler so the selected file is passed
properly and the upload/install flow starts as expected.
2026-03-10 10:04:43 -05:00
Sam Freund
cd3d9b06bb Add clarity to networking for multiple coprocs (#2383)
We've had a couple people who didn't find it clear that multiple
coprocessors required different static IP addresses, so this PR aims to
clarify that point in the docs.
2026-03-09 17:19:24 +00:00
Charlotte Wilson
fd4628d419 Drop deviceLogoPath and supportURL from HardwareConfig (#2389)
Removed the `deviceLogoPath` and `supportURL` fields from
`HardwareConfig` due to low (no) usage, and updates the docs to reflect
this.
2026-03-06 11:44:37 -06:00
Ruthie
5fdfa3132f Document low-resource vision simulation with Photonvision (#2359)
## Description

What changed? Why? (the code + comments should speak for itself on the
"how")

Added section on low-resource vision simulation with Photonvision,
including configuration details and use cases for low-spec machines.
Closes #2358

---------

Co-authored-by: Chris Gerth <gerth2@users.noreply.github.com>
2026-03-06 01:27:16 +00:00
11 changed files with 42 additions and 46 deletions

View File

@@ -1,6 +1,5 @@
{
"deviceName" : "Limelight 2+",
"supportURL" : "https://limelightvision.io",
"ledPins" : [ 13, 18 ],
"ledsCanDim" : true,
"ledPWMFrequency" : 1000,

View File

@@ -1,6 +1,5 @@
{
"deviceName" : "Limelight 2",
"supportURL" : "https://limelightvision.io",
"ledPins" : [ 17, 18 ],
"ledsCanDim" : false,
"vendorFOV" : 75.76079874010732

View File

@@ -103,9 +103,9 @@ If your hardware contains a camera with a known field of vision, it can be enter
}
```
## Cosmetic & Branding
## Device Name Branding
To help differentiate your hardware from other solutions, some customization is allowed.
To help differentiate your hardware from other solutions, a device name may be set.
```{eval-rst}
.. tab-set-code::
@@ -113,8 +113,6 @@ To help differentiate your hardware from other solutions, some customization is
{
"deviceName" : "Super Cool Custom Hardware",
"deviceLogoPath" : "",
"supportURL" : "https://cat-bounce.com/",
}
```
@@ -132,8 +130,6 @@ Here is a complete example `hardwareConfig.json`:
{
"deviceName" : "Blinky McBlinkface",
"deviceLogoPath" : "",
"supportURL" : "https://www.youtube.com/watch?v=b-CvLWbfZhU",
"ledPins" : [2, 13],
"ledsCanDim" : true,
"ledBrightnessRange" : [ 0, 100 ],

View File

@@ -52,10 +52,10 @@ Only use a static IP when connected to the **robot radio**, and never when testi
3. Open the settings tab on the left pane.
4. Under the Networking section, set your team number.
5. Change your IP to Static.
6. Set your coprocessor's IP address to “10.TE.AM.11”. More information on IP format can be found [here](https://docs.wpilib.org/en/stable/docs/networking/networking-introduction/ip-configurations.html#on-the-field-static-configuration).
6. Set your coprocessor's IP address to “10.TE.AM.xx”. "xx" should be a unique number not currently used by another device on the robot in the `.6-.19` range. More information on IP format can be found [here](https://docs.wpilib.org/en/stable/docs/networking/networking-introduction/ip-configurations.html#on-the-field-static-configuration).
7. Click the “Save” button.
Power-cycle your robot and then you will now be access the PhotonVision dashboard at `10.TE.AM.11:5800`.
Power-cycle your robot and then you will now be access the PhotonVision dashboard at `10.TE.AM.xx:5800`.
```{image} images/static.png
:alt: Correctly set static IP

View File

@@ -196,6 +196,42 @@ If the camera is mounted on a mobile mechanism (like a turret) this transform ca
visionSim.adjustCamera(cameraSim, robotToCamera);
```
## Low-Resource Vision Simulation with Photonvision
By default, PhotonCameraSim renders two simulated camera streams using OpenCV:
- Raw stream - The unprocessed camera view
- Processed stream - The camera view with vision processing overlays
These streams are nice if you want to actually view the simulated images, but they can be computationally expensive. This may cause lag and reduced simulation performance on lower-powered computers.
Lightweight Configuration
The following configuration disables both streams while still allowing tag detection and pose simulation to work. It's not perfect, but it's much better performance-wise than the default configuration.
.. code-block:: java
// lightweight config version
// var cameraProperties = new SimCameraProperties();
// cameraSim = new PhotonCameraSim(camera, cameraProperties, aprilTagLayout);
// cameraSim.enableRawStream(false); // disables raw image stream
// cameraSim.enableProcessedStream(false); // disables processed image stream
**Use Case**
This configuration is ideal for Chromebooks or low-spec machines where rendering the simulated camera images causes lag, but vision data is still desired for testing.
**What Still Works**
- AprilTag detection
- Pose estimation
- NetworkTables data publishing
- Robot positioning and targeting
**What's Disabled**
- Visual camera stream rendering
- Real-time visual debugging of camera output
## Updating The Simulation World
To update the `VisionSystemSim`, we simply have to pass in the simulated robot pose periodically (in `simulationPeriodic()`).

View File

@@ -555,7 +555,7 @@ watch(metricsHistorySnapshot, () => {
:variant="theme.global.name.value === 'LightTheme' ? 'elevated' : 'outlined'"
@click="
offlineUpdateDialog.show = false;
handleOfflineUpdate(offlineUpdate.value.files[0]);
handleOfflineUpdate(offlineUpdate.files[0]);
"
>
<v-icon start class="open-icon" size="large"> mdi-upload </v-icon>

View File

@@ -23,8 +23,6 @@ import java.util.ArrayList;
@JsonIgnoreProperties(ignoreUnknown = true)
public class HardwareConfig {
public final String deviceName;
public final String deviceLogoPath;
public final String supportURL;
// LED control
public final ArrayList<Integer> ledPins;
@@ -47,8 +45,6 @@ public class HardwareConfig {
public HardwareConfig(
String deviceName,
String deviceLogoPath,
String supportURL,
ArrayList<Integer> ledPins,
boolean ledsCanDim,
ArrayList<Integer> ledBrightnessRange,
@@ -63,8 +59,6 @@ public class HardwareConfig {
String restartHardwareCommand,
double vendorFOV) {
this.deviceName = deviceName;
this.deviceLogoPath = deviceLogoPath;
this.supportURL = supportURL;
this.ledPins = ledPins;
this.ledsCanDim = ledsCanDim;
this.ledBrightnessRange = ledBrightnessRange;
@@ -82,8 +76,6 @@ public class HardwareConfig {
public HardwareConfig() {
deviceName = "";
deviceLogoPath = "";
supportURL = "";
ledPins = new ArrayList<>();
ledsCanDim = false;
ledBrightnessRange = new ArrayList<>();
@@ -121,10 +113,6 @@ public class HardwareConfig {
public String toString() {
return "HardwareConfig[deviceName="
+ deviceName
+ ", deviceLogoPath="
+ deviceLogoPath
+ ", supportURL="
+ supportURL
+ ", ledPins="
+ ledPins
+ ", ledsCanDim="

View File

@@ -104,7 +104,6 @@ public class NetworkTablesManager {
public void registerTimedTasks() {
m_timeSync.start();
TimedTaskManager.getInstance().addTask("NTManager", this::ntTick, 5000);
TimedTaskManager.getInstance()
.addTask("CheckHostnameAndCameraNames", this::checkHostnameAndCameraNames, 10000);
}
@@ -380,23 +379,6 @@ public class NetworkTablesManager {
broadcastVersion();
}
// So it seems like if Photon starts before the robot NT server does, and both aren't static IP,
// it'll never connect. This hack works around it by restarting the client/server while the nt
// instance isn't connected, same as clicking the save button in the settings menu (or restarting
// the service)
private void ntTick() {
if (!ntInstance.isConnected()
&& !ConfigManager.getInstance().getConfig().getNetworkConfig().runNTServer) {
setConfig(ConfigManager.getInstance().getConfig().getNetworkConfig());
}
if (!ntInstance.isConnected() && !m_isRetryingConnection) {
m_isRetryingConnection = true;
logger.error(
"[NetworkTablesManager] Could not connect to the robot! Will retry in the background...");
}
}
public long getTimeSinceLastPong() {
return m_timeSync.getTimeSinceLastPong();
}

View File

@@ -449,7 +449,7 @@ public class SystemMonitor {
/**
* Returns the total GPU memory in MiB.
*
* @return The total GPU memory in MiB, or -1.0 if not avaialable on this platform.
* @return The total GPU memory in MiB, or -1.0 if not available on this platform.
*/
public double getGpuMem() {
return -1.0;

View File

@@ -38,8 +38,6 @@ public class HardwareConfigTest {
var config =
new ObjectMapper().readValue(TestUtils.getHardwareConfigJson(), HardwareConfig.class);
assertEquals(config.deviceName, "PhotonVision");
assertEquals(config.deviceLogoPath, "photonvision.png");
assertEquals(config.supportURL, "https://support.photonvision.com");
// Ensure defaults are not null
assertArrayEquals(config.ledPins.stream().mapToInt(i -> i).toArray(), new int[] {2, 13});
NativeDeviceFactoryInterface deviceFactory = HardwareManager.configureCustomGPIO(config);

View File

@@ -1,7 +1,5 @@
{
"deviceName": "PhotonVision",
"deviceLogoPath": "photonvision.png",
"supportURL": "https://support.photonvision.com",
"ledPins" : [2, 13],
"statusRGBPins" : [-1, -1, -1],
"ledsCanDim" : true,