Skip to content
Merged
Changes from 1 commit
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
41 changes: 41 additions & 0 deletions docs/source/docs/simulation/simulation-java.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,47 @@ 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 on low-power laptops like Chromebooks, causing lag and reduced simulation performance.

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

// code to add sim camera (Default)
var cameraProperties = new SimCameraProperties();
cameraSim = new PhotonCameraSim(camera, cameraProperties, aprilTagLayout);

// 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 you still need vision data 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()`).
Expand Down
Loading