Copyright 6 Vista 7 new! Languages 8 Glovepie scripts 9

NEW! Reading TrackIR like a game

Download 489 Kb.
Size489 Kb.
1   ...   22   23   24   25   26   27   28   29   30

NEW! Reading TrackIR like a game

In theory, if you have a real TrackIR, then GlovePIE can read from it the same way a game would. GlovePIE pretends to be a game, and asks for the Yaw, Pitch, Roll, x, y, and z values. The TrackIR software must be running for this to work.

You can read it like this:

RealTrackIR.yaw, RealTrackIR.pitch, RealTrackIR.roll, RealTrackIR.x, RealTrackIR.y, and RealTrackIR.z

Note that these values are NOT the angles and position of the physical vector clip. They are the angles and position of the virtual in-game head which is normally a large exaggeration of the physical movements. You can change that behaviour if you want.
Also note that TrackIR may change the way the x, y ,z values move based on the yaw, pitch, and roll values. Which is good if you are only interested in the virtual head, but bad if you are interested in the real head. You can turn that feature off in TrackIR.
You can also read the TrackIR version:

Raw TrackIR camera input

You can also use the Optitrack SDK to read from a physical TrackIR camera. This existed in previous versions, but didn’t work, because I forgot to start the camera. In theory it should be fixed now. Although some of the names have been changed so as not to clash with the new TrackIR stuff.

The TrackIR software should NOT be running when using the TrackIR like this.
TrackIR.Illumination controls the IR LEDs on the TrackIR that shine on things so TrackIR can see them. It is true or false.
TrackIR.GreenLED controls the green status LED. TrackIR.RedLED controls the red LED. TrackIR.BlueLED controls the blue LED.
You may need to set the lights a couple of times if their actual state didn’t match the state GlovePIE thought they were in.
VectorClipX, VectorClipY, and VectorClipZ give the 3D position of the vector clip.

VectorClipYaw, VectorClipPitch, and VectorClipRoll give the orientation of the vector clip.

You can tell whether it can see all the dots that make up the clip by reading AllDotsVisible.
You can set Dist01, Dist02, Dist12 and DistoL if you have a custom vector clip that doesn’t match the standard one. They are the distances between dots and between certain points on the clip.
If you don’t have a vector clip, or if you just want to read dots individually, you can use:
Dot0x, Dot0y, Dot1x, Dot1y, Dot2x, Dot2y.
You may need to read the width and the height of the camera resolution, which are in Width, and Height. You can also read the framerate of the camera in FrameRate. Note that this might not match GlovePIE’s frame rate.

You can also read Serial, ModelNumber, ModelName, RevisionNumber, and RevisionName.

NEW! Novint Falcon

The Novint Falcon is a consumer-priced 3D input device with extremely sophisticated haptic feedback. To create the sense of touch, or physical objects accurately, it normally updates the forces 1000 times per second. GlovePIE can’t really go that fast, but you can set GlovePIE’s frame rate quite high with lines like this:

PIE.FrameRate = 500Hz
With the normal grip, the falcon has 4 buttons, which you can read as follows. They are either true or false:
Falcon.Button1, Falcon.Button2, Falcon.Button3, and Falcon.Button4
But the Falcon supports grips with up to 31 buttons, so GlovePIE also supports Button5 to Button31 just in case Novint releases new grips one day.
The Falcon can measure the 3D position of the grip, which will be in these values:
Falcon.x (How far to the right the grip is)

Falcon.y (How far up the grip is)

Falcon.z (How far towards the body of the falcon the grip is)
They are all measured in metres by default. But GlovePIE supports units, so you can use whatever units you want, like this:
Key.D = Falcon.X > 1 inch

Key.A = Falcon.X < -1 inch

Key.W = Falcon.Z > 3 cm

Key.S = Falcon.Z < -3 cm

The range of the Falcon is small, it goes from -2 inches to +2 inches in each direction.
You can also read the position as a vector, with falcon.pos.
Warning! Danger! The Falcon also allows you to set forces. This means that the falcon can push your hand in any direction. It also means it can injure you, break things, or whatever else a robot arm can do. Even if your script is perfect, GlovePIE is not, it has bugs, so there is a chance that the grip may move about in unexpected ways. So hold it carefully and in such a way that it won’t injure you if it moves suddenly. And start by using only small forces in your script, then make them bigger.
You can set the forces in the 3 directions like this:
Falcon.ForceX, Falcon.ForceY, Falcon.ForceZ
The force is in Newtons by default. The force of Gravity is -9.8 Newtons per kilogram. That means that when you hold something that weighs 100 grams in your hand, it will push down on your hand with a force of 1 Newton.

But you can also use units of weight to specify the force, and GlovePIE will convert them. For example:

Falcon.ForceY = -0.5 pounds
That will make the grip feel half a pound heavier.
The maximum force is about 2 pounds, 1 kilogram, or 10 Newtons.
Here is an example of how to make a force at a certain point:
If falcon.x < -1 inch then

falcon.ForceX = 2 newtons


falcon.ForceX = 0

end if
That makes the falcon push you back if you try to move too far to the left.
You can also set the force as a vector with Falcon.Force
Falcon.exists will be true when the falcon (and driver) exists, and false when it doesn’t.
Falcon.homed will be true when the falcon has been homed, and false when it hasn’t.
See for discussion on using the Novint Falcon.

NEW! 3DConnexion SpaceNavigator, etc.

GlovePIE now supports 3DConnexion 6DOF input devices like the SpaceNavigator, SpaceTraveler, SpaceExplorer, and SpacePilot. These are the modern descendents of the original SpaceBall which you might have heard of many years ago.

GlovePIE calls them all “SpaceBall”.
The “SpaceBall” provides 3 position values, and three rotation values:
SpaceBall.x, SpaceBall.y, and SpaceBall.z.
X is how far you are pushing to the right

Y is how far you are pulling up

Z is how far you are pushing forwards (away from your body)
SpaceBall.yaw, SpaceBall.pitch, and SpaceBall.roll
Yaw is how far you are twisting it to the right

Pitch is how far you are tilting it upwards

Roll is how far you are tilting it to the right
The spaceball can only move a limited amount in each direction.
The units for x, y, z, yaw, pitch and roll are the same. But they depend on the settings in the control panel. 3DConnexion does that deliberately so that users can choose the speed and sensitivity they want outside the applications. So the maximum value could be 80 or it could be more than a thousand, depending on control panel settings.
It is not recommended to require the full use of the spaceball’s range. Most of the time users will only use about 75% of the range.
Most people will only have a SpaceNavigator. It has two buttons. But the user can choose what those two buttons are in Control Panel. You need to know what those buttons are set to, if you want to use them in GlovePIE.
For example if the left button is set to be the “Fit” button in control panel, then you need to read it like this in GlovePIE:
Enter = SpaceBall.Fit
In control panel, the buttons can be set to either “Fit”, “ApplicationPanel”, or “Button1”… “Button29”.
If you have a SpaceExplorer or SpacePilot, then there will be more than two buttons and they might have fixed functions.
You can detect what kind of spaceball it is, by reading SpaceBall.Type.

You can also detect whether the SpaceBall exists by reading SpaceBall.exists.

If you want the angles in some other form besides Yaw, Pitch, and Roll, then you can use AxisAngle or a rotation matrix. For the rotation matrix, just use SpaceBall.RotMat. For AxisAngle just use SpaceBall.Axis to get the axis vector that the rotation is rotating around, and use SpaceBall.AxisAngle to get the angle of rotation around that axis.

Share with your friends:
1   ...   22   23   24   25   26   27   28   29   30

The database is protected by copyright © 2019
send message

    Main page