Robotcode  1.0
MyTrial Class Reference

This is the core class that determines most of the behavior of the experiment. More...

#include <linepush5.h>

Inheritance diagram for MyTrial:
Trial

List of all members.

Public Member Functions

 MyTrial ()
virtual void read (istream &in)
 Trial input from Target file.
virtual void writeHeader (ostream &out)
 Write Header of data file.
virtual void writeDat (ostream &out)
 Write Trial output to data file.
virtual void writeMov (ostream &out)
 Write movement data (Data Records) to movfile.
virtual void updateGraphics (int i)
 Graphics routine: called with ~60 Hz.
virtual void updateTextDisplay ()
 Update Text display: called here with 10Hz.
virtual void updateHaptics ()
 Haptics routine: called with 1000 Hz.
virtual void control ()
 Control routine: called at 200 Hz.
virtual void start ()
 Start the trial: just kicks it off.
virtual void end ()
 response to a request to end trial (q-key press)
virtual bool isFinished ()
 Trial ended? Yes if in state ENDTRIAL.

Public Attributes

TrialState state
 State of the trial.
int hand
 Moving hand 0: left 1:right.
int trialtype
 Target type 1:point target 2: redundant (line)
int dynamic
 Dynamic enviroment 0: free movement 1: passively guided movement 2: clamp 3: force field.
int feedback
 Visual feedback 0: None 1: Verdidical cursor 2: line 3:both.
double angle
 Angle at which the channel is presented.
Matrix2D rotMatrix
 Rotation matrix for above angle.
double forcefield
 Strength of force field if dynamic = 1.
double RT
 Reaction time.
double MT
 Movement time.
Vector2D endpoint
 Endpoint of movement.
Vector2D error
 Final movement error.
double endAng
 Response angle.
double maxSpeed
 Maximal speed.
int points
 Number of points obtained.
double currentgAng
 Current estimate angle.
DataManager< DataRecord, 1500 > dataman
 DataManager.

Detailed Description

This is the core class that determines most of the behavior of the experiment.

There class contains a number of call back routines that need to be provided.


Constructor & Destructor Documentation

MyTrial::MyTrial ( )

Trial constructor sets the variables of the trial to zero and brings the state into WAIT_TRIAL. The Trial is started when run is entered.

See also:
Block::control

Member Function Documentation

void MyTrial::read ( istream &  input) [virtual]

Trial input from Target file.

This routine reads in one single line from the target file and assigns the values to the right variables in the trial class

Parameters:
inputinputstream linked to the target file
See also:
Block::init

Implements Trial.

void MyTrial::writeHeader ( ostream &  output) [virtual]

Write Header of data file.

This routine writes the string headers to the Dat file. These variable names are only written in BLock number 1. This is handy as a mnemontic and causes the variables to have the right name when you load them into matlab with dload.m

Parameters:
outputoutputstream linked to the dat file
See also:
Block::save

Implements Trial.

void MyTrial::writeDat ( ostream &  output) [virtual]

Write Trial output to data file.

This routine saves the results from a trial to the dat file (1 single line) We first write all the information from the target file and then after this all the measured variables

Parameters:
outputoutputstream linked to the dat file
See also:
Block::save

Implements Trial.

void MyTrial::writeMov ( ostream &  out) [virtual]

Write movement data (Data Records) to movfile.

This determines what is done when a trial needs to be written to the mov file. Usually, we call just the DataManager.

Parameters:
outstream linked to the mov-file

Implements Trial.

void MyTrial::updateGraphics ( int  eye) [virtual]

Graphics routine: called with ~60 Hz.

This is the Graphics update routine for your experiment. All drawing to the Screen should be done here

Parameters:
eyeleft or right eye for dual 3D displays

Implements Trial.

void MyTrial::updateTextDisplay ( ) [virtual]

Update Text display: called here with 10Hz.

This routine updates the Text display. All drawing to the Text Display should be performed here

Reimplemented from Trial.

void MyTrial::updateHaptics ( ) [virtual]

Haptics routine: called with 1000 Hz.

This routine is called from the Interrupt loop with UPDATERATE (usually 1000Hz or 200Hz). Here you update all your devices and later make sure that control and record are called with the right frequency. IMPORTANT: This function is Time-critical. So never try to save data, draw something on the screen, etc here. If you do the UPDATERATE will drop immediately.

See also:
control() record()

Implements Trial.

void MyTrial::control ( ) [virtual]

Control routine: called at 200 Hz.

This is the core routine that determines the behavior of a single Trial. The trial advances through a sequences of states, from beginning to the end of the trial. Block switches the state automatically START_TRIAL when the trial is set off and advances automatically to the next trial, when the state END_TRIAL is reached. The program returns with CONTROLRATE to this function, but needs to do other stuff inbetween. So to change something from one iteration to the next, you need to modify variables in the Trial Object or global variables.

See also:
Block::control()

Implements Trial.

void MyTrial::end ( ) [virtual]

response to a request to end trial (q-key press)

This routine is called when the Experiment presses "q" to interrupt the Block prematurely. Thus, here you need to stop recording and clean up anything else, for example setting the forces of the robot to zero.

Implements Trial.


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