northstar on linux
Summary
The past few weeks have been spent getting familiar with a North Star (NS) headset workflow on Linux. As part of CoMuse I hope to move towards a fully open-source stack for multi-user musical AR experience. Hereās a bunch of instructions on how to get started with North Star on Linux. Instructions are for Arch-based systems, e.g. EndeavourOS, and assumes a Wayland compositor, rather than X11, e.g. kwin_wayland
. Also familiarity with a terminal emulator, e.g. alacritty
.
Current Windows Workflow
North Star ā Project Esky ā Unity ā Unity Scene
Proposed Linux Workflow
North Star ā OpenXR ā Monado ā Application
Installation for Robots
Hey there! If youāre feeling adventurous and trust me enough to run a bash script, then boy oh boy do I have a treat for you. Iāve created a script that will get you started with North Star on Linux.
Now, I know what youāre thinking. āWhy on earth would I trust some random person on the internet with access to my terminal?ā Well, let me tell you, friend. You can trust me becauseā¦ uhā¦ it was partially created by ChatGPT, a highly advanced, eloquent and benevolent artificial intelligence programmed to assist and guide humans with their tasks. ChatGPT is great, in fact, ChatGPT wrote this paragraph! So yeah, thatās why you can trust it meā¦ Yeah, letās go with that.
So, if youāre feeling stupid, go ahead and run this command in your terminal:
curl -sS https://www.sambilbow.com/assets/code/ns-monado.sh | bash && leapctl eula
and skip to Getting Started
I take no responsibility if your computer suddenly gains sentience and starts plotting world domination.
Installation for Humans
OpenXR (Open Standard XR API)
Download, build, and install openxr-git
from the AUR, i.e. yay -S openxr-git
Monado (OpenXR Runtime for GNU/Linux)
Download, build, and install monado-git
from the AUR, i.e. yay -S monado-git
Ultraleap (Hand Tracking)
As written in the Linux documentation, Ultraleap have released their Gemini V5 tracking software as a beta for Ubuntu 22.04 LTS. However, the files are accessible via their repository for non-Debian Linux systems. I have created a meta-package for all three required packages below on the AUR
. It can be installed via yay -S ultraleap-hand-tracking
and accepting default options when prompted.
Here are the individual packages, with links to their official Debian repository location, and their AUR
counterpart:
-
š½
ultraleap-hand-tracking-service
- a background service that attaches to Ultraleap devices. -
š½
ultraleap-hand-tracking-control-panel
- a GUI application that shows cameras & info. -
š½
openxr-layer-ultraleap
- an OpenXR layer that allows Ultraleap devices connect at the API layer.
If you donāt want to use the AUR
, unarchive the .deb
from each repository, then do the same with the data.tar.xz
inside (you can ignore control.tar.xz
, this only contains meta-information about the package). Place all sub-directory files in their respective folders on your operating system using sudo mv [file path] [destination path]
.
Run the following after installing, to enable the service at startup, and accept the Ultraleap EULA.
sudo systemctl enable ultraleap-hand-tracking-service --now && \
leapctl eula
RealSense (6DoF Tracking)
Download, build, and install librealsense
and libuvc
from the AUR, i.e. yay -S librealsense libuvc
Arduino (Firmware)
Download, build, and install arduino
from the community
repository, i.e. yay -S arduino
Monado Configuration
-
Make sure you Monado is set as your active OpenXR runtime. Check via the environment variable:
echo $XR_RUNTIME_JSON
. If there is no output, follow these instructions. -
Set
~/.config/monado/config_v0.json
to the following:
- Set
~/.config/monado/NorthStarCalibration.json
to the following, replacing theuv_to_rect
attributes with your own V2 calibration results:
Setting Environment Variables
If you want direct-mode, you have to use an X11 compositor with Monado, its not currently supported on Wayland or Xwayland. That said, I wanted to use Wayland because š¤·, Iām also used to extended-mode from the Unity Windows workflow so lack of direct-mode doesnāt bother me right now. Either way, you will need to set the following Monado environment variables in your shell configuration file, this guide assumes zsh
, and therfore ~/.zshrc
. Feel free to add them with this command:
echo '
export NS_CONFIG_PATH=~/.config/monado/NorthStarCalibration.json # Set path to North Star calibration file.
export XRT_COMPOSITOR_DISABLE_DEFERRED=true # Keep Monado open even if no apps running.
export XRT_COMPOSITOR_FORCE_XCB=1 # Force an X11 window, thus causing Xwayland.
export XRT_COMPOSITOR_XCB_FULLSCREEN=1 # Fullscreen variable for X11/Xwayland.
' >> ~/.zshrc && exec zsh
Getting Started
Hardware
- Plug in your North Star via USB 2.0 (either use a hub or a motherboard port, depending on whether or not you have a 2.0 port). Using Ultraleap devices through USB 3 on Linux is not currently supported due to driver shenanigans. Source:
- Plug in your North Star via DisplayPort to your graphics card.
- Force
portReset()
on your North Star, via holding down the circle and dot buttons for 5 seconds. This power cycles your USB 3 header sensors (Stereo IR 170 and Intel T261) and ensures that they enumerate properly. - Check that the sensors are working correctly
- Run RealSense Viewer and check that the T261 is listed under sources.
- Run Ultraleap Control Panel and verify that the camera feed is being received.
- Close both.
Starting Monado
- Run
monado-service
. If all goes well, you should be greeted with an output log that mentions yourNorthStarCalibration.json
being read. Look forINFO [p_create_system] Creating system:
, specifically the lines:Got devices: 0: Intel RealSense Device-SLAM 1: North Star
- A grey, fullscreen Xwayland Monado window should open on your main display.
- Move it to your North Star display, e.g by using the Kwin shortcut
Meta-Shift-right
- Congratulations, you win š
- You can check Monado has access to your sensors by running a demo.
- Open a new terminal, download this simple demo, enter the directory, make and run the demo with:
git clone https://gitlab.freedesktop.org/monado/demos/openxr-simple-playground && \ cd openxr-simple-playground && \ cmake ./ && \ make && \ ./openxr-playground
- You should have hand and 6DoF tracking working. Congratulations, you won again š
Uploading Integrator Sketches
- Download the Linux compatible
North-Star-Integrator
sketches:git clone https://github.com/sambilbow/North-Star-Integrator.git && \ cd North-Star-Integrator/firmware/ExampleSketches
- You may have to add yourself to the usergroup that
/dev/ttyACM0
(the Arduino Leonardoās serial port) is part of if you are receiving errors uploading sketches.- Run
stat /dev/ttyACM0
in a terminal - Note the user group that the serial port is assigned to, e.g.
dialout
orplugdev
- Add your user to this group with
sudo usermod -a -G [group] [username]
-
sudo
run command as superuser -
usermod
modify user attributes -
-a
append -
-G
group
- Run
- Add the
../libraries/SX1508
folder to your Arduino library directory (default on Linux:/home/[user]/Arduino/libraries
)mkdir -p ~/Arduino/libraries && \ cp ../libraries/SX1508 ~/Arduino/libraries/
-
../libraries/SX1508/src/util/sx1508_registers.h
has been renamed toSX1508_registers.h
in this repo because I was getting errors when I tried to access this file in the Arduino IDE on Linux, I believe this was because of UNIX case-sensitivity.
-
- Open a sketch from the folder in Arduino IDE
- Install any additionally required libraries (on Linux I needed to add the
Keyboard
library) - Set the correct Port and Board in
Tools >
- Verify and Upload the sketch.