Skip to content

Instantly share code, notes, and snippets.

@T-X
Created April 19, 2024 03:16
Show Gist options
  • Save T-X/83e2e16b6e07ac759c6bb85352ec083f to your computer and use it in GitHub Desktop.
Save T-X/83e2e16b6e07ac759c6bb85352ec083f to your computer and use it in GitHub Desktop.

Monado Installation

Monado Basalt

$ wget "https://gitlab.freedesktop.org/mateosss/basalt/-/jobs/54115049/artifacts/raw/basalt-monado-ubuntu-22.04-haswell-amd64.deb"
$ sudo dpkg -i basalt-monado-ubuntu-22.04-haswell-amd64.deb

-> results in failing monado-service during runtime... https://gitlab.freedesktop.org/mateosss/basalt/-/issues/9

$ sudo apt-get install git build-essential
$ git clone --recursive https://gitlab.freedesktop.org/mateosss/basalt.git
$ cd basalt
$ ./scripts/install_deps.sh

build currently fails, add this diff to fix it (https://gitlab.freedesktop.org/mateosss/basalt/-/issues/10):

user@ArgOS-Augen:~/dev/VR/basalt$ cd thirdparty/Pangolin/
user@ArgOS-Augen:~/dev/VR/basalt/thirdparty/Pangolin$ git diff
diff --git a/include/pangolin/log/packetstream_tags.h b/include/pangolin/log/packetstream_tags.h
index 13216f3d..d37392f0 100644
--- a/include/pangolin/log/packetstream_tags.h
+++ b/include/pangolin/log/packetstream_tags.h
@@ -1,3 +1,4 @@
+#include <cstdint>
 #pragma once
 
 #include <string>
diff --git a/src/image/image_io_jpg.cpp b/src/image/image_io_jpg.cpp
index cfa110a1..ec5d07e9 100644
--- a/src/image/image_io_jpg.cpp
+++ b/src/image/image_io_jpg.cpp
@@ -8,6 +8,7 @@
 
 #ifdef HAVE_JPEG
 #  include <jpeglib.h>
+#include <cstdint>
 #  ifdef _WIN_
 //   Undef windows Macro polution from jpeglib.h
 #    undef LoadImage
diff --git a/src/log/packetstream.cpp b/src/log/packetstream.cpp
index 7b97f864..1bcbac10 100644
--- a/src/log/packetstream.cpp
+++ b/src/log/packetstream.cpp
@@ -1,4 +1,5 @@
 #include <pangolin/log/packetstream.h>
+#include <cstdint>
 #include <stdexcept>
 
 namespace pangolin {
user@ArgOS-Augen:~/dev/VR/basalt/thirdparty/Pangolin$ cd ../..

And to fix deb package version, also add this diff:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index dbea255..102a150 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,17 +19,20 @@ if(DPKG_PROGRAM)
 endif(DPKG_PROGRAM)
 
 
-find_program(LSB_RELEASE_PROGRAM lsb_release DOC "lsb_release program of Debian-based systems")
-if(LSB_RELEASE_PROGRAM)
-  execute_process(COMMAND ${LSB_RELEASE_PROGRAM} -rs
-    OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-  if(${LSB_RELEASE_ID_SHORT} EQUAL "22.04")
-    set(DEBIAN_DEPENDS "libtbb12, liblz4-1, libbz2-1.0, libboost-filesystem1.74.0, libboost-date-time1.74.0, libboost-program-options1.74.0, libboost-regex1.74.0, libopencv-dev, libglew2.2, libjpeg8, libpng16-16, libuvc0, libfmt8")
-  endif()
-
-endif(LSB_RELEASE_PROGRAM)
+set(LSB_RELEASE_ID_SHORT "")
+#find_program(LSB_RELEASE_PROGRAM lsb_release DOC "lsb_release program of Debian-based systems")
+#if(LSB_RELEASE_PROGRAM)
+#  execute_process(COMMAND ${LSB_RELEASE_PROGRAM} -rs
+#    OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
+#    OUTPUT_STRIP_TRAILING_WHITESPACE)
+#
+#  if(${LSB_RELEASE_ID_SHORT} EQUAL "22.04")
+#    set(DEBIAN_DEPENDS "libtbb12, liblz4-1, libbz2-1.0, libboost-filesystem1.74.0, libboost-date-time1.74.0, libboost-program-options1.74.0, libboost-regex1.74.0, libopencv-dev, libglew2.2, libjpeg8, libpng16-16, libuvc0, libfmt8")
+#  elseif(${LSB_RELEASE_ID_SHORT} EQUAL "n/a")
+#    set(LSB_RELEASE_ID_SHORT "")
+#  endif()
+#
+#endif(LSB_RELEASE_PROGRAM)
 
 string(TIMESTAMP PROJECT_VERSION_REVISION "%Y%m%d%H%M")
$ cmake -B build -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBASALT_BUILD_SHARED_LIBRARY_ONLY=on
$ cmake --build build
$ cd build && cpack
$ mv *.deb ../basalt-monado-debian-sid-amd64.deb
$ cd ..
$ sudo dpkg -i ./basalt-monado-debian-sid-amd64.deb

Monado

$ sudo apt-get install build-essential git wget unzip cmake ninja-build libeigen3-dev curl patch python3 pkg-config libx11-dev libx11-xcb-dev libxxf86vm-dev libxrandr-dev libxcb-randr0-dev libvulkan-dev glslang-tools libglvnd-dev libgl1-mesa-dev ca-certificates libusb-1.0-0-dev libudev-dev libhidapi-dev libwayland-dev libuvc-dev libavcodec-dev libopencv-dev libv4l-dev libcjson-dev libsdl2-dev libegl1-mesa-dev libbsd-dev
$ sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev

$ git clone https://gitlab.freedesktop.org/monado/monado.git
$ cd monado
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Debug -DXRT_FEATURE_CLIENT_DEBUG_GUI=ON -DXRT_FEATURE_SLAM=ON -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX=~/.local
$ cmake --build . --target install

Allow monado-service to elevate its own priority:

$ sudo setcap CAP_SYS_NICE=eip ~/.local/bin/monado-service
$ apt-get install mesa-vulkan-drivers

$ mkdir -p ~/.config/openxr/1/
$ ln -s ~/.local/share/openxr/1/openxr_monado.json ~/.config/openxr/1/active_runtime.json

Verify with hello_xr:

$ apt-get install libopenxr-utils
  • XRT_DEBUG_GUI: to check values and (re)set position
  • XRT_COMPOSITOR_COMPUTE: performance?

For ATI/AMD, set power profile from "0 / BOOTUP_DEFAULT" to "4 / VR":

$ sudo sh -c 'echo "4" > /sys/class/drm/card0/device/pp_power_profile_mode'
$ XRT_DEBUG_GUI=1 XRT_COMPOSITOR_COMPUTE=1 monado-service &
$ hello_xr -g Vulkan

-> should display cubes in the Reverb G2 headset

You might also want to try decreasing the niceness / increasing priority of the monado-service if you get no more sensor / camera data after high system load. Monado currently does not reset the USB connection on-the-fly if it gets out-of-sync.

Shell aliases for that all that (replace "user" at the end with your user name):

alias monado-service-dbg-nice='sudo -E sh -c "echo 4 > /sys/class/drm/card0/device/pp_power_profile_mode; nice -n -10 su -c \"XRT_DEBUG_GUI=1 XRT_COMPOSITOR_COMPUTE=1 ~/.local/bin/monado-service\" user"'
alias monado-service-nice='sudo -E sh -c "echo 4 > /sys/class/drm/card0/device/pp_power_profile_mode; nice -n -10 su -c \"XRT_DEBUG_GUI=0 XRT_COMPOSITOR_COMPUTE=1 ~/.local/bin/monado-service\" user"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment