This week end I’ve started to work on the Virtual Reality part of the API, and more specifically on the tracking system.
The first step is to be able to read the data from the tracking system.
In the past I’ve used VRJuggler , this is an open source framework dedicated to Virtual Reality. It’s really flexible (this is the most flexible library I’ve ever used), and it’s supporting the Intersense IS900 tracking system (which is what Schlumberger has in its iCenter).
As I said I knew this API before I started the project, but I decided not to use it to handle the graphics part because it can’t be link statically and so it would have implied a lot of DLL to distribute with the library which is exactly what I wanted to avoid.
Compilation
So, first I had to recompile VRJuggler because there are no binaries for Visual Studio 2008, this took me ages to do because there are a lot of projects inside the solution and a lot of paths to set.
Fortunately, I’ve found on internet a link to a large zip file containing all the dependencies (compiled with VS 2008) for the library (375 MB !), so thanks a lot to the person who did that, I would have probably not had the time to do it myself.
Both Debug and Release versions compiled fine, but for some reasons only the Release version is working, the debug version crashes at initialization. I decided not to waste time on making the Debug version work because it’s not really important.
Environment variables
The main drawback of VRJuggler is that it depends on a lot of environment variables for the path. The reason is the library is so flexible that it requires to load a lot of config files at runtime. I really wanted to avoid using environment variables because it would have meant installing VRJuggler on the client machine, which is not really a good option.
After looking into the API code, I managed to find how to force it to use relative paths for the different files it needed. So now there is no need to install the whole VRJuggler package ! (I still need to test it on another computer to be 100% sure).
Config files
VRJuggler loads the hardware configuration from one or several “jconf” files at runtime (These are XML files), and there is a tool called VRJConfig to help generating them.And here is the second biggest drawback of VRJuggler : this is so flexible that the config files are quite complicated to generate, even with VRJConfig… (you need to set the drivers, the hardware, to create some proxys, windows, aliases,…)
And VRJConfig is a bit buggy too: it won’t save the configuration properly all the time, sometimes it writes, sometimes it doesn’t…
So, after a few hours spent on the configuration ( don’t forget I’ve already done once during my placement, I let you imagine what it was like the first time…), I managed to generate 2 configuration files :
- “intersense.jconf” : this is the config file to read the tracking system data directly from the COM port. (You can find here the 3 different ways to get IS900 data, basically you can : read from the COM port using VRJuggler driver, read from the COM Port using the Intersense API, read the data from the Intersense Trackd Server). I decided to use VRJuggler’s driver.
- “intersenseSimu.jconf” : this is a config file which simulates an IS900 device and so I can change the device values using the keyboard.
VRJuggler Kernel
VRJuggler is using a system of kernel, this means there is no “main” function, instead we create a class which inherits from one of VRJuggler kernel class and we overload the methods we want.
At the initialization VRJuggler will start the kernel in a new thread.
I’ve written a new kernel based on the “Simple Input” example provided with the SDK and on the work I’ve done during my placement.
TrackingDLL
I’ve now started to write a DLL, it has a C interface. This way it can dynamically be loaded by the main API without having to recompile.
The interface allows the user to :
- start / stop the tracking system
- get the data for the 2 position devices (head / wand), 2 analogic buttons (joystick x and y axis), 6 digital buttons (red,green,blue, yellow, trigger, joystick).