Skip to content
This repository was archived by the owner on Jan 10, 2026. It is now read-only.

Comments

Better PhotonCamera#132

Open
wilsonwatson wants to merge 2 commits intomainfrom
betterPhoton
Open

Better PhotonCamera#132
wilsonwatson wants to merge 2 commits intomainfrom
betterPhoton

Conversation

@wilsonwatson
Copy link
Member

As we've seen with simulation stuff, not having an actual PhotonCamera is a big barrier for using much of PhotonVision's API. This update gets us roughly the same behavior as the old PhotonIO, but as an extension of PhotonCamera instead of a replacement. Now PhotonCameraWrapper contains an instance of PhotonCamera that could be used for simulation.

@wilsonwatson wilsonwatson marked this pull request as ready for review October 15, 2024 03:38
Copy link
Member

@legoguy1000 legoguy1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

main comment about the thread and simulation. Otherwise looks good. I still think moving the Vision system into its own subsystem and then maybe centralizing the "state" for odometry and stuff like a few other teams have done may declutter things a little.

Comment on lines +95 to +110
new Thread(() -> {
Timer timer = new Timer();
while (true) {
if (timer.advanceIfElapsed(10.0) && !isPhotonOk.get()) {
try {
uploadSettings(cameraIP + ":5800",
new File(Filesystem.getDeployDirectory().getAbsoluteFile(),
"photon-configs/" + cameraName + ".zip"));
} catch (IOException e) {
e.printStackTrace();
}
}
Thread.yield();
}
}).start();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should only do this if in simulation mode.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably. Agreed on the separate "Vision" subsystem.

var res = inputs.result;
if (res == null || inputs.timeSinceLastHeartbeat > 0.5) {
var res = this.camera.getLatestResult();
if (res == null || Timer.getFPGATimestamp() - res.getTimestampSeconds() > 0.5) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

U should be able to use latency() > 0.5 since u have the same function below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think latency is actually different from this (calculated pi-side). I'll check, but I agree it should be consistent whatever we do here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants