BeagleBoard based VRPN Nodes

VRPN is a great library to interface to a lot of input devices commonly used on Virtual Reality applications. From magnetic trackers to datagloves, the list of supported devices is quite long.

So, why do not use a BeagleBoard with a wifi interface as a VRPN server?. That could be very useful as the beagle is pretty small, has low power consumption (so it could run on batteries if needed) and enough CPU power to deal with most of the input devices supported by VRPN.

Seems interesting, so we compiled VRPN on the Beagle. We did it natively so in the libquat and libvrpn makefiles we just uncommented the pc_linux option. Looks like the VRPN makefiles are cross-compiling ready but we didn't try that (choose the pc_linux_arm if you want to).

We compiled version 7.26 without any problem and we made a quick test with a standard analog device (like a joystick) to control a simple model on an OpenScenegraph application, and it worked pretty well.

Now we can integrate VRPN into picoFlamingo to allow users interact with their 3D slides with any of the devices supported by this great library... a Wii Nunchuck plus arduino will be a cheap and interesting option to move and rotate our models.

For those of you who want to try...

In the Beagleboard you need to execute the vrpn_server generic server that should be in vrpn/server_src/pc_linux. In the parent directory (vrpn/server_src) you can find the vrpn.cfg file. Browse the file to find out if you can use any of the supported devices. If not, just chose the Tracker_NULL, that is very good for testing.

Remember the identifier you used in the configuration file. Shoudl be something like Tracker0 for the NULL Tracker, but you can choose whatever you want.

The OSG test application below is very simple and crappy but does the work. Here is the code:

#include <osgDB/ReadFile>
#include <osgViewer/Viewer>
#include <osg/PositionAttitudeTransform>
#include <osgGA/TrackballManipulator>

#include <vrpn_Analog.h>
#include <vrpn_Tracker.h>

using namespace osg;
using namespace osgGA;
using namespace osgViewer;

static float ix, iy, iz, ia, ib, ic;
static float tras_scale = 10.00f;

#define TRACKER 
//#define ANALOG

#ifdef ANALOG
void    VRPN_CALLBACK  
handle_analog(void *userdata, const vrpn_ANALOGCB b)
{
  ix =  b.channel[0] * tras_scale;
  iy = -b.channel[2] * tras_scale;
  iz =  b.channel[1] * tras_scale;

  printf ("Position %f %f %f\n", ix, iy, iz);
}
#endif

#ifdef TRACKER
void    VRPN_CALLBACK  
handle_tracker (void *userdata, const vrpn_TRACKERCB b)
{

  ix =  b.pos[0];
  iy =  b.pos[1];
  iz =  b.pos[2];

  printf ("Position %f %f %f\n", ix, iy, iz);
}
#endif

int main(int argc, char **argv)
{
    ref_ptr             model;
    Viewer                    viewer;
    PositionAttitudeTransform *pat;
    TrackballManipulator      *manipulator;
#ifdef ANALOG
    vrpn_Analog_Remote        *tkr;
    tkr = new vrpn_Analog_Remote("Analog0@Beagle");
    tkr->register_change_handler(NULL, handle_analog);
#endif
#ifdef TRACKER
    vrpn_Tracker_Remote       *tkr1;
    tkr1 = new vrpn_Tracker_Remote("Tracker0@Beagle");
    tkr1->register_change_handler(NULL, handle_tracker);
#endif    
    manipulator = new TrackballManipulator();
    viewer.setCameraManipulator(manipulator);

    model = osgDB::readNodeFile(argv[1]);
    pat = new PositionAttitudeTransform;
    pat->addChild (model);

    viewer.setSceneData (pat);

    while (!viewer.done())
      {
#ifdef ANALOG
	tkr->mainloop();
	pat->setPosition (pat->getPosition() + Vec3 (ix, iy,iz));
#endif

#ifdef TRACKER
	tkr1->mainloop();
	pat->setPosition (Vec3 (ix, iy,iz));
#endif
	viewer.frame ();
	usleep (50000);
      }
}

Uncomment the appropriate define for you (or pass it from the makefile), and update the identifiers for your devices. You can use names for the host (as in the example above) or the IP address if you prefer (something like "Tracker0@192.168.0.202") For compilation something like this should work: g++ -o vrpn_test vrpn_test.cpp -losgViewer but that can change with your specific OSG installation. Note that this is just an example to verify that you can get data from your beagleboard VRPN server. Depending on your device and on your application you will need to update the code for properly render your scene. In the code we are assuming that an analog device is delivering relative data and a tracker absolute data, but that is a very simplistic assumption (and implementation). CU The picoFlamingo Team

Comments

Interesting information about activation

I think this board is the proper place to ask you about the activation proccess. My link is not working properly, do you know why it is happening? http://www.papermint-designs.com/?...

Wrong Link

The link you provided is invalid. What are you trying to access?. Please use the Contact form for further information