Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdvantageScope XR #295

Merged
merged 68 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d442d5d
Initial XR development
jwbonner Dec 9, 2024
c5c4cd4
Improvements
jwbonner Dec 12, 2024
9f2a5db
Build 3D workers for XR client
jwbonner Dec 12, 2024
e0aa5ba
Add Xcode project
jwbonner Dec 12, 2024
a04b3f1
Clean up temperature RGB calculation
jwbonner Dec 12, 2024
3a1e9fe
Fix status bar
jwbonner Dec 12, 2024
05f38ee
Hide web overlay when scanning QR code
jwbonner Dec 12, 2024
5ff73c8
Add support for scanning multiple IP addresses
jwbonner Dec 13, 2024
0a83ce6
Add compatibility check for XR
jwbonner Dec 13, 2024
0f21bbf
Add more XR server controls
jwbonner Dec 13, 2024
4c53c86
Add active effect for XR button
jwbonner Dec 13, 2024
ecaa626
Merge branch 'main' into xr
jwbonner Dec 15, 2024
d666738
Exclude native app from prettier
jwbonner Dec 15, 2024
02469a3
Rename file
jwbonner Dec 15, 2024
4c68e97
Finish majority of desktop XR implementation
jwbonner Dec 15, 2024
0e34358
Add recording feature
jwbonner Dec 16, 2024
4696474
Read server compatibility from QR code
jwbonner Dec 16, 2024
23d2683
Enable remote inspection for debug builds
jwbonner Dec 16, 2024
5f028ba
Set up basic calibration code
jwbonner Dec 16, 2024
0268a6c
Improve field sizing reference definition
jwbonner Dec 17, 2024
f38a45c
Nominally working XR rendering
jwbonner Dec 18, 2024
84780f1
Add function to toggle carpet and field elements
jwbonner Dec 18, 2024
c8151d2
Make web overlay message handler private
jwbonner Dec 19, 2024
f1035a9
Delete worker before resolving promise
jwbonner Dec 19, 2024
8fb60d6
Load field without mesh merging
jwbonner Dec 19, 2024
5a2520c
Use constant for HTTP port
jwbonner Dec 19, 2024
73793fb
Make robots work!
jwbonner Dec 19, 2024
c8aa619
Allow hiding robot models
jwbonner Dec 19, 2024
3560f9b
Fix crash when disposing robot manager
jwbonner Dec 19, 2024
6cba994
Fix carpet separation
jwbonner Dec 19, 2024
c65c001
Remove XR workers
jwbonner Dec 19, 2024
c96ef98
Add warning about experimental status
jwbonner Dec 19, 2024
1e3badd
Add App Clip
jwbonner Dec 19, 2024
9528d07
Update iOS icons
jwbonner Dec 19, 2024
ee2df48
Use correct field size for calibration
jwbonner Dec 20, 2024
21c904c
Link marked points to plane anchors
jwbonner Dec 20, 2024
61dc557
Add separate request for hiding and showing controls from JS
jwbonner Dec 20, 2024
afd1a7b
Optimize for smoother streaming
jwbonner Dec 20, 2024
65e3744
Remove comment
jwbonner Dec 20, 2024
45286a4
Rename camera state to render state
jwbonner Dec 20, 2024
cd32f6b
Reset tracking when calibrating
jwbonner Dec 20, 2024
9b1751d
Render virtual content at full resolution
jwbonner Dec 20, 2024
b0d914f
Improve lighting
jwbonner Dec 20, 2024
6d3bbab
Merge branch 'main' into xr
jwbonner Dec 20, 2024
04c1598
Add encryption information to plist
jwbonner Dec 20, 2024
ea0e38a
Add CI build for iOS
jwbonner Dec 21, 2024
9b62768
Add initial docs
jwbonner Dec 21, 2024
745b63e
Disable heatmaps in XR
jwbonner Dec 21, 2024
993510f
Add message about future availability of XR object types
jwbonner Dec 21, 2024
2be522a
Add swerve states to XR
jwbonner Dec 21, 2024
6842e9c
Enable heatmap in XR
jwbonner Dec 21, 2024
3759691
Add warning about firewall
jwbonner Dec 21, 2024
1406294
Add XR to changelog
jwbonner Dec 21, 2024
6f54265
Add redirect for XR
jwbonner Dec 22, 2024
87a90b9
Improve reliability of QR code
jwbonner Dec 24, 2024
49c040d
Disable heatmap and swerve states in XR
jwbonner Dec 24, 2024
25dda3f
Fix frame dropping logic
jwbonner Dec 24, 2024
e8bb611
Stop XR server when 3D tab closed
jwbonner Dec 24, 2024
c473403
Fix AprilTag textures in XR
jwbonner Dec 24, 2024
d7d0367
Update XR docs
jwbonner Dec 24, 2024
433f777
Link to feature overview video from docs
jwbonner Dec 24, 2024
f2cfc8e
Add XR to full changelog
jwbonner Dec 25, 2024
e51177d
Add reference to headsets in docs
jwbonner Dec 26, 2024
3737c7c
Merge branch 'main' into xr
jwbonner Dec 27, 2024
41b1b35
Minor fixes to docs
jwbonner Dec 30, 2024
c95cbef
Merge branch 'main' into xr
jwbonner Dec 31, 2024
3ba7e71
Add XR video to 2025 page
jwbonner Dec 31, 2024
2196689
Remove placeholder XR page
jwbonner Dec 31, 2024
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
12 changes: 12 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ jobs:
bundles/*.js
bundles/*.wasm

build-ios:
name: Build for iOS
runs-on: macos-15

steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build AdvantageScopeXR
run: xcodebuild -project xr/AdvantageScopeXR.xcodeproj -scheme AdvantageScopeXR -sdk iphonesimulator build
- name: Build AdvantageScopeXRClip
run: xcodebuild -project xr/AdvantageScopeXR.xcodeproj -scheme AdvantageScopeXRClip -sdk iphonesimulator build

build-win:
name: Build for Windows (${{ matrix.arch }})
needs: compile
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,9 @@ $RECYCLE.BIN/

# IDE Specific Files
.idea

# Xcode
build/*
*.pbxuser
*.mode1v3
xcuserdata
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ node_modules
dist
bundles
src/licenses.json
docsSite/build
docsSite/build
xr
88 changes: 88 additions & 0 deletions docsSite/docs/more-features/advantagescope-xr.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
---
sidebar_position: 1
---

import Image1 from "./img/xr-1.png";
import Image2 from "./img/xr-2.png";

# AdvantageScope XR

:::warning
AdvantageScope XR is an experimental feature, and may not function properly on all devices. Please report any problems via the [GitHub issues page](https://github.com/Mechanical-Advantage/AdvantageScope/issues), though note that during the season we always prioritize bug fixes that affect non-experimental features.
:::

AdvantageScope XR brings the 👀 [3D Field](/tab-reference/3d-field) view to life in augmented reality, enabling you to visualize data in all new ways. See a simulated auto in life size, review match strategy with a tabletop field model, overlay diagnostic information on a real robot, and so much more! The video below demonstrates several use cases for this feature:

<iframe width="100%" style={{"aspect-ratio": "16 / 9"}} src="https://www.youtube.com/embed/gWPhQyB66DQ" title="AdvantageScope XR: Feature Overview" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>

## Requirements

- **Host:** The AdvantageScope desktop application on Windows, macOS, or Linux (v4.1.0 or later). Any firewalls on the device should be [disabled](https://docs.wpilib.org/en/stable/docs/networking/networking-introduction/windows-firewall-configuration.html#disabling-windows-firewall).
- **Client:** An iPhone or iPad running iOS/iPadOS 16 or later. No app installation is required.
- **Network:** Both devices must be connected to the same network (Wi-Fi, USB tethering, etc). Subject to the requirement below, this network does not need to be connected to the internet.
- **Internet:** If AdvantageScope XR has not been used recently, the mobile device must have an internet connection (e.g. cellular data). To eliminate this requirement, check the [offline usage](#offline-usage) section below.

:::tip
AdvantageScope XR is supported on many iPhone and iPad models, but is more stable for devices with a **LiDAR sensor**. This includes the iPhone Pro (starting with the iPhone 12 Pro) and iPad Pro (spring 2020 or later).
:::

<details>
<summary>What about other platforms?</summary>

AdvantageScope XR is only supported on iOS and iPadOS. We do not have any immediate plans to support alternative platforms. The client application requires tight integration with native APIs for augmented reality, video recording, web rendering, and more. We chose to prioritize iOS and iPadOS development and support for several reasons:

- **Consistency:** AdvantageScope XR is a demanding application. While Android devices vary widely in processing power and features, the iPhone and iPad provide a consistent development experience across generations. All recent iOS and iPadOS devices are powerful enough to run AdvantageScope XR, and newer devices support additional features AdvantageScope can utilize (such as LiDAR).

- **Availability:** The iPhone remains the most common smartphone that students in the United States are likely to own or have easily accessible from peers, and is more widely available than any model of VR or mixed reality headset. Supporting iOS maximizes the number of users who have easy access to AdvantageScope XR.

- **Tablet Support:** We think many users will want to take advantage of running AdvantageScope XR on a tablet, since tablets provide a larger display that is easier for multiple people to see at once. iPad is the most commonly used tablet worldwide, so supporting iPadOS makes the tablet experience as accessible as possible.

</details>

## Setup

1. On the host system, **click the "XR" button** on any 3D field tab. Only one XR host session may be active at the same time, so clicking this button will interrupt any other active sessions.

<img src={Image1} alt="XR button" height="450" />

2. The **XR controls window** will open, with a QR code and [options](#options) to customize the AR experience. To cancel the XR session and disconnect any clients, close the controls window.

<img src={Image2} alt="XR window" height="350" />

3. Scan the QR code using the **built-in camera app** on the client device. No app installation is required.
4. Tap "AdvantageScope XR" and then "Open" to **start the experience** and connect to the host. If prompted, allow AdvantageScope XR to access the **camera and local network**.
5. Follow the instructions on the device to **calibrate and position the field model**.
6. Control the field model as normal using the host device, including **log playback and live streaming**. The state of the field model is displayed live on the client device.
7. To quickly **record a video**, tap the "Record" icon at the top of the screen. Tap it again to stop recording, then edit and save the clip.

:::warning
Heatmaps, swerve states, and Zebra labels are not available yet in XR. All other object types are supported.
:::

:::tip
AdvantageScope XR is a demanding application, and may experience performance issues depending on the complexity of the 3D scene. Consider using simpler robot models or fewer objects if necessary.
:::

## Options

The XR controls window presents several options that control how the model is displayed in augmented reality:

- **Calibration:**
- Choose _Miniature_ to visualize a scaled-down version of the field, suitable for tabletop use.
- Choose _Full-Size_ to visualize the field with accurate scaling, positioned based on a real field barrier. Switching between _Blue Alliance_ and _Red Alliance_ controls which side of the field is used for calibration, but the full field is visualized in all cases.
- **Streaming:**
- Choose _Smooth_ for applications where some latency is acceptable in exchange for more reliable streaming, such as simulating auto routines or playing back log files.
- Choose _Low-Latency_ for real-time applications where some jitter is acceptable, such as overlaying data on a real robot or driving a simulated robot in teleop.
- **Show Carpet:** Display the flat carpet model under the field instead of overlaying on a real surface.
- **Show Field:** Display the field model, including the field barrier and game-specific elements. Custom [game piece objects](/tab-reference/3d-field#game-piece-objects) are always displayed.
- **Show Robots:** Display the robot models, can be disabled when overlaying data on a real robot (such as vision targets or 2D mechanisms).

## Offline Usage

AdvantageScope XR does not require an internet connection. To ensure that the app is available offline, download AdvantageScope XR from the App Store using the link below. To connect to the AdvantageScope desktop application, scan the QR code using the iOS camera app or tap the "Scan" button in the AdvantageScope XR app.

[![App Store](./img/app-store.svg)](https://apps.apple.com/us/app/advantagescope-xr/id6739718081)

:::note
Even when running without an internet connection, the host and client devices **must be connected to the same network** (such as a robot, custom Wi-Fi network, or via USB tethering).
:::
2 changes: 1 addition & 1 deletion docsSite/docs/more-features/custom-assets.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 5
sidebar_position: 4
---

# Custom Assets
Expand Down
2 changes: 1 addition & 1 deletion docsSite/docs/more-features/gltf-convert.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 6
sidebar_position: 5
---

# Converting Onshape & STEP Files to glTF
Expand Down
46 changes: 46 additions & 0 deletions docsSite/docs/more-features/img/app-store.svg
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 docsSite/docs/more-features/img/xr-1.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 docsSite/docs/more-features/img/xr-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docsSite/docs/more-features/nt-publishing.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 4
sidebar_position: 7
---

# Publishing NetworkTables Data
Expand Down
2 changes: 1 addition & 1 deletion docsSite/docs/more-features/zebra.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebar_position: 1
sidebar_position: 6
---

# Loading Zebra MotionWorks™ Data
Expand Down
2 changes: 1 addition & 1 deletion docsSite/docs/tab-reference/3d-field.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PrefsImage from '../img/prefs.png';

# 👀 3D Field

The 3D field shows a 3D visualization of the robot and field. It can be used with regular 2D odometry, but is especially helpful when working with 3D calculations (like localizing with AprilTags). Multiple camera views are available, including field relative, robot relative, and fixed. The timeline shows when the robot is enabled and can be used to navigate through the log data.
The 3D field shows a 3D visualization of the robot and field. It can be used with regular 2D odometry, but is especially helpful when working with 3D calculations (like localizing with AprilTags). Multiple camera views are available, including field relative, robot relative, and fixed. [AdvantageScope XR](../more-features/advantagescope-xr.md) allows this tab to be visualized using augmented reality. The timeline shows when the robot is enabled and can be used to navigate through the log data.

![Example of 3D field tab](./img/3d-field-1.png)

Expand Down
Loading
Loading