Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Advantage with PhotonVision docs #320

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
64 changes: 64 additions & 0 deletions source/docs/simulation/AdvantageScope.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
AvantageScope Simulation
========================

AvantageScope simulations allow the full simulation of a robot and all of its components on a virtual field. It can be further augmented with PhotonVIsion in order to simulate vision.

Before continuing, ensure WindowsPhotonVision is installed on your target device. For this, the target device will be your host. Instructions can be found :ref:`here <docs/installation/index:Installation & Setup>` for all devices.

Due to a lack of a physical robot, PhotonVision will be used to run the network tables instead of the roborio. Instructions can be found :ref:`here<docs/simulation/index:Hardware In The Loop Simulation>`. It is not required to change the Team Number/NetworkTables Server Address.

In order to interface AScope with PhotonVision, some extra software needs to be downloaded

- `link Java: <https://adoptium.net/temurin/releases/?version=11>'
- `link AdvantageScope (now comes bundled with wpilib): <https://github.com/Mechanical-Advantage/AdvantageScope/releases/tag/v3.0.1>'
- `link NDI Core Suit: <https://ndi.video/tools/ndi-core-suite/>'
- `link OBS: <https://obsproject.com/download>'
- `link OBS-NDI Interfacer: <https://github.com/obs-ndi/obs-ndi/releases/tag/4.13.0>'

AdvantageScope setup
====================

1. Open 3D Field
2. Setup a robot (Doesn’t matter if you use 2D or 3D pose, just make sure theres a camera)
3. Pop out the window (Button on the top right next to the eye)
.. image:: images/AdvantageScope.png

OBS
===

1. Create a new window capture source
.. image:: images/OBSCreateNewSource.png
2. Select the popped out AScope window as the source window
.. image:: images/OBSLinkWindow.png
3. Under tools select NDI Output
.. image:: images/OBSLinkNDI.png
4. Check Main Output & Preview Output
.. image:: images/OBSLinkNDI-2.png

NDI Tools
=========

1. Select the webcam
.. image:: images/NDI.png
2. In the popup on the bottom right, select the gear, then your computer name, then OBS

PhotonVision
============
1. In the camera tab, select the NDI Webcam you used
.. image:: images/SetNDICam.png

Code Setup
==========
1. Wherever your robot is first initialized (RobotContainer.java, Robot.java, main.java), set it to link to PhotonVision instead of the robot
.. code-block::
public RobotContainer() {
if(Robot.isSimulation()) {
NetworkTableInstance inst = NetworkTableInstance.getDefault();
inst.stopServer();
// Change the IP address in the below function to the IP address you use to connect to the PhotonVision UI.
inst.setServer("127.0.0.1");
inst.startClient4("Robot Simulation");
}
}


Binary file added source/docs/simulation/images/AdvantageScope.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/simulation/images/NDI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/simulation/images/OBSLinkNDI-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/simulation/images/OBSLinkNDI.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added source/docs/simulation/images/SetNDICam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading