This is a read-only mirror of pymolwiki.org

RUCAP UM-5

From PyMOL Wiki
Jump to navigation Jump to search

RUCAP UM-5 tracker

RUCAP UM-5 tracker is a wireless joystick for view control in PyMol. The code based on project ImmersiveViz.

Our system contains a head tracking thread which communicates the users position to a PyMol script via a socket. The PyMol script unpacks the message and updates the world respectively. All rotation is done around the virtual origin in PyMol and zoom is also considered.

Operating principle

Tracker RUCAP UM-5 in real time detects the absolute position and orientation of Your head relative to computer monitor. Antenna RU constantly traces the position of emitter CAP and transmits the data to RUCAP UM-5 Service program for further processing. The main window of service program shows head model that reflects all Your moves. Information from ultrasonic sensors is processed into concrete commands for the PyMol or computer program which runs RUCAP UM-5 profile at the moment.

RUCAP UM-5 Tracker Service program allows to set mouse, keyboard or joystick emulation. Once You chose the right type of emulation, you can set commands for different moves of the tracker.

Getting UM-5 data of the users position into socket by your script rucap.py

# -*- coding: cp1251
# Take data from UM-5 and put to the socket on port 4440.
#----- The server used to listen for head tracking
#		self.server = Server(self, 4440)
#----- The server used to listen for the GUI to update the values / display info
#		self.gui = Server(self, 4441)

from ctypes import *


RUCAP_VERSION = 3
RUCAP_RESULT_OK = 0;
RUCAP_RESULT_FAIL = 1;
RUCAP_RESULT_TRACKERAPP_OFF = 2;
RUCAP_RESULT_UNPLUGGED = 3;
RUCAP_RESULT_DEVICE_NOT_CREATED = 4;
RUCAP_RESULT_BAD_VERSION = 5;

# load dll
a = CDLL("rucap.dll")
# call function, that returned int
a.RucapCreateDevice.restype = c_int
print "RucapCreateDevice:"
print a.RucapCreateDevice(c_int(RUCAP_VERSION))

# initialisation of device
if (a.RucapCreateDevice(c_int(RUCAP_VERSION)) == RUCAP_RESULT_OK): print "Can`t create ruCap device\n"

a.RucapGetHeadPos.restype = c_int
x = c_float(0.0)
y = c_float(0.0)
z = c_float(0.0)

# main loop
while (1) :
    if a.RucapGetHeadPos(byref(x),byref(y),byref(z)):
        print "No Position!"
    else :
        #print '%f %f %f\n' % ( x.value, y.value, z.value)
        print x.value, y.value, z.value

Availability

Additional Information

PyMol Script of ImmersiveViz