WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-11-2009, 11:40 PM
_kj_ _kj_ is offline
Member
 
Join Date: Aug 2009
Posts: 2
The problem of tracker using via VRPN

Greetings to everyone!

We develop a small application in WorldViz. The viewport rotation must be implemented through 3DOF trackers in this application. Using embedded WorldViz driver for InterSense tracker, app works well. InterSense is used as follows:

Code:
viz.go( viz.TRACKER )
tracker = viz.add( 'intersense.dls' )
vizact.onupdate( 0, UpdateView )

def UpdateView():
	yaw, pitch, roll = tracker.getEuler()
	viz.MainView.setEuler( GetOrderedAndInvertedViewAngles( yaw, pitch, roll ), viz.BODY_ORI )

# Return ordered and inverted view angles depends on current settings
def GetOrderedAndInvertedViewAngles( yaw, pitch, roll ):
	# order:
	if view_angles_order_1.get() == viz.DOWN:
		y = yaw
		p = pitch
		r = roll
	elif view_angles_order_2.get() == viz.DOWN:
		y = pitch
		p = yaw
		r = roll
	elif view_angles_order_3.get() == viz.DOWN:
		y = pitch
		p = roll
		r = yaw
	elif view_angles_order_4.get() == viz.DOWN:
		y = yaw
		p = roll
		r = pitch
	elif view_angles_order_5.get() == viz.DOWN:
		y = roll
		p = pitch
		r = yaw
	elif view_angles_order_6.get() == viz.DOWN:
		y = roll
		p = yaw
		r = pitch
	# invert:
	if view_angles_invert_yaw.get() == viz.DOWN:
		y = -y
	if view_angles_invert_pitch.get() == viz.DOWN:
		p = -p
	if view_angles_invert_roll.get() == viz.DOWN:
		r = -r
	return [y, p, r]
But if we use WorldViz VRPN driver, the viewport rotations will go incorrect. If in zero orientation up/down tracker rotations result in up/down viewport rotations respectively, while turning tracker 90 degrees to the left/right, up/down tracker rotations will no longer result in proper up/down viewport rotations, but in left/right viewport roll... It seems that tracker and viewport work in different coordinate systems. We tried all combinations of flags in viz.MainView.setEuler() method and there was no combination that worked properly. It seems that the flag viz.ABS_LOCAL does not generally work correctly, because it works exactly the same as the viz.REL_LOCAL flag, so it interprets rotation angles as relative but not absolute, as it must be according to the flag`s name and its description in WorldViz help. There is a code:

Code:
viz.go()

vrpn = viz.add( 'vrpn7.dle' )
tracker = vrpn.addTracker( 'Head@localhost' )

def UpdateView():
	yaw, pitch, roll = tracker.getEuler()
	viz.MainView.setEuler( GetOrderedAndInvertedViewAngles( yaw, pitch, roll ), viz.BODY_ORI )

# Return ordered and inverted view angles depends on current settings
def GetOrderedAndInvertedViewAngles( yaw, pitch, roll ):
	# order:
	if view_angles_order_1.get() == viz.DOWN:
		y = yaw
		p = pitch
		r = roll
	elif view_angles_order_2.get() == viz.DOWN:
		y = pitch
		p = yaw
		r = roll
	elif view_angles_order_3.get() == viz.DOWN:
		y = pitch
		p = roll
		r = yaw
	elif view_angles_order_4.get() == viz.DOWN:
		y = yaw
		p = roll
		r = pitch
	elif view_angles_order_5.get() == viz.DOWN:
		y = roll
		p = pitch
		r = yaw
	elif view_angles_order_6.get() == viz.DOWN:
		y = roll
		p = yaw
		r = pitch
	# invert:
	if view_angles_invert_yaw.get() == viz.DOWN:
		y = -y
	if view_angles_invert_pitch.get() == viz.DOWN:
		p = -p
	if view_angles_invert_roll.get() == viz.DOWN:
		r = -r
	return [y, p, r]
Could anybody give a sample code of using 3DOF tracker for viewport control via VRPN, that is working properly?
Reply With Quote
  #2  
Old 08-12-2009, 12:39 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I believe the problem is that the VRPN server is sending the InterSense data in a different coordinate frame than Vizard's coordinate frame. You can use the swapQuat command on the VRPN tracker object to modify its coordinate system. I'm not sure what exact values you will need to correct the VRPN data, but here is how Vizard's built-in InterSense plugin swaps the quaternion data:
Code:
tracker.swapQuat([-3,4,-2,1])
Add this code after you create the VRPN tracker object and see if it helps. If it doesn't then you might need to modify the swap values.
Reply With Quote
  #3  
Old 08-13-2009, 01:03 AM
_kj_ _kj_ is offline
Member
 
Join Date: Aug 2009
Posts: 2
Thanks, this solution worked correctly at least for miniAHRS tracker via VRPN. I used exactly the same swap values for tracker.swapQuat(). We`ll test this solution for other trackers some time later.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
VRPN info sdiverdi Precision Position Tracker (PPT) 5 01-16-2011 01:00 PM
Problem with tracker after reboot eugcc Precision Position Tracker (PPT) 4 08-04-2009 12:26 AM
Does the vrpn7.dle tracker plug-in clear the udp buffer? michaelrepucci Vizard 2 09-19-2008 11:22 AM
swapPos and swapQuat with VRPN michaelrepucci Vizard 1 07-29-2008 12:27 PM
problem with female animations vmonkey Vizard 1 10-07-2005 11:36 AM


All times are GMT -7. The time now is 07:54 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC