# Extended Reality Application Framework for a Digital-Twin-Based Smart Crane
## 2 Materials and Methods
### Software Setup  
The software setup used several toolkits, packages, and plugins to facilitate the XR environment, namely, model module design, function module design, and communication module design.  
**Unity:** Unity is a leading real-time development platform for creating and operating interactive, real-time 2D, 3D, VR, and AR content. It is cross-platform, supporting more than 20 platforms, e.g., Windows, Android, and iOS. It is time-saving for sharing development assets between different contents. Meanwhile, Unity has abundant external packages to assist professional development. In addition, Unity is free for the non-profit personal developer.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Content** & **Oculus Quest 2** & **HoloLens 2** & **Varjo XR-1** \\ \hline Manufacturer & Facebook & Microsoft & Varjo Technology \\ Resolution & 1832 \(\times\) 1920 & 2 K & 1920 \(\times\) 1080 \\ Field of View & 120\({}^{\circ}\) & 43\({}^{\circ}\times\) 29\({}^{\circ}\) & 87\({}^{\circ}\) \\ Refresh Rate & 90 Hz & 60 Hz & 90 Hz \\ Tracking Mode & inside-out & inside-out & outside-in \\ Hand Tracking & ✓ & ✓ & \\ Controller & ✓ & & ✓ \\ Virtual Reality & ✓ & & ✓ \\ Mixed Reality & & ✓ & ✓ \\ \hline \hline \end{tabular}
\end{table}
Table 2: XR devices comparison: the basic design parameters and features of three XR devices used in the service layer, namely Oculus Quest 2, HoloLens 2, and Varjo XR-1.  
**OpenXR:** Previously, there was no unified and standard interface between the XR hardware and the XR application. Every hardware had a specific SDK (Software Development Kit) to integrate with the XR application, which increased the development period and maintenance cost for the cross-platform developers. OpenXR, provided by Khronos Group, is a royalty-free, open standard that provides high-performance access to XR platforms and devices [63]. Currently, the developers merely focus on the OpenXR application layer based on the development platform, such as Unity and Unreal, while the device manufacturers concentrate on the OpenXR device layer. OpenXR is compatible with Oculus Quest 2, HoloLens 2, and Varjo XR-1.  
**XRTK/MRTK:** The XRTK (XR Interaction Toolkit) is a component-based interaction system. It provides a framework for the developers to implement the basic functionalities of the XR applications. Meanwhile, the MRTK (Microsoft Mixed Reality Toolkit) provides a set of components and features to accelerate cross-platform MR application development, supporting OpenXR and Microsoft HoloLens 2.  
**HslCommunication:** HslCommunication is an open-source package to solve complex data communication between industrial networks. It can be used among several independent programs, different operation systems, and different IDEs (Integrated Development Environments). In this research, we developed the MQTT client in Unity with the HslCommunication package.  
**RestSharp API:** RestSharp is a comprehensive REST API client library based on the.NET framework. Meanwhile, RestSharp is a lightweight REST API Client library implementing synchronous and asynchronous HTTP calls. RestSharp is used in the communication module of the application layer.  
**UA-NETStandard:** It is an official OPC UA.NET standard stack from the OPC Foundation..NET standard ensures all common platforms are available today without extra modification. Given the Unity supporting programming language, the OPC UA-Unity client was developed based on UA-NETStandard.