WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 9 votes, 5.00 average. Display Modes
  #1  
Old 10-02-2007, 09:46 AM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
Flock of Birds

I'm using FOB to capture position and orientation data. But sometimes Vizard has problems recognizing the birds. I often get an error message like (or something to the extent of): "cannot find bird on comp1." Here's the code I've been using for the birds:


flock1 = viz.add('flockofbirds.dls')
flock2 = viz.add('flockofbirds.dls')
flock3 = viz.add('flockofbirds.dls')
flock4 = viz.add('flockofbirds.dls')

flock1.command(6)
flock2.command(6)
flock3.command(6)
flock4.command(6)

*****{This is so I can save the output into a file*****}
tracking_data = open('headdatale1.py', 'a')
tracking_data2 = open('hipdatale1.py', 'a')
tracking_data3 = open('kneedatale1.py', 'a')
tracking_data4 = open('ankledatale1.py', 'a')

def mytimer(num):
if num == 0:

data1 = flock1.get()
data2 = flock2.get()
data3 = flock3.get()
data4 = flock4.get()

HEADLAT = data1[0]
HEADVERT = data1[1]
HEADAP = data1[2]
HEADYAW = data1[3]
HEADPITCH = data1[4]
HEADROLL = data1[5]

HIPLAT = data2[0]
HIPVERT = data2[1]
HIPAP = data2[2]
HIPYAW = data2[3]
HIPPITCH = data2[4]
HIPROLL = data2[5]

KNEELAT = data3[0]
KNEEVERT = data3[1]
KNEEAP = data3[2]
KNEEYAW = data3[3]
KNEEPITCH = data3[4]
KNEEROLL = data3[5]

ANKLELAT = data4[0]
ANKLEVERT = data4[1]
ANKLEAP = data4[2]
ANKLEYAW = data4[3]
ANKLEPITCH = data4[4]
ANKLEROLL = data4[5]

head_data = str(HEADAP) + '\t' +str(HEADLAT) + '\t' +str(HEADVERT) + '\t' +str(HEADYAW) + '\t' +str(HEADPITCH) + '\t' +str(HEADROLL) +'\n'
tracking_data.write(head_data)
hip_data = str(HIPAP) + '\t' +str(HIPLAT) + '\t' +str(HIPVERT) + '\t' +str(HIPYAW) + '\t' +str(HIPPITCH) + '\t' +str(HIPROLL) +'\n'
tracking_data2.write(hip_data)
knee_data = str(KNEEAP) + '\t' +str(KNEELAT) + '\t' +str(KNEEVERT) + '\t' +str(KNEEYAW) + '\t' +str(KNEEPITCH) + '\t' +str(KNEEROLL) +'\n'
tracking_data3.write(knee_data)
ankle_data = str(ANKLEAP) + '\t' +str(ANKLELAT) + '\t' +str(ANKLEVERT) + '\t' +str(ANKLEYAW) + '\t' +str(ANKLEPITCH) + '\t' +str(ANKLEROLL) +'\n'
tracking_data4.write(ankle_data)

I've checked the connection from the the birds to the other birds and to the computer itself. All are connected. So I'm tempted to think that it's not a hardware or hardwiring problem, but rather a code problem--I don't know. Is something messed up in my code? Am I calling something before creating/defining it? Any help would be great!

Thanks
Reply With Quote
  #2  
Old 10-02-2007, 10:19 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Did you declare the port number the flock is connected on and the number of birds that are connected? For example, if you were connecting to 2 birds on port 1 you would do the following:
Code:
PORT_FOB = 1
NUM_FOB = 2

flock1 = viz.add('flockofbirds.dls')
flock2 = viz.add('flockofbirds.dls')
Reply With Quote
  #3  
Old 10-02-2007, 11:00 AM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
I'm not sure I understand the port number. I have a total of 6 birds. Only bird #1 is plugged into this computer (the others are connected directly to another computer); however, I am nonetheless able to collected pos/ori data from all birds. So would I just declare the port to be bird 1? Like PORT_FOB = 1?

