# Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9

 Page 21/30 Date 08.07.2018 Size 489 Kb.

## Location

The glove’s filtered location is given by P5.x, P5.y, and P5.z. Or you can read them as a vector with P5.Pos.

The units are in P5 Units by default. P5 Units are equal to a 51.2th of an inch, or roughly half a mm. But because GlovePIE supports units, you can read these values in any units that you want, like this:
debug = p5.x in cm
Also GlovePIE allows you to compare values that are in different units like this:
Enter = p5.x > 1.5 inches
GlovePIE uses Left-Handed coordinates, like Direct3D does (which was a bad decision in hindsight). So x is the sideways position, with negative to the left and positive to the right. y is the vertical position with negative down and positive up. And z is the forwards/backwards position with negative away from the screen and positive towards the screen. Note that the z value will always be negative, since you can’t physically move the hand past the receptor. That makes z values confusing, and I’m sorry. Just get used to negative numbers.

### Filtering

You can set the amount of filtering with P5.FilterFrames and P5.FilterDistance. P5.FilterFrames is the number of past frames to average together with the current frame to calculate a smoother position. P5.FilterDistance is the minimum distance the glove has to move in order to register any movement at all. It is good for keeping the position completely still even if you move the glove a tiny bit. It is in P5 Units by default, but you can use any units you want.

eg.
P5.FilterFrames = 10

P5.FilterDistance = 5 mm

debug = P5.x

### Unfiltered Position

You can also read the unfiltered position of the glove using P5.AbsoluteX, P5.AbsoluteY and P5.AbsoluteZ. You can also read it as a vector with P5.AbsPos.

### Relative Mode

Back in the dark ages of the P5 Glove, it was only able to support Relative Mode. Relative Mode means it works like a 3D mouse. You can read its movements, but you can’t tell where it is currently located in physical space. The advantage of relative mode is that it is smoother, and that it doesn’t matter if the rotation isn’t calculated correctly. The disadvantage is that you don’t know where the glove is.

You can read the Relative Mode position with P5.RelativeX, P5.RelativeY, and P5.RelativeZ, (or P5.RelativePos for a vector). The units are still in P5 Units.
I recommend using RelativeMode (with the smooth function) for things like aiming where you don’t care about the glove’s position, and the normal x, y, and z values when you care about the position.

### LED Positions

The glove has 8 yellow infra-red LEDs mounted on it at fixed locations. The receptor needs to see one of them to calculate a rough position, and three of them to calculate a rotation. It can see a maximum of four of them at a time.

You can read the positions of each LED individually with P5.Led0x, P5.Led0y, P5.Led0z, P5.Led1x, P5.Led1y, P5.Led1z, …, P5.Led7x, P5.Led7y, P5.Led7z. The default units are P5 Units. You can also use P5.Led0Pos, etc. if you prefer a vector.
If the LED is visible it will return the actual position of the LED, otherwise it will guess the position based on the positions of the other LEDs it can see.
LED 0 is the top one above the right hand side of your wrist.

LED 1 is the one to the right of your little (pinky) finger.

LED 2 is the one on the left of your little (pinky) finger.

LED 3 is the one on the back of your hand.

LED 4 is the one near your index finger.

LED 5 is the top one above your thumb.

LED 6 is the lower one on the right hand side of your wrist.

LED 7 is the lower one near your thumb.

You can tell whether an LED is visible or not, using p5.Led0vis, etc.

You can also find out the raw (well almost raw) tan values that the glove returns for that LED. There are 3 values.

“h” is the horizontal position measured by the sensor at the top of the receptor tower. Negative means left, positive means right. 512 means roughly 45 degrees to the left, -512 means roughly 45 degrees to the right. It can exceed that range.
“v1” is the vertical position measured by the sensor at the top of the receptor tower. Negative means down, positive means up. This sensor is angled downwards about 10 degrees. The range is the same.
“v2” is the vertical position measured by the sensor at the bottom of the receptor tower. This sensor is angled up about 17 degrees.
These values are p5.Led0h, p5.Led0v1, p5.Led0v2, p5.Led1h, etc.
These raw tan values are the ONLY values the glove hardware gives the computer about the position of the glove. Everything else is to be calculated from these values. Use them for testing how to improve the driver, or if you think you can do better than my driver.
If you want to know the position of the LEDs relative to the glove (their unchanging physical position) use p5.ActualLed0Pos, p5.ActualLed1Pos, etc. They are vectors. Their values never change, unless you buy a new version of the glove.
P5.LedsVisible tells you how many LEDs are currently visible.

### Speed and Acceleration

You can tell how fast the glove is moving with P5.Speed. It is just a number measured in P5Units Per Second.

If you want to know the velocity (speed with direction) of the glove, on the x, y and z axes, then you can use P5.XVelocity, P5.YVelocity and P5.ZVelocity. They are also in P5Units per second.
XVelocity is how fast it is moving to the right. Or negative if it is moving to the left.

YVelocity is how fast it is moving up. Or negative if it is moving down.

ZVelocity is how fast it is moving towards the screen. Or negative if it is moving backwards.
If you want a vector, use P5.Velocity.
To find out how fast the velocity is increasing (the acceleration) you can read P5.XAcceleration, P5.YAcceleration, and P5.ZAcceleration. Or the vector P5.Acceleration. They are measured in metres per second per second.
Velocity is good for detecting punches and gestures like that.

### When the glove is in range

You can tell whether or not the glove is visible to the receptor by reading P5.InRange, or by the number P5.LedsVisible.

If you want to know WHY the glove isn’t visible you can use one of these other values:
P5.BehindSomething

P5.SwitchedOff

P5.TooFarLeft

P5.TooFarRight

P5.TooFarUp

P5.TooFarDown

P5.TooFarForward

P5.TooFarBack

P5.UntrackableAngle
They are all only GlovePIE’s best guess. They are not guaranteed. The UntrackableAngle one doesn’t work very well.
They are true if the glove isn’t visible for that reason, and false if the glove is visible or if it is not visible for some other reason.

Share with your friends:

The database is protected by copyright ©dentisty.org 2019
send message

Main page