mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
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>
This commit is contained in:
@@ -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()`).
|
||||
|
||||
Reference in New Issue
Block a user