All 6 birds cannot be connected to the necessary computer (which is why only bird 1 (i'm assuming the master bird) is connected and everything else runs through that).

Does that make any sense?

What does port number mean? Can you explain it me (sorry I'm ignorant)? I checked online and they talked about 16 digit port numbers for internet connections, but somehow I don't think that's what I'm looking for here. How would I determine what port number the flock is connected on?

Last edited by Elittdogg; 10-02-2007 at 11:08 AM.
Reply With Quote
  #4  
Old 10-02-2007, 11:20 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
The flock of birds needs to be connected to your computer in order to communicate. The port number refers to the serial port number that the flock of birds is connected to your computer on. If your motherboard has a built-in serial port, then the port is usually 1. If you are using either a USB to serial convertor or an addon PCI serial card, then you need to check what the assigned port number is in your computers device manager.
Reply With Quote
  #5  
Old 10-02-2007, 12:32 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
Thank you. Another question pertaining to the birds. I've been collecting data from the birds and it seems a bit jagged. Like I think it's collecting at a faster Hz then the computer can handle/record. So I'm getting this spaced out data which then makes the visual stimulus jagged and sporatic. I was wondering, is there a way to control the collection rate from the birds through Vizard? Is there a way to check what Vizard's automatic collection rate is?

I'm getting data looks like this:
0.437679648
0.444935262
0.420377851
0.446498007
0.452190846
0.42595908
0.445046872
0.438572645
0.42874971
0.438907534
0.432656556
0.424061477
0.443707377
0.429084569
0.431875199
0.42607072
0.419596493
0.424731225
0.426293969
0.401624948
0.394704223
0.401178449
0.383653402
0.405420184
0.409550279
0.403187692
0.416471004
0.401624948
0.404750437


I need data that looks like this:
0.451731
0.451842
0.451731
0.452289
0.452847
0.453405
0.454075
0.454521
0.455079
0.455526
0.455972
0.456195
0.456084
0.455972
0.455749
0.455526
0.455414
0.454968
0.454856
0.454744
0.454409
0.454409
0.454075
0.453851
0.45374
0.453405
0.45307
0.452735


Anyway, I don't know why the data I'm getting is so "spaced" out. (I.e. if you look at 0.00th digit, in my data it jumps around a lot. In the data I need, it stays fairly consistent.) So I don't know. Maybe Vizard is collecting at XXX Hz but maybe the computer can only handle recording data at YY Hz so maybe I'm only get every couple of data points or so. I don't know? Again, is there a way to check what Vizard is collecting at? Or is there a way to control it so that I can make it compatible with the speed my computer can handle?
Reply With Quote
  #6  
Old 10-02-2007, 12:39 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
I don't believe the collection rate has anything to do with this. It is most likely caused by the fact that the flock of birds is not very accurate. The flock of birds is an electro magnetic tracker, which makes it very susceptible to jitter from ambient "noise". Make sure there are no large metal objects near the tracker.
Reply With Quote
  #7  
Old 10-02-2007, 12:51 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
I actually thought of that, but the emitter has been in the same place for a while (for many other studies) and there wasn't this problem. Also, I collected data on motion monitor with the emitter in the same place and that data was fine (that was actually the "data I need" from above--that was from motion monitor--the data I was getting was from Vizard). So how do I resolve this discrepancy?

I mean, I guess I could just collect from motion monitor and export files when necessary, but that creates a huge hassle for me.
Reply With Quote
  #8  
Old 10-02-2007, 01:32 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Vizard simply returns the raw data reported by the tracker. Are you sure this "motion monitor" program you are using is not performing some sort of filtering or smoothing of the data?
Reply With Quote
  #9  
Old 10-02-2007, 02:16 PM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
I think Motion Monitor does filter it using a Butterworth Double Pass Filter at 10 Hz cutoff (whatever that means). But I don't know how that would smooth the data and get such a different result than Vizard got. Then again, I know nothing about the filter in Motion Monitor, so I don't know.

Is it even possible for the raw data to look so different from the "filtered" data from motion monitor? And is there any way to apply some sort of filter or smoother to Vizard so I can get a similar result?
Reply With Quote
  #10  
Old 10-02-2007, 02:53 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
You could average the data over a certain number of frames. Vizard 3.0 includes the ability to filter tracking data. In Vizard 2.5 you will have to implement it yourself, but it is not very difficult. Just have a list that stores the previous X number of samples and average the data every frame.
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


All times are GMT -7. The time now is 11:30 PM.


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