Introduction to WTK
Sensors
- In WTK sensor objects generate position, orientation, and
other types of data by reading inputs which originate in
the real world. These inputs can be used to control the
motion and other behavioral aspects of objects in the
simulation. Using sensors and motionlinks the user can be
directly coupled the viewpoints, graphical objects, and
lights in the universe.
- WTK supports may of the 2d, 3d, and 6d
(position/orientation) sensors on the market today. Some
sensors return relative values (displacement or deltas)
while other sensors return absolute position/and
orientation values. Regardless of what WTK receives from
the sensor it works with relative coordinates or
displacements for the last position/orientation.
- WTK supports the follow sensors:
- Standard mouse
- Spaceball
- Spaceball Space Controller
- Geoball
- Isotrak, IsotrakII, Fastrak, and Insidetrak
- Bird, Extended range bird, and flock of birds
- Logitech 3d mouse (red baron)
- CrystalEyes and CrystalEyesVR
- Fakespace BOOM
- Magellan
- Wayfinder
- Virtual i-o head tracker
- Thrustmaster serial FCS and WCS (serial
joysticks)
- Thrustmaster T2 steering wheel
- CyberMaxx 2 head tracker
- 5DT glove
- Pinch glove
- Cyberglove (SGI only)
- WTK also provides the ability to write your own sensor
drivers that can be used with custom sensor devices or to
alter the sensor drivers provided by Sense8
Sensor Construction and Destruction
WTK provides easy to use MACROS to allow the user to create
sensor objects. These sensor objects are then stored in pointer
to a WTsensor structure. Each sensor type supported by WTK has
its own MACRO it construct the sensor. The following chart lists
the sensor construction MACROS and the corresponding sensor they
construct.
MACRO |
SENSOR |
WTmouse_new |
Standard mouse |
WTspaceball_new |
Spaceball |
WTspaceballSC_new |
Spaceball Space Controller |
WTgeoball_new |
Geoball |
WTpolhemus_new |
Isotrak and IsotrakII with a single
sensor |
WTisotrak2_new |
IsotrakII with 2 sensors |
WTfastrak_new |
Fastrak |
WTinsidetrak_new |
Insidetrak |
WTbird_new |
Bird |
WTbirdERC_new |
Extended range bird |
WTredbaron_new |
Logitech 3d mouse |
WTboom_new |
Fakespace BOOM |
WTspacecontrol_new |
Magellan |
WTpercision_new |
Wayfinder |
WTiglasses_new |
virtual-o iglasses tracker |
WTjoyserial_new |
Thrustmaster FCS and WCS |
WTformula_new |
Thrustmaster Formula T2 steering wheel |
WTcybermaxx2_new |
Cybermaxx2 head tracker |
WTglove5dt_new |
5DT glove |
WTpinch_new |
pinch glove |
WTcyberglove_new |
Cyberglove |
WTmouse_new
Creates a new sensor object with the mouse and adds it to
the universe
SYNTAX:
WTsensor *WTmouse_new(void);
ARGUMENTS:
none
RETURN TYPE:
A pointer to a type WTsensor that hold the mouse
object
WTiglasses_new
Creates a new sensor object with the virtual i-o iglasses
head-tracker and adds it to the universe.
SYNTAX:
WTsensor *WTiglasses_new(unsigned char port);
ARGUMENTS:
port -- The serial port the sensor is attached
to can be COM1, COM2, COM3, or COM4
RETURN TYPE:
A pointer to a WTsensor that contains the iglasses
tracker
Understanding how a sensor driver works
- WTK sensor drivers are written to allow the user to
access information such as absolute coordinates and
button presses for sensors depending on the sensor. WTK
also provides the user with the ability to change how the
data read from the sensor is interpreted by allowing the
user to create their own update functions. To understand
this we must first understand how a sensor driver works
- Sensor drivers written of WTK consist of three major
functions, an "open" function, close function
and update function.
Sensor open functions
Open functions open communication with the sensor and are
called only once when the sensor is constructed with a call to
one of the sensor MACROS. The generally ready the sensor for
communication and obtain the first record from the sensor. If the
sensor returns data as absolute positions and orientations then
this record is stored for later use to create a relative record.
Sensor close functions
Close function break communication with the sensor and reset
any system parameters that may have been changed. They are called
only once when either the sensor object is destroyed or when the
universe exits
Sensor update functions
These functions are the work horses of the sensor drivers.
They are called once each time through the simulation loop for
each sensor that is in the universe. The obtain a record form the
sensor, weather it be position/orientation record or button
presses. If the record is in absolute position/orientations the
record is "reletivized" in this function and the set so
that WTKs simulation manager can use the values to update
any viewpoints, objects, or lights that might be attached to the
sensor via motionlinks.
A sensors update function can be set by the user with a call
to WTsensor_setupdatfn. This will tell WTK to use the function
passed in to update the sensor passed in.
Assignment 11
project definition:
- Creates a universe with a bordered window in monoscopic
mode..
- Create a cylinder that has a height of 40, a radius of 5,
12 tessellation lines, is single sided and gouraud
shaded.
- Create a sphere with a radius of 10, 12 lat and long
divisions, is single sided, and gouraud shaded.
- Create a movable geometry node for the cylinder whose
parent is the root node.
- Create a movable geometry nodes for the sphere whose
parent is the root node.
- Create and instance of the movable node containing the
sphere as the 2nd child of the root node
- Set the translation of the movable geometry containing
the first sphere to (0,-20,0)
- Set the translation of the movable geometry containing
the second sphere to (0,20,0)
- Set the rgb color of the sphere to red (255,0,0)
- Set the rgb color of the cylinder to blue (0,0,255)
- Set the rendering style of the sphere geometry to
wireframe.
- Prebuild all the geometries
- Zooms the view in the window
- Create a task function that is associated with the node
containing the cylinder. The function should rotate the
cylinder in its parent reference frame around the Y axis
by 15 degrees each time through the simulation loop.
- Add the mouse to the universe as a sensor
- Create an action function that allows the user to:
- press q to quit
- press p to print the scene graph from the root
node. (use WTnode print)
- press i to obtain the extents, midpoint, and
radius of each node
- press I to obtain the extents, midpoint, and
radius of each geometry.
- Press t to translate the spheres and cylinder
along their local X axis.
- Create a function that uses the WTnode_translate function
and takes as an argument the node to translate, three
floating point values for the translation values, and the
frame in which to translate.