WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1  
Old 10-22-2009, 07:59 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
reset intersense not working

Hi,

I am trying to "reset my intersense" and am not having much luck.

I have followed what the manual says and gotten error messages (as has Jerry in a posting of 2007). (e.g. various attempts at callling resetHeading results in error messages. Other attempts with reset have also resulted in errors)

I searched the forum for suggestions by searching on the word "reset". There were a few relevant posts and the most helpful one occurred I think in 2007 between jerry and farshizzo. I tried farshizzo's suggested code (i.e. his last code entry), invoked his script, and hit the 'r' key. The weird arrows displayed re-orient themselves. As a potentially auspicous sign, there were no error messages on my console window (or whatever you call that window underneath where I type my code).

But then when escape from farshizzo's code and I then run my own code, it still uses the bad old coordinates. I find I am facing about 260 degrees rather than 0 degrees.

I thought, perhaps when I execute farshizzo's code it will not remember the new orientation between runs. Thus, I thought if I put his code (except for the stuff that draws the weird arrows) directly in my code, run it, hit the 'r' key, then my world world rotate around such that I was indeed facing the desired 0 degrees. When I did that I *still* do not get my world to re-orient itself.

Perhaps the previous posters had different goals that I did not understand.

If so, let me explain my basic goal:

I have my HMD sitting on my desk. It is facing forward toward my monitor. When my code is run and my world starts up, I want the yaw of the direction that the avatar's (to put it another way: the human user looking through the HMD) to be 0 degrees.

Right now, when my HMD sits in the above orientation on my desk when my world starts, we find that we are always initially facing about 260 degrees. This is not what I want. I want 0 degrees.

How do I make this happen? (If you could err on the side of explaining things very clearly for a newbie like me I would appreciate it).

(I suppose I could hack it by forcing the view to rotate such that the default view ends up being 0 degrees, but this would be inelegant and likely to bite us later. It's time I learn to do it the Right Way).

Thanks very much,

Bill

p.s. I am running vizard 3.0
Reply With Quote
  #2  
Old 10-23-2009, 11:46 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Please post the error messages you receive when calling the resetHeading() command. Also, please post the code you are using. The following code should reset the intersense heading to zero:
Code:
isense = viz.add('intersense.dle')
tracker = isense.addTracker()
tracker.resetHeading()
Reply With Quote
  #3  
Old 10-23-2009, 02:44 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
continuation of can't reset intersense

Hi,

Thanks for your reply.

Not much progress. The code you sent me does not cause the intersense to reset to 0. Details below...

My first interpretation of your message was that I should create a new .py file. Here are the entire contents of that file......

# This file, junk-test6.py is made in response to farshizzo post
# of 2009-10-23T11:46.
import viz
viz.go()
# The above two lines were not sugested by farshizzo but
# Bill thought they were required.
isense = viz.add('intersense.dle')
tracker = isense.addTracker()
tracker.resetHeading()

....when I ran this file I got no error messages....

Specifically, to run it, I hit the f5 button. I waited for the usual "world viz, we make virtual real." or whatever it says with the ball that rocks back and forth...After that finished I counted 5 seconds. Then I hit escape. Here is the output in my console window...

************************************************** ****************************
** Loading junk-test6.py
************************************************** ****************************
intersense.dle Intersense Extension
** Load Time: 3.86 seconds
InterSense Library ver. 4.04 32-bit
Copyright 1998-2007 InterSense Inc.
http://www.intersense.com
Tel: 781-541-6330

Looking for InterSense tracking device number 1.
Please wait ...

IC2 Plus device detected


......Likke you can see, no error messages.

Next I ran my code. When the world fired up, I was again not facing 0 degress. Rather I was facing -60 or so degrees.

I was hoping that running your suggested program would cause my program to run in such a way that it would start up facing 0 degrees rather than -60 degrees.

You asked to see my code...

I am a bit squeemish about sending you my code. It is more than 1k lines long. Plus, the PI may consider it proprietary I will have to check and this will induce a time lag (see Option 2 below). I could isolate the problem in a smaller set of code that reproduces this problem but that too will take time (see Option 1 below).

....If necessary we can work out a solution to the "send you my code problem".

Now I turn to a second interpretation of your message.....

You message was unclear about whether or not I should:

(A) include your code in a completely fresh independent python script that will cause my intersense to reset it self now and remain reset on all subsequent runs of whatever programs

OR

(B) whether I shoudl include your code in my original (> 1K long) program.

....As you can see from the above I have already done (A).

In addition I also did (B). Still no luck. Read on....

When I ran the resulting script I got the following red error message text (amongst many many lines of non-red presumably normal status output).....

** ERROR: Failed to auto-detect Intersense, try specifying port number
** ERROR: Failed to create extension sensor with intersense.dle

.....Well, let me know the best next step.

Some possible next steps I see:

Option 1) take my program and produce a smaller subset of it that I can send to the worldviz list for debugging

Option 2) ask the PI if I can post our > 1K lines of code to the list

Option 3) something else.

Thanks and sorry for such a long message,

Bill
Reply With Quote
  #4  
Old 10-23-2009, 02:56 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
Sorry, one more thing....I now see that when you asked me to send the resetHeading code I had used last night, there is a much simpler way to interpret your request.

I will now follow that much simpler interpretation...

This is the simple test program last night I wrote containing resetHeading. (You'll see I took your program and commented out the stuff I thought was not needed) My guess is that the problem is that I did not do an addTracker....farther below you will see the output to running this program (there were no errors).....

import viz
viz.go()

#Add ground
# ground = viz.add('tut_ground.wrl')

#Add intersense
PORT_INTERSENSE = 1
isense = viz.add('intersense.dls')

#Add node
#node = viz.add('marker.wrl')
#node.translate(0,1.5,4)
#viz.startlayer(viz.LINES)
#viz.vertexcolor(viz.RED)
#viz.vertex(0,0,0)
#viz.vertex(0,0.5,0)
#viz.endlayer(parent=node)

#Link sensor to node
#link = viz.link(isense,node)

#Create keyboard events
vizact.onkeydown('r',isense.reset)
#vizact.onkeydown('1',link.reset,viz.RESET_ORI_LOC AL)
#vizact.onkeydown('2',link.reset,viz.RESET_ORI_WOR LD)
#vizact.onkeydown('3',link.reset,viz.RESET_ORI_RAW )


.......This is the output when I ran that program and hit 'r' key a few times waiting about 1 second in between each press of the 'r' key.....

************************************************** ****************************
** Loading junk-test-reset5.py
************************************************** ****************************
intersense.dls Intersense Driver v4.0.4
**Connected to Intersense device on port 1
Type: IS Precision Series
Model: Unknown

Station State Time Cube Enhancement Sensitivity Compass Prediction
1 ON ON 1 2 3 2 0

** Load Time: 3.83 seconds
InterSense Library ver. 4.04 32-bit
Copyright 1998-2007 InterSense Inc.
http://www.intersense.com
Tel: 781-541-6330

Looking for InterSense tracking device number 1.
Please wait ...

IC2 Plus device detected
Reply With Quote
  #5  
Old 10-23-2009, 03:02 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Try the following. Place your intersense on a table and don't move it. Then run the following script and post the entire output it produces. It will connect to the intersense, print some data, then automatically exit after 5 seconds.
Code:
import viz
import vizact
viz.go()

# Connect to tracker
isense = viz.add('intersense.dle')
tracker = isense.addTracker()
tracker.resetHeading()

# Print yaw every 0.1 seconds
def PrintYaw():
	print tracker.getEuler()[0]
vizact.ontimer(0.1,PrintYaw)

# Exit after 5 seconds
vizact.ontimer(5,viz.quit)
Reply With Quote
  #6  
Old 10-23-2009, 03:52 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
Hi,

Thanks so much. I put that text and only that text in a file called junk-test7.py. Here is all the console output. I will need to leave sometime between 4 and 4:15 so might not get to a reply much later than that until Monday afternoon.

************************************************** ****************************
** Loading junk-test7.py
************************************************** ****************************
intersense.dle Intersense Extension
** Load Time: 3.86 seconds
-1.35147249699
-1.62718272209
-1.71201717854
-1.75447154045
-1.79756844044
-1.7783459425
-1.78230178356
-1.78103411198
-1.75742638111
-1.73760032654
-1.73417258263
-1.72444558144
-1.72945904732
-1.72773063183
-1.73152565956
-1.73443758488
-1.73983561993
-1.73608136177
-1.73267114162
-1.72360908985
-1.72150933743
-1.72571802139
-1.72094011307
-1.7204772234
-1.70909333229
-1.71233808994
-1.7073559761
-1.7088290453
-1.70856761932
-1.70898532867
-1.70795834064
-1.70782089233
-1.70644330978
-1.70155727863
-1.69582271576
-1.69755733013
-1.69902646542
-1.69755768776
-1.69800114632
-1.69273841381
-1.69273841381
-1.69273841381
-1.69273841381
-1.69273841381
-1.69273841381
-1.69273841381
-1.69273841381
-1.69273841381
-1.69273841381
-1.69273841381
InterSense Library ver. 4.04 32-bit
Copyright 1998-2007 InterSense Inc.
http://www.intersense.com
Tel: 781-541-6330

Looking for InterSense tracking device number 1.
Please wait ...

IC2 Plus device detected
Reply With Quote
  #7  
Old 10-23-2009, 04:10 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Based on the output, it seems as thought the resetHeading command is working correctly. The yaw values seem to be close to zero. If you are seeing an offset when linking the tracker to the viewpoint, then there might be problems somewhere else in your code.
Reply With Quote
  #8  
Old 10-26-2009, 04:19 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
Do I just need to run your code (and thus reset my intersense) just once. From that point on, any time the intersense is started up, 0 degrees will correspond to the positon it was in when it was last reset?

....OR....

Do I need to run your resettig code every single time I run my program?
Reply With Quote
  #9  
Old 10-27-2009, 11:25 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The Intersense driver does not preserve the reset settings across multiple runs, so you need to call the resetHeading command every time your script runs.

You can optionally hard code the offset value for the Intersense so you don't have to call the resetHeading command each time. Since the heading is based on the internal compass, the offset will need to be computed for each physical location the script is executed from.

To use this technique, connect to the Intersense without resetting it and place it in the desired zeroed heading position. Make sure the Intersense is stationary and there is no interference. Now grab the yaw value from the stationary Intersense tracker and use the following code to apply the heading offset:
Code:
# Connect to Intersense tracker
isense = viz.add('intersense.dle')
tracker = isense.addTracker()

ZERO_YAW = ... #Save the yaw value here

# Link tracker to main viewpoint
trackerLink = viz.link(tracker,viz.MainView)

# Apply yaw offset to link to reach desired zero heading
trackerLink.postEuler([-ZERO_YAW,0,0],target=viz.LINK_ORI_OP)
Reply With Quote
  #10  
Old 03-31-2010, 09:53 PM
billjarrold billjarrold is offline
Member
 
Join Date: Jul 2009
Location: San Francisco Bay Area
Posts: 39
Althought much time has passed...

Just for the record, I was never able to hand-roll a version of reset intersense that works (e.g. using the code above did not work). What did work was reading the comments in viztracker.py. It told me that I can reset using alt-r. (Well, technically it told me to use alt-R. That did not work. Luckily I perservered and guessed that there was a typo in which alt-R appeared where alt-r should have (see like 9 of viztracker.py) I am 75% sure I reported to support@worldviz.com. That was way back around version 3.140052 or so. I wonder if that typo has been fixed in the latest version? (-:

This evening, I've got some professional VR coder help trying to help me with rolling my own vesion of reset but so far we are unsuccessful, still forced to rely on alt-r. That's served us well for the past few months but (long story) we can't use alt-r anymore.
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
Linking and Intersense Question durf Vizard 1 07-23-2009 10:09 AM
intersense with 5DT glove sjp Vizard 2 04-06-2009 07:22 AM
Intersense reset Jerry Vizard 5 08-28-2007 02:32 PM
using demo with intersense G-Chan Vizard 1 02-06-2006 02:05 PM
intersense orientation jargon Vizard 2 05-14-2005 04:55 PM


All times are GMT -7. The time now is 09:36 PM.


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