WorldViz User Forum  

Go Back   WorldViz User Forum > Precision Position Tracker (PPT)

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-23-2015, 02:16 AM
adhocdown adhocdown is offline
Member
 
Join Date: Mar 2015
Posts: 10
Thumbs down Tracking skews collisions

I have elegant, functioning collision code. However, once a tracker is introduced to the environment it stops working.

The MainView repeatedly teleports or twitches away from the encountered item instead of making contact and sliding. It's seizure worthy.

I have tried so many workarounds for this, but nothing stabilizes the collision code. I'm assuming it's a tracking-Vizard incompatibility issue, since it works fine in a mouse controlled environment. We're using the DK 2 Rift for orientation and PPT for position tracking.

I've seen a couple of people on the WorldViz forums with similar problems, but their questions were unfortunately never answered.
Reply With Quote
  #2  
Old 04-23-2015, 01:03 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Can you post example Vizard code that reproduces the issue for you?
Reply With Quote
  #3  
Old 04-23-2015, 10:58 PM
adhocdown adhocdown is offline
Member
 
Join Date: Mar 2015
Posts: 10
I simplified the code as much as I could. It replicates the same problem of glitchy collisions and the problem of 'Collided' calls en masse.

Code:
import viz
import time
import string
import vizact
import vizcam
import random
import oculus
import vizinfo
import vizshape
import vizinput

import viztracker
import vizproximity

viz.go()																				# Run Vizard.


#Flags
isIn = False
inWhat = -1
inWhere = None

# Counters.
revisitCtr = 0


# Arrays.
o_house = []
t_ball  = []
houses  = []

NUM_HOUSES = 24; 

# Detect and add the oculus rift ---------------------------------------------------------- #
hmd = oculus.Rift();
vrpn = viz.add('vrpn7.dle')								#Other code should use tracker number 5
posTracker = vrpn.addTracker('PPT0@WORLDVIZ-PC', 5)

isense = viz.add('intersense.dle')
oriTracker = hmd.getSensor()
oriTracker.reset(viz.RESET_OPERATORS)

if not hmd.getSensor():
	sys.exit('Oculus Rift not detected')
# Check if HMD supports position tracking ----------------------------------------------- #
headTracker = viz.mergeLinkable(posTracker, oriTracker)
supportPositionTracking = hmd.getSensor().getSrcMask() & viz.LINK_POS
if supportPositionTracking:
	# Add camera bounds model
	camera_bounds = hmd.addCameraBounds()
	camera_bounds.visible(False)

	def CheckPositionTracked():
		if hmd.getSensor().getStatus() & oculus.STATUS_POSITION_TRACKED:
			camera_bounds.color(viz.GREEN)
		else:
			camera_bounds.color(viz.RED)
	vizact.onupdate(0, CheckPositionTracked)

# Setup navigation node and link to main view
navigationNode = viz.addGroup()
viewLink = viz.link(navigationNode, viz.MainView)
viewLink.preMultLinkable(hmd.getSensor())

# Apply user profile eye height to view --------------------------------------------------- #
profile = hmd.getProfile()
if profile:
	viewLink.setOffset([0,profile.eyeHeight,0])
else:
	viewLink.setOffset([0,1.8,0])

headlink = viz.link(headTracker, viz.MainView)
headlink.reset(viz.RESET_ORI_RAW)
headlink.postScale([2,1,2])
hmd.window = headlink

vizact.onkeydown('r', oriTracker.reset)

MOVE_SPEED = 2.0
yaw,pitch,roll = headlink.getEuler()
m = viz.Matrix.euler(yaw,0,0)

# Add sensor to self.
manager = vizproximity.Manager()
target = vizproximity.Target(headlink)
manager.addTarget(target)
height = 1.3


# Enable Collision Detection --------------------------------------------------------------#
#viz.MainView.collision( viz.ON )
viz.collision(viz.ON)
viz.MainView.stepsize(3) #this seems to make the rejection twitching less violent


def mycollision(info):
	print 'Collided'
viz.callback(viz.COLLISION_EVENT, mycollision)



# Environment Setup ----------------------------------------------------------------------- #
day = viz.add('sky_day.osgb')
ground = viz.add('tut_ground.wrl')





LOCATIONS = [
	 [1, 0, -5]
	,[-5, 0, 1]
	,[5, 0, 1]
	,[3, 0, 2]
	,[2, 0, 2]
]
	
