Flockofbirdsdetailed

From vret
Jump to: navigation, search

Flock of Birds

The flock of birds need some extra attention compared to the other sensors it needs calibration on two things and the sensor needs to be told what hemisphere to use. Following this page step by step should give you a correctly working flock of birds in vizard

Adding flock of birds

We are using a "special" version of Vizard with some extra features for the flock of birds. These features may in the future make it into the normal Vizard update line. Up to then make sure you are using version 3.13.0005

ascension = viz.add('ascension.dle')

Loads the special flock of birds driver into Vizard

bird = ascension.addFlockOfBirds(birds=1, port=0, hemisphere=ascension.HEMI_FRONT )[0]

Makes connection to all flock of birds sensors and picks the first one. We only have one flockofbirds so the list should only contain one flock of birds

link = viz.link(bird, viz.MainView)

Connects the sensor input to the mainview point in Vizard

Hemispheres

When connecting to the flock of birds sensor you have to tell it what hemisphere you are gone use. If you go out of the hemisphere with the HMD the image will jump and axis will be swapped around until you re-enter the correct hemisphere again.

Flock of Birds transmitter

The hemispheres are all seen from the transmitter block.

  • HEMI_FRONT

the front of the block is at the opposite side of the wire

  • HEMI_REAR

the rear of the block is at the wire side

  • HEMI_LEFT

the left of the block is at the left side seen when looking from back to front

  • HEMI_RIGHT

the right of the block is at the right side seen when looking from back to front

  • HEMI_UPPER

the upper of the block is at the top of the block

  • HEMI_LOWER

the lower of the block is at the bottom of the block

Note

The flock of birds sensor often fails to connect properly a nice simple solution to cope with this is by using the following code:


attempts = 100

while attempts > 0:

birds = ascension.addFlockOfBirds(birds=1, port=0, hemisphere=ascension.HEMI_FRONT )
if len(birds) == 1:
bird = birds[0]
link = viz.link(bird, viz.MainView)
break
else:
attempts -= 1


Here the script tries to connect 100 times to the flock of birds before giving up. just make sure that the bird and link variable are declared as globals for later use in the calibration and reset steps.

Sensor HMD calibration (Once)

The sensor and transmitter needs to be calibrated in the perfect aligned position. This is when the block and the HMD are in a straight line of each other on the same height and with the center of the HMD at the center line of the block. The HMD needs to be at the front of the transmitter block

def calibrate()

offSet = sensor.getEuler()
print offSet

vizact.onkeydown('c',calibrate)


This is an example how you can read out the calibration values. The offSet values needs to be used in the HMD reset step.

I found my self that for the HMD in the medialab the offSet values: [116.97842407226562, 11.597296714782715, -98.300811767578125] works best but you can always try to find better values.

You can see when your calibration values are off when looking up and down or right and left after the reset step still show curvatures instead of straight movements.

Sensor HMD reset (every time)

You need to do the reset step every time you start your program. At the point that you execute the following code all movements will be measured from there so from then on the position the HMD is in will be looking straight ahead in the virtual world. It's therefor advisable to execute this step with a push of a button. You can do resets during the running of the program to set a new HMD position as looking straight ahead in the virtual world

There two different resets for two diffrent orientations of the transmitter block. When using an different block orientation then these two you need to figure out the correct values for the last reset line (link.postEuler([?,?,?]).

Transmitter sitting on it's bottom

def resetLink():

link.reset(viz.RESET_OPERATORS)
euler_offset = [123.09078979492187, 5.588435173034668, -95.282585144042969] # enter your offset here
inv_quat = viz.Matrix.euler(euler_offset).inverse().getQuat()
link.preQuat(inv_quat,target=viz.LINK_ORI_OP)
hmd_yaw = link.getEuler()[0]
link.postEuler([-hmd_yaw,0,0])

vizact.onkeydown('r',resetLink)

Transmitter facing with it's front to the floor

def resetLink():

link.reset(viz.RESET_OPERATORS)
euler_offset = [123.09078979492187, 5.588435173034668, -95.282585144042969] # enter your offset here
inv_quat = viz.Matrix.euler(euler_offset).inverse().getQuat()
link.preQuat(inv_quat,target=viz.LINK_ORI_OP)
hmd_yaw = link.getEuler()[0]
link.postEuler([-hmd_yaw,90,-90])

vizact.onkeydown('r',resetLink)