#1
|
|||
|
|||
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 |
|
|