columns = []

	
# Birdhouse Setup ------------------------------------------------------------------------- #	
def make_a_home():
	col_num = 0
	for pos in LOCATIONS:
		print 'Add a house'
		newCol = viz.addChild('plant.osgb')
		
		#Create collision boxes and link to birdhouses
		colBox = viz.add('box.wrl', scale=[0.5, 8, 0.5])
		colBox.collideBox()

		colBox.disable(viz.DYNAMICS)
		colLink = viz.link( newCol, colBox )
		colBox.disable(viz.RENDERING)
	
		columns.append(newCol)
		
		x_val = pos[0]
		z_val = pos[2]
		print col_num
		print pos[0]
		print pos[2]
		columns[col_num].setPosition([x_val, 0, z_val]) 
		col_num +=1


make_a_home();

Additionally, we tried to turn on collisions with vizconnect, as well. However, the moment we useviz.collision(viz.ON), it disconnects our avatar from MainView. Do you know why this occurs?
Reply With Quote
  #4  
Old 04-27-2015, 12:47 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The problem is the position of the navigation node keeps going after the viewpoint stops from a collision. When you try to back away from a collision object it takes awhile for the navigation node to catch up to the viewpoint.

A solution for this is to use a view_collision module written for use with vizconnect. This checks for collisions against an avatar object and then goes back up the chain to modify any transport node that's driving it. To be clear, no avatar needs to be rendered, that's just what vizconnect uses to group the head tracker and any hand trackers. I've attached an example that includes the view_collision module, the main script that adds a maze and collisions, and desktop vizconnect configuration files. If you create your own vizconnect config file with PPT+Oculus and load that with the maze script it should work with collisions. The setup for the collision detection is in warehouse_maze.py:

Code:
ac = view_collision.AvatarCollision(collideTrackers=True) 
ac.setCollideList([vizconnect.AVATAR_HEAD]) 
ac.setTransport(vizconnect.getTransport().getNode3d())
Attached Files
File Type: zip vizconnect collision.zip (10.3 KB, 5549 views)
Reply With Quote
  #5  
Old 02-25-2016, 04:26 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
Hey Jeff,
I tried to use your module (view_collission) but some issues appeared:
1)it was an error when trying to use the self._avatar.getSkeleton().getBoneDict()
2) I'm using a transport and not an avatar so i need to replace the avatar commands with transport ones, how can i do that?

I'm using vizconnect with oculus rift Dk2 AS TRACKER, than the transport is walking and the input device is xbox 1 controller (using direct input) and finally the oculus rift DK2 as display (hirarchic order - tracker->transport->display)

Thanks in advance.
Reply With Quote
  #6  
Old 02-25-2016, 05:40 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
There's no need to download the view collision module I attached in my previous post. The latest view collision module is now included with the Vizard installation. If you have a vizconnect file with an avatar and transport then you can run the following code:

Code:
import viz
import vizconnect
from vizconnect.util import view_collision

vizconnect.go('vizconnect_config.py')
maze = viz.addChild('maze.osgb')

ac = view_collision.AvatarCollision()
ac.setCollideList([vizconnect.AVATAR_HEAD])
ac.setTransport(vizconnect.getTransport().getNode3d())
Your vizconnect file must have an avatar to use this collision module. If you don't want to render an avatar then choose the head and hands option and delete the glove.cfg file listed under right hand filename.
Reply With Quote
  #7  
Old 02-28-2016, 04:21 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
Hi Jeff,
Thanks for your replay.
I have vizard 5.2 with active license and i need it to be that kind of version, is it free to upgrade it to vizard 5.3 with active license? if not, is your module in the thread is similar to the one added to vizard 5.3 or that changes have been made since than?
Third question is when in the hierarchy should i put my avatar in order for your module to work?

Thank you.
Reply With Quote
  #8  
Old 02-28-2016, 05:08 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You can go to Help > Check for Updates to download the latest version of Vizard. There have been updates to the collision module. When you upgrade to 5.3, you'll also need to upgrade the Oculus runtime to version 0.8.

The transport should be a parent of the avatar so the avatar moves when the transport moves.
Reply With Quote
Reply

Tags
collision, glitch, teleport, tracking, twitch

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
Using vizcave without tracking pcatalano Vizard 3 01-08-2013 11:17 AM
Can I get real time Intersense tracking data from another computer on the network? GoldenSun Vizard 4 04-30-2008 08:42 PM
tracking with multiple LEDS dan12345 Precision Position Tracker (PPT) 7 04-02-2008 11:44 PM
ImmersaDesk system tracking kgarr Vizard 10 09-14-2006 12:17 PM
tracking using quaternarion data jfreeman Vizard 2 06-01-2005 09:48 AM


All times are GMT -7. The time now is 02:14 PM.


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