Robotcode
1.0
|
This is the core class that determines most of the behavior of the experiment. More...
#include <linepush5.h>
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. |
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.
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.
void MyTrial::read | ( | istream & | input | ) | [virtual] |
This routine reads in one single line from the target file and assigns the values to the right variables in the trial class
input | inputstream linked to the target file |
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
output | outputstream linked to the dat file |
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
output | outputstream linked to the dat file |
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.
out | stream linked to the mov-file |
Implements Trial.
void MyTrial::updateGraphics | ( | int | eye | ) | [virtual] |
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.
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.
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.