Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

P_FreeVRTracker.C

Go to the documentation of this file.
00001 /***************************************************************************
00002  *cr                                                                       
00003  *cr            (C) Copyright 1995-2019 The Board of Trustees of the      
00004  *cr                        University of Illinois                       
00005  *cr                         All Rights Reserved                        
00006  *cr                                                                   
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  * RCS INFORMATION:
00011  *
00012  *      $RCSfile: P_FreeVRTracker.C,v $
00013  *      $Author: johns $        $Locker:  $             $State: Exp $
00014  *      $Revision: 1.18 $       $Date: 2019/01/17 21:21:00 $
00015  *
00016  ***************************************************************************
00017  * DESCRIPTION:
00018  * This is Paul's new Tracker code -- pgrayson@ks.uiuc.edu
00019  * -dispdev freevr
00020  ***************************************************************************/
00021 
00022 #include "Matrix4.h"
00023 #include "P_Tracker.h"
00024 #include "P_FreeVRTracker.h"
00025 #include <freevr.h>
00026 
00027 void FreeVRTracker::update() {
00028   // FreeVR Wand is sensor 1
00029   #define WAND_SENSOR     1
00030 
00031   vrPoint wand_location;
00032   vrPointGetRWFrom6sensor(&wand_location, WAND_SENSOR);
00033   pos[0] = wand_location.v[0];
00034   pos[1] = wand_location.v[1];
00035   pos[2] = wand_location.v[2];
00036 
00037   /* get Euler angles for wand orientation */
00038   vrEuler wand_orientation;
00039   vrEulerGetRWFrom6sensor(&wand_orientation, WAND_SENSOR);
00040 
00041   orient->identity();
00042   orient->rot(wand_orientation.r[0],'x');
00043   orient->rot(wand_orientation.r[1],'y');
00044   orient->rot(wand_orientation.r[2],'z');
00045   orient->rot(90,'y'); // to face forward (-z)
00046 }
00047 
00048 int FreeVRTracker::do_start(const SensorConfig *config) {
00049   // Must check that we are actually running in FreeVR here; if not, return 0.
00050   if (!config->require_freevr_name()) return 0;
00051   if (!config->have_one_sensor()) return 0;
00052   return 1;
00053 }

Generated on Sat Oct 12 02:44:53 2024 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002