Flightgear with VR920 headtracking

Recently I basically got Flightgear to work with quad buffered stereo. The only thing that was still missing for having the Vusix VR920 head mounted display fully supported in the flight simulator was headtracking.

However, with my new headtracking driver, VR920 headtracking in Flightgear is possible at last. A good part of the work has been done by Anders Gidenstam who provided the original Nasal module, the headtracking protocol description and usage instructions for his webcam based headtracking solution for Flightgear.

Download and copy the protocol description [download#59] to $FG_ROOT/Protocol. For me (gentoo system) this location is /usr/share/games/FlightGear/Protocol/, probably for many others it is /usr/share/FlightGear/Protocol/

Afterwards download unzip the modified Nasal module [download#58] to ~/.fgfs/Nasal. It is important to use your home directory and NOT i.e. /usr/share/games/FlightGear/Nasal/.

Then make sure that the vr920 headtracking driver runs in UDP mode. If running Flightgear on the same machine as the headtracking driver, which should be the usual case, just use 127.0.0.1 as destionation IP for the driver and use 4242 as destination port. These are the default settings of the driver.

Finally run Flightgear with these options: –generic=socket,in,<hz>,,<port>,udp,headtrack –prop:/sim/headtracking/enabled=1

If you also want to have quad buffered stereo with it (you need an nvidia quadro board, with assumably a pre G80 Chip or probably an ATI FireGL, never tried that, and a stereo enabled xserver) use the patch from FlightGear with quad buffered stereo. For instructions on how to get the xserver to work in stereoscopic mode see: Vuzix VR920 with Linux and active 3D stereo

For the described configuration you can use the following little startup script:

export OSG_STEREO_MODE=QUAD_BUFFER
export OSG_STEREO=ON
fgfs –generic=socket,in,25,,4242,udp,headtrack –prop:/sim/headtracking/enabled=1

Now have much fun and enjoy a new experience with your VR920 and Flightgear in stereo with headtracking.

best regards

Jürgen

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

VRTrack 1.0 – headtracking driver for the vr920 HMD

As I promised in New version of the vr920 headtracking driver coming soon here is the new version of my headtracking driver for the Vuzix VR920 iwear for Linux. It calculates yaw, pitch and roll from the accelerometer and magnetometer data (The device has got three of each). This makes a 3DOF tracking possible and allows you to look around in a 3D Scene.  In example you can use the driver with my stereoscopic image viewer SIV. The driver averages the sensor readings with an improved algorithm, which gives a far smoother experience than with the initial driver version. The driver package consists of a daemon which can be run in the background and for convenience a basic control application that enables one to easily tweak the various driver settings and to callibrate the device. For general Information on how to use the device with Linux see: Vuzix VR920 with Linux and active 3D stereo.

The driver provides the trackingdata in different formats to the application using it. It always writes the data to /dev/headtracking. A line read from /dev/vrtrack consists of six floats that correspond a sensor reading in this format:

yaw pitch roll x y z

Yaw, pitch and roll are angles from 0 to 360 degrees. X, y and z are always zero for the vr920, since it only supports three degrees of freedom. These values are reserved for future devices which may support six degrees of freedom, in the hope to propose a standard for tracking devices.

The driver can scale the readings and invert the axes independantly to get the needed value range for the used application and a pleasant experience.

For maximum compatibility with existing applications there are four other modes of operation available that can be enabled separately:

  • Joystick emulation
    The driver emulates a joystick device /dev/input/jsX. The readings for yaw, pitch and roll are the X,Y and Z axis of the emulated joystick. This may be used to enable basic headtracking support in games that do not natively support headtracking.
  • Mouse emulation
    The driver emulates a joystick device /dev/input/mouseX. The readings for yaw and pitch are being translated to X and Y of the mouse device, so when you look right the mouse pointer moves to the right and when you look up the pointer moves upwards and vice versa.  This may also be used to enable basic headtracking support in games that do not natively support headtracking. It can also be used to just control the mouse pointer of the window system. Controlling the viewport of the window system can also be a resonable purpose. With the new MPX extension in xorg this may be possible.
  • UDP – network
    In UDP mode the driver sends the tracking data via network as UDP unicast. The approach to send the data out via network makes the language used for writing the application independant from the language used for developing the driver. The packet sent to the clients contains the three angles, yaw, pitch and roll and x,y and z as 32 bit fixed point in Q16.16 format. This mode may i.e. used to control flightgear.
  • Multicast – network
    In multicast mode the driver sends the tracking data via network as UDP multicast, thus many clients may read the data, which makes parallelization more possible, i.e. one could use one machine for rendering and another machine for calculations. In addition to this, the approach to send the data out via network makes the language used for writing the application independant from the language used for developing the driver. The tracking data sent to the clients contains the three angles, yaw, pitch and roll and for easy usage a viewmatrix, one can directly use with scenegraph libraries. If you intend to develop an application using the headtracking of the VR920 see the file democlient.cpp included in the download for details on how to get the data into your application. This mode is used by the stereoscopic image viewer SIV.
Below is a screenshot of the control application during callibration of a vr920 device:

control_app

Important note: During calibration make sure that the display of the device is displaying something. Since the displays not only showing a blue screen influences the sensor data (at least with my device) you’ll end with wrong calibration else. You may use i.e. nvidia-settings to ensure this. For detailed usage instructions see the readme included in the download.

Download:

I decided to publish the driver under the creative common noncommercial license. You may download the full source from here: vr920-driver(source) (4848 downloads ) , an x86_64 binary from here: vr920-driver(x86_64 binary) (4236 downloads ) , or an i686 binary from here: vr920-driver(i686 binary) (4396 downloads ) . An Archlinux PKGBUILD provided by Feilen is available here: aur.archlinux.org More binary/distribution specific formats may be available in the future. The x86_64 binary has been build on an up to date gentoo system, the i686 binary on ubuntu hardy. For the i686 binary you may install libconfig++ i.e. libconfig++8_1.3.2-2 from here: libconfig++ If none of the binaries works for you, you may have to build from source…

You need to have libusb, libconfig++, libfuse and libcurses installed on your system. For ubuntu users I included the small shell script ubuntu_install_deps.sh that installs the dependencies. Maybe it works also for for other Debian-based distributions. Gentoo users just have to make sure that  libusb, ncurses, fuse, and libconfig have been emerged. Your kernel version has to be at least 2.6.31 and you must have cuse enabled in your kernel.

Footnote:

If you like the driver, feel free to link to www.mygnu.de. If you developed an application using the tracking data provided by the driver please leave a comment, because then I can review the application and eventually write about it. To request commercial licenses contact us at info(at)mygnu.de. Well, if you just want to support our work on MyGNU.de use the donate button 😉

best regards

Jürgen

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

New version of the vr920 headtracking driver coming soon

Last year I published the first version of my linux headtracking driver for the VR920 HMD here. Currently I am working on a new driver version which will have the following additional features:

  • Multiple Protocols:
    -UDP multicast (as before)
    -UDP unicast (for flightgear connection and perhaps more)
    -mouse emulation (via uinput)
    -joystick emulation (via uinput)
    -character device for direct angle readings (via cuse, will
    require a kernel >= 2.6.31)
  • Inverting of axes (to have moving the head up making the mouse pointer up or down, depending on needs)
  • Better filtering algorithm (more stable headtracking)
  • Scaling of data (i.e. to match screen size with mouse mode)
  • Customisable delay between sensor readings
  • User interface separated from the driver

With the upcoming MPX and the mouse emulation it should be possible to control the visible viewport by turning around the head. Controlling the view for games or other software that do not natively support headtracking should also be possible with the emulation.

In the current development stage most of the features are basically working so expect the new driver to be released soon.

Stay tuned for updates

Jürgen

1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

pulseaudio – flash blocks the audio device

On my x86_64 gentoo box, running gnome and therefore pulseaudio, I experienced the problem that when and after playing some flash videos (i.e. youtube) the sound device was blocked and no other application was able to play sound.  After killing the plugin sound worked just normal, but that was no convenient way.

64-bit flash plugin for Firefox

My first suspective was the 32-Bit flash plugin I used  in my 64-bit Firefox until now. So I replaced it by the new 64-bit plugin, which did not solve the problem, since it does also not use pulseaudio for playback. But I include the steps for completeness here:

echo “=www-plugins/adobe-flash-10.2.161.22_pre20100915 **” >> /etc/portage/package.keywords

emerge adobe-flash

For other linux distributions  like Debian, Ubuntu, Redhat or Suse you obviously have  to search the appropriate plugin and  install it the distribution-specific way. Afterwards you have to remove the 32-bit plugin from nspluginwrapper, which makes 32-bit plugins available for 64-bit firefox:

nspluginwrapper  -r /usr/lib/mozilla/plugins/npwrapper.libflashplayer.so

As I stated before this does not solve the problem, but at least it gives one a 64-bit flash plugin 😉

Make alsa applications use the pulseaudio server

There is a pulseaudio plugin for alsa, which is necessary for playback of alsa sound via the pulseaudio server. So the next step is to install this plugin. For gentoo it is contained in the alsa-plugins package. So for the gentoo way:

emerge alsa-plugins

Afterwards make sure that your /etc/asound.conf contains the following lines:

pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
type pulse
}

After restarting alsa everything that is playing sound via alsa now uses pulseaudio via the plugin and the sound device is no more used concurrently. One can playback via pulseaudio after using flash sites or even at the same time. Mission accomplished!

OSS emulation for pulseaudio

Sadly the above only works for applications directly using the alsa sound system. Applications depending on OSS (i.e. all Java Applications), using the kernel layer alsa oss emulation, still block the audio device, so the the kernel layer OSS emulation is a no go with pulseaudio. Include the corresponding modules in /etc/modprobe.d/blacklist.conf or remove the emulation completely from your kernel configuration.

screenshot

Of course this only shuts off these applications completely but is neccesary for the further steps to work. We´re lucky, we can use a daemon which provides the OSS devices (/dev/dsp, etc.) and links them via fuse to the pulseaudio daemon. For this we need to load the cuse kernel module (add it to /etc/modules.autoload.d/kernel-2.6 and it gets loaded automatically on next reboot)  or when not available add the functionality  to your kernel configuration and rebuild your kernel.

kernel configuration for cuse

Now we´re ready to install ossp, the daemon I mentioned before. It is available from Sourceforge, probably also in your distributions package repository. For gentoo users, as usual there is a more easy way. I found an ebuild for ossp on gentoo bugzilla, which I got to work with minor modifications. You can download the modified ebuild here: [download#40]

To use the ebuild, just copy it to/usr/local/portage/media-sound/ossp/ . You probably have to create the directory. Then run

ebuild /usr/local/portage/media-sound/ossp-1.3.2.ebuild digest

Be sure to include the following line in your /etc/make.conf.

PORTDIR_OVERLAY=”/usr/local/portage”

Also include ossp into your /etc/portage/package.keywords

echo “media-sound/ossp **” >> /etc/portage/package.keywords

Afterwards just

emerge ossp

For having osspd started automatically on every system boot I lazily included it in my /etc/conf.d/local.start.

echo /usr/sbin/osspd >> /etc/conf.d/local.start

Now sound should just work as one expects it to. Different sources can playback at the same time. No blocked devices occur because of concurrency, no matter which sound API the applications use.

Jürgen

References:

BombStrike´s blog: How to use two different computers with two differents OSes seemlessly

H3X.SE: FAQ

Linux Live: ALSA and Jack Cooperate using PulseAudio

Gentoo Bugzilla: osspd ebuild

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Nokia N810 GPS fix solution

The Nokia N810 with its internal GPS is a device that should fit well for navigation purposes. Below you can see it running navit. In my opinion this is the best available navigation software for the N810. Navit is the main reason for me for wanting the GPS unit in the N810 to be reliable. Get the svn version from here: Gerrit’s Techie Stuff. Some hints on getting navit to run on the N810 can be found on wiki.navit-project.org.

N810 running Navit
N810 running Navit

Sadly the internal GPS unit of the N810 is known to be very problematic and occasionally hardly gets a fix. The suspect seems to be the gpsdriver. It writes i.e. the almanac data to /var/lib/gps/nvd_data. This file seems to be corrupt sometimes when the gpsdriver writes it. Probably the problem occurs when the GPS unit has no fix. The bug entry on this topic on bugs.maemo.org inspired me to write a small wrapper script for the gpsd that copies a backup to /var/lib/gps/nvd_data and watches the gps-daemon. When the GPS unit has a fix it creates a new backup copy of the nvd_data file for later use. Since I use the script, acquiring a GPS fix never took me more than five minutes anymore (without AGPS, with AGPS it is faster, of course).

If you also want to give my script a try, install bash via program manager and download my script from here: [download#23]

The most convenient way to get the script to the n810 and to perform the necessary changes is to log into the tablet using ssh. How to get ssh to run on your internet tablet is described here: internettabletblog

Log into your tablet using ssh and rename the original gpsd.

-sh-3.2# mv /usr/sbin/gpsd /usr/sbin/gpsd.orig

Then copy my script to the tablet (replace XXX.XXX.XXX.XXX with the ip of your tablet):

scp gpsd root@XXX.XXX.XXX.XXX:/usr/sbin/

Afterwards fix the permissions of the script on the tablet:

-sh-3.2# chmod a+rx /usr/sbin/gpsd

That’s all, now you should have a much better working GPS unit in your N810. Since I only have one device to test this on, please leave a comment if this also worked for you.

regards

Jürgen

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

nvidia-drivers-180.60 is working !!!

After I have tested the nvidia-drivers-185.18.08 beta I searched the web for a new one and I found it yesterday on nvnews.net. This version seems to run well on my Dell M4300. For all using Gentoo I  made an ebuild:[download#20]

# mkdir /usr/local/portage/
# cd /usr/local/portage/
# tar -xpvf nv-portage.tar

Be sure that PORTDIR_OVERLAY=”/usr/local/portage” is in your /etc/make.conf, then you can emerge it:
# ACCEPT_KEYWORDS=”~amd64″ emerge =nvidia-drivers-180.60 -1

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

nvidia-drivers-185.18.08 beta is not working

Because of the problem with a good, fast and working nvidia driver, I’ve tested the actual beta driver from Nvidia. After installing it on my system (Dell M4300, with zen-sources 2.6.29-r3 running fine on it) everything seems to be fine. But there was the first fault. The character set in the Terminal swaps. The next serious error was restarting the X-Server or crashing the whole system while surfing with Epiphany. So I downgraded my system to nvidia-drivers-180.29 again as mentioned here. It seems Nvidia has to do some work on it, still we have another working release. Stay tuned, we will test it and tell you our experience with any new driver we found from Nvidia.

LG Thorsten

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

siteinfo

Translator