# Advantage Scope

## Opening

Since the 2024 Season, [Advantage Scope](https://github.com/Mechanical-Advantage/AdvantageScope) has been included with the WPILib installation. There is no external download required, however with every WPILib update you should re-download the [WPILib installer](https://docs.wpilib.org/en/stable/docs/zero-to-robot/step-2/wpilib-setup.html) to get the latest version of WPILib tools.

## Configuring Advantage Scope

1. Connect laptop to robot
2. Open `AdvantageScope (WPILib)` or in VS Code open the command palette and type in `WPILib: Start Tool` and click `AdvantageScope`
3. Click `Help` then `Show Preferences`

<figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2Fgit-blob-c437a229fbe97723d36fc243a7ac92e39097adfd%2FAdvantageScope-Preferences.png?alt=media" alt=""><figcaption><p>Advantage Scope's help menu</p></figcaption></figure>

4. Input the roboRIO IP address based off of your team number. `10.TE.AM.2`

<figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2Fgit-blob-2a95113b334a8b52ca1e72dacb582cbb1d212d61%2FAdvantageScope-Preferences-IP.png?alt=media" alt=""><figcaption><p>roboRIO Address field highlighted</p></figcaption></figure>

5. Connect to the robot (or the simulator)

<figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2Fgit-blob-5fe8086da257c0f2ccd6dd9135f8d9dd4e7f1ed5%2FAdvantageScope-Connect.png?alt=media" alt=""><figcaption><p>Connect to Robot menu</p></figcaption></figure>

6. Add a new tab by clicking the `+` on the right side of the window

<figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2Fgit-blob-ae2d4ad70a14822b5aa01710ed1e6591f83d48b1%2FAdvantageScope-Add.png?alt=media" alt=""><figcaption><p>Add new tab</p></figcaption></figure>

7. Add a new :crab: Swerve tab

<figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2Fgit-blob-06a3d874f2a4a67f6407a17001d8b9ec789a376f%2FAdvantageScope-Swerve.png?alt=media" alt=""><figcaption><p>Swerve tab</p></figcaption></figure>

8. Connect the module states and rotation from Smart Dashboard to the Fields.

   1. Under the `SmartDashboard/swerve` menu drag the everything from `advantagescope/` into the `Sources` field.
   2. You may need to enable your robot before you can add `SmartDashboard/swerve/advantagescope/desiredStates`

   <figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2FRAzTy71uiyPHOeicWkix%2Fimage.png?alt=media&#x26;token=d6bec763-894b-4b8c-9aa1-0105dbe179a7" alt=""><figcaption></figcaption></figure>
9. Adjust the Data column to your Swerve Drive's properties.

   1. Under the `Data` column change the `Max Speed` field to the value of `SmartDashboard/swerve/maxSpeed` entry.

   <figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2FBzTzXSiTZMaxCQNgVeJc%2Fimage.png?alt=media&#x26;token=009bf41c-6020-497c-91cc-a5fec5ef98b6" alt=""><figcaption></figcaption></figure>
10. (Optional) Adjust the Display column to accurately display your robot's chassis dimensions by changing the Size (Left-Right) and Size (Front-Back) to match what is under `SmartDashboard/swerve/sizeLeftRight` and `SmartDashboard/swerve/sizeFrontBack`

<figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2F9Fti681K7bEWAyIO8Fc3%2Fimage.png?alt=media&#x26;token=a0648ccb-617e-4fd9-b428-0037bb30a7a5" alt=""><figcaption></figcaption></figure>

## Overview

<figure><img src="https://567506766-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F754c0Fpq8fBi6k4ByS1k%2Fuploads%2F5qM7YTvDzfwnVHXD4i6M%2Fimage.png?alt=media&#x26;token=51206d68-5d1a-4347-9d72-cae2cae6055d" alt=""><figcaption><p>Swerve Drivebase while in motion with an incorrect configuration.<br>(Need to change this to an actual picture of Advantage Scope)</p></figcaption></figure>

{% hint style="info" %}
The **RED** lines are the measured velocity and position of the swerve module.

The **BLUE** lines is the velocity and position of the module sent!
{% endhint %}
