Introduction to WTK Sensors

 

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

 

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 WTK’s 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: