OpenTracker

An Open Architecture for Reconfigurable Tracking based on XML | Contact

ot::FastTrakModule Class Reference
[Device Input Classes]

developer level information and implementation specifics here More...

#include <FastTrakModule.h>

Inheritance diagram for ot::FastTrakModule:

Inheritance graph
[legend]
Collaboration diagram for ot::FastTrakModule:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FastTrakModule ()
virtual ~FastTrakModule ()
virtual void init (StringTable &attributes, ConfigNode *localTree)
virtual NodecreateNode (const std::string &name, StringTable &attributes)
virtual void start ()
virtual void close ()
virtual void pushEvent ()

Protected Member Functions

virtual void run ()
int initFastTrak ()
int parseRecordFT (char c, char *b)
int parseRecordIT (char c, char *b)
void setButtonIT (int stationNr, int button)
void convert (int stationNr, char *b)

Protected Attributes

int stop
tmpStationEventstations
NodeVector nodes
int trackerType
SerialPort port
int numberOfStations
std::string hemisphere
std::string referenceFrame
std::string initString

Detailed Description

developer level information and implementation specifics here

Author:
Rainer Splechtna

Definition at line 101 of file FastTrakModule.h.


Constructor & Destructor Documentation

ot::FastTrakModule::FastTrakModule (  ) 

constructor method.

Definition at line 71 of file FastTrakModule.cxx.

ot::FastTrakModule::~FastTrakModule (  )  [virtual]

Destructor method, clears nodes member.

Definition at line 76 of file FastTrakModule.cxx.

References nodes, and stations.


Member Function Documentation

void ot::FastTrakModule::close (  )  [virtual]

void ot::FastTrakModule::convert ( int  stationNr,
char *  b 
) [protected]

converts data record to OpenTracker event values and updates the event of the specified station.

Parameters:
stationNr number of station the data record is associated with
b pointer to array of characters, representing a whole data record

Definition at line 629 of file FastTrakModule.cxx.

References ot::buildPositionFT(), ot::buildPositionIT(), ot::buildQuaternionFT(), ot::buildQuaternionIT(), ot::FASTTRAK, ot::ISOTRAK, ot::tmpStationEvent::newVal, stations, and trackerType.

Referenced by run().

Node * ot::FastTrakModule::createNode ( const std::string &  name,
StringTable attributes 
) [virtual]

This method is called to construct a new Node.

It compares name to the FastTrakSource element name, and if it matches creates a new FastTrakSource node.

Parameters:
name reference to string containing element name refenrence to StringTable containing attribute values
Returns:
pointer to new Node or NULL. The new Node must be allocated with new !

Implements ot::NodeFactory.

Definition at line 123 of file FastTrakModule.cxx.

References ot::StringTable::get(), nodes, and numberOfStations.

void ot::FastTrakModule::init ( StringTable attributes,
ConfigNode localTree 
) [virtual]

initializes the tracker module.

Parameters:
attributes StringTable of elements attribute values.
localTree pointer to root of configuration nodes tree

Reimplemented from ot::Module.

Definition at line 84 of file FastTrakModule.cxx.

References ot::FASTTRAK, ot::StringTable::get(), hemisphere, ot::Module::init(), initString, ot::ISOTRAK, LOG_ACE_ERROR(), LOG_ACE_INFO(), numberOfStations, SerialPort::pathname, port, referenceFrame, stations, and trackerType.

int ot::FastTrakModule::initFastTrak (  )  [protected]

inits the whole fasttrak according to the parameters stored in the module.

It can be used to reset the flock after some communication failure.

Returns:
0 if everything is ok, otherwise < 0

Definition at line 176 of file FastTrakModule.cxx.

References ot::FASTTRAK, hemisphere, initString, ot::ISOTRAK, numberOfStations, port, readfromSerialPort(), referenceFrame, ot::OSUtils::sleep(), trackerType, and writetoSerialPort().

Referenced by run().

int ot::FastTrakModule::parseRecordFT ( char  c,
char *  b 
) [protected]

parses the input stream from the FastTrak tracker

Parameters:
c new charcter read from input stream
b pointer to char array, where the actual data record of a station of the tracker is stored
Returns:
-1 if reading of one data record is not completed -2 if too much junk was read 0,1 number of station for which a whole data record was read

number of bytes of the tracker's output record

Definition at line 386 of file FastTrakModule.cxx.

References numberOfStations, ot::tsGetRec, ot::tsSpace, ot::tsStart, ot::tsStationNumber, and ot::tsSyncBit.

Referenced by run().

int ot::FastTrakModule::parseRecordIT ( char  c,
char *  b 
) [protected]

parses the input stream from the IsoTrak II tracker

Parameters:
c new charcter read from input stream
b pointer to char array, where the actual data record of a station of the tracker is stored
Returns:
-1 if reading of one data record is not completed -2 if too much junk was read 0,1 number of station for which a whole data record was read

Definition at line 455 of file FastTrakModule.cxx.

References numberOfStations, setButtonIT(), ot::tsGetRec, ot::tsSpace, ot::tsStart, and ot::tsStationNumber.

Referenced by run().

void ot::FastTrakModule::pushEvent (  )  [virtual]

pushes events into the tracker tree.

Checks all stations for new data and fires the FastTrakSources, if new data is present.

Reimplemented from ot::Module.

Definition at line 354 of file FastTrakModule.cxx.

References ot::tmpStationEvent::event, ot::FastTrakSource::event, ot::Module::isInitialized(), ot::ThreadModule::lock(), ot::tmpStationEvent::newVal, nodes, ot::FastTrakSource::station, stations, ot::Event::timeStamp(), ot::ThreadModule::unlock(), and ot::Node::updateObservers().

void ot::FastTrakModule::run (  )  [protected, virtual]

this method is the code executed in its own thread, it reads from the specified serial port, parses the incoming data and updates the event of the utilized stations

Reimplemented from ot::ThreadModule.

Definition at line 284 of file FastTrakModule.cxx.

References convert(), ot::FASTTRAK, initFastTrak(), ot::ISOTRAK, ot::ThreadModule::lock(), parseRecordFT(), parseRecordIT(), port, readfromSerialPort(), ot::OSUtils::sleep(), ot::Module::stop(), trackerType, and ot::ThreadModule::unlock().

void ot::FastTrakModule::setButtonIT ( int  stationNr,
int  button 
) [protected]

updates button event for specified station (only used for IsoTrak II)

Parameters:
stationNr number of station the button is associated with
button event of button

Definition at line 616 of file FastTrakModule.cxx.

References ot::tmpStationEvent::event, ot::Event::getButton(), ot::ThreadModule::lock(), ot::tmpStationEvent::newVal, stations, and ot::ThreadModule::unlock().

Referenced by parseRecordIT().

void ot::FastTrakModule::start (  )  [virtual]

This method is called after initialisation is finished and before the main loop is started.

In this implementation it starts the thread. Be sure to call this method from your subclasses start method to start the thread !

Reimplemented from ot::ThreadModule.

Definition at line 149 of file FastTrakModule.cxx.

References SerialParams::baudrate, SerialParams::bits, SerialParams::blocking, SerialParams::hwflow, ot::Module::initialized, initSerialParams(), ot::Module::isInitialized(), openSerialPort(), SerialParams::parity, SerialPort::pathname, SerialParams::pathname, port, SerialParams::sbit, ot::ThreadModule::start(), and SerialParams::swflow.


Member Data Documentation

std::string ot::FastTrakModule::hemisphere [protected]

the hemisphere the tracker should operate in ("1,0,0")

Definition at line 121 of file FastTrakModule.h.

Referenced by init(), and initFastTrak().

std::string ot::FastTrakModule::initString [protected]

other global config strings sent to the tracker during init-phase

Definition at line 125 of file FastTrakModule.h.

Referenced by init(), and initFastTrak().

vector of all created fasttrak source nodes

Definition at line 112 of file FastTrakModule.h.

Referenced by createNode(), pushEvent(), and ~FastTrakModule().

number of stations (sensors) connected to the tracker

Definition at line 119 of file FastTrakModule.h.

Referenced by createNode(), init(), initFastTrak(), parseRecordFT(), and parseRecordIT().

port structure for the serial port data

Definition at line 117 of file FastTrakModule.h.

Referenced by close(), init(), initFastTrak(), run(), and start().

std::string ot::FastTrakModule::referenceFrame [protected]

the reference frame of the tracker ("0,0,0,200,0,0,0,200,0")

Definition at line 123 of file FastTrakModule.h.

Referenced by init(), and initFastTrak().

pointer to array of tmpStationEvent storing the event of each station

Definition at line 110 of file FastTrakModule.h.

Referenced by convert(), init(), pushEvent(), setButtonIT(), and ~FastTrakModule().

int ot::FastTrakModule::stop [protected]

flag to stop the thread

Definition at line 107 of file FastTrakModule.h.

stores which tracker

Definition at line 115 of file FastTrakModule.h.

Referenced by convert(), init(), initFastTrak(), and run().


The documentation for this class was generated from the following files:

copyright (c) 2006 Graz University of Technology