carbonian-vr-phone - a phone in a cardboard holder as a VR
headset
carbonian-vr-phone command [arguments]
An Android phone becomes a head-mounted display for Carbonian's VR
home. The phone's sensors (the game rotation vector and the gyroscope, 500
Hz) give the head's orientation; the picture goes back to the phone's screen
over USB tethering. Monado's phone compositor target
(XRT_COMPOSITOR_FORCE_PHONE=1, in Carbonian's fork, with
SIMULATED_PHONE=1 for the head) renders the two eyes without a
window, an encoder (NVENC, H.264) sends them, and the app on the phone
decodes and redraws them at every refresh with the lens's pre-distortion and
a timewarp from its own sensors.
Turn on USB tethering on the phone (the Dell sees a network
interface, driver rndis_host, cdc_ncm or cdc_ether) and open the app,
Carbonian HMD. The Dell finds the phone as that interface's
neighbour: no address is typed. Ports on the phone: 7701 head tracking, 7702
picture, 7703 settings.
- up
- Starts carbonian-vr-phone.service (the user unit: the XR runtime of
vr.conf with the phone as the headset, on the GPU and at the
bitrate of vr-phone.conf; a headset's carbonian-vr.service,
if running, makes room and is remembered) and opens the VR home
(carbonian-ctl vr home on; not with home off). Then the app
on the phone connects by itself.
- down
- Closes the home, stops the unit, and starts carbonian-vr.service
again if it was running before up.
- install
[--build] [hmd-native]
- Puts the app on the phone (adb, USB debugging on): the package's
hmd-native.apk, signed with Carbonian's release key. With
--build (or when the package has no APK) it is made from the
sources on this machine: hmd-native is Rust against the NDK only, a
NativeActivity with no Java and no crates, and needs rustup's
aarch64-linux-android target, the NDK of Debian's
google-android-ndk-r27c-installer and the SDK of
google-android-platform-34-installer and
google-android-build-tools-34.0.0-installer. The Java apps (hmd,
xfer) are only in a checkout's devtools/vr/android-java. Android
updates an app only when it is signed with the same key: remove a
debug-signed one from the phone first.
- build
[hmd-native|hmd|xfer]
- Only build it: /var/tmp/phone-build/APP.apk. xfer is the transfer
test (throughput and latency).
- status
- The runtime's unit, the home, whether the app answers on the phone, the
USB network interface, the phone's address and adb's devices.
- tune
- The lens, centring and picture with the keyboard, live: up and down pick,
left and right change (shift: ten times), s keeps the values on the
phone, r resets, q leaves.
- get, set KEY
VALUE..., save, apply [FILE]
- The same settings, one at a time; apply sends vr-phone.conf
and keeps it.
- latency
[SECONDS]
- Measures the latency with the app running and the home drawing. The Dell's
clock and the phone's are synchronised (the sample of 300 round trips with
the shortest one; the offset is right to within half of it, a few hundred
microseconds). The app then reports, from the display's own presentation
times (EGL_ANDROID_get_frame_timestamps): the age of the gyroscope sample
the pose is read from, the time from the pose being read to the frame
being on the display, their sum (head rotation to photon: what the
timewarp gives) and the video's age on the display, counted from the end
of its encoding on the Dell.
- record
[--eye left|right|both] [SECONDS]
[FILE]
- Records to an mp4 on this machine. By default one eye of what the
compositor draws (the picture the phone is sent: no lens distortion,
1200x1080 per eye, the left unless --eye says otherwise;
both keeps the two side by side without re-encoding): while it
runs, Monado's phone target also writes its encoded stream to a file (it
is told by $XDG_RUNTIME_DIR/carbonian-vr-phone-record, and starts
on a key frame), and the eye is cut out with ffmpeg. It needs the VR
runtime running with that Monado, not the phone. Default 30 seconds and
~/Videos/vr-phone-EYE-DATE.mp4.
--screen records the phone's own screen instead, the lens's
distortion and the timewarp included (Android's screenrecord over
adb: 2400x1080, 24 Mbit/s, at most 180 seconds).
- view
[flat|stereo|toggle]
- The phone as a headset with lenses (stereo: two eyes, the lens's
distortion; a cardboard holder) or as flat: one view over the whole
screen, no lenses, all 2400x1080 pixels for one picture (the phone in the
hand, its movement still turns the view). The runtime renders one view or
two, so this writes view in
~/.config/carbonian/vr-phone.conf and, if the runtime is up,
restarts it (down, up).
- recenter
- The way the phone points now becomes straight ahead: the app drops its
tracking connection, and the Dell's driver (which takes the yaw off at the
first packet of a connection) reconnects and recentres. The home's panels
are carbonian-ctl vr home recenter's.
- track
- The head tracking as the Dell reads it: rate, lost packets, angles.
- xfer
- The transfer test's server.
- encode,
stream
- The encoder Monado starts (carbonian-vr-phone-encode), and a plain
screen-to-phone stream.
/etc/carbonian/vr-phone.conf and
~/.config/carbonian/vr-phone.conf.
vr-phone.conf(5), carbonian-vr(1)