Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00023 #ifndef Cortex_H
00024 #define Cortex_H
00025
00026 #include <stdint.h>
00027
00028
00031 typedef enum maReturnCode
00032 {
00033 RC_Okay=0,
00034 RC_GeneralError,
00035 RC_ApiError,
00036 RC_NetworkError,
00037 RC_TimeOut,
00038 RC_MemoryError,
00039 RC_Unrecognized
00040 }
00041 maReturnCode;
00042
00043
00046 typedef enum maVerbosityLevel
00047 {
00048 VL_None=0,
00049 VL_Error,
00050 VL_Warning,
00051 VL_Info,
00052 VL_Debug,
00053 }
00054 maVerbosityLevel;
00055
00056
00057
00058
00059 #define MAX_N_BODIES 100
00060
00061
00062 #define XEMPTY 9999999.0f
00063
00064
00067 typedef double tSegmentData[7];
00068
00071 typedef float tMarkerData[3];
00072
00075 typedef float tForceData[7];
00076
00079 typedef double tDofData;
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00096
00099 typedef struct sHostInfo
00100 {
00101 int bFoundHost;
00102 int LatestConfirmationTime;
00103 char szHostMachineName[128];
00104 unsigned char HostMachineAddress[4];
00105 char szHostProgramName[128];
00106 unsigned char HostProgramVersion[4];
00107
00108 } sHostInfo;
00109
00110
00111
00112
00114
00117 typedef struct sHierarchy
00118 {
00119 int32_t nSegments;
00120 char** szSegmentNames;
00121 int32_t* iParents;
00122
00123 } sHierarchy;
00124
00125
00126
00127
00129
00132 typedef struct sBodyDef
00133 {
00134 char* szName;
00135
00136 int nMarkers;
00137 char** szMarkerNames;
00138
00139 sHierarchy Hierarchy;
00140
00141 int nDofs;
00142 char** szDofNames;
00143
00144 } sBodyDef;
00145
00146
00147
00148
00150
00154 typedef struct sBodyDefs
00155 {
00156 int nBodyDefs;
00157 sBodyDef BodyDefs[MAX_N_BODIES];
00158
00159 int nAnalogChannels;
00160 char** szAnalogChannelNames;
00161
00162 int nForcePlates;
00163
00164 void* AllocatedSpace;
00165
00166 } sBodyDefs;
00167
00168
00169
00170
00172
00175 typedef struct sBodyData
00176 {
00177 char szName[128];
00178
00179 int nMarkers;
00180 tMarkerData* Markers;
00181 float fAvgMarkerResidual;
00182
00183 int nSegments;
00184 tSegmentData* Segments;
00185
00186 int nDofs;
00187 tDofData* Dofs;
00188 float fAvgDofResidual;
00189 int nIterations;
00190
00191 int32_t ZoomEncoderValue;
00192 int32_t FocusEncoderValue;
00193
00194 } sBodyData;
00195
00196
00197
00198
00200
00203 typedef struct sAnalogData
00204 {
00205 int nAnalogChannels;
00206 int nAnalogSamples;
00207 int16_t* AnalogSamples;
00208
00209 int nForcePlates;
00210 int nForceSamples;
00211 tForceData* Forces;
00212
00213 int nAngleEncoders;
00214 int nAngleEncoderSamples;
00215 double* AngleEncoderSamples;
00216
00217 } sAnalogData;
00218
00219
00220
00221
00223 typedef struct sRecordingStatus
00224 {
00225 int32_t bRecording;
00226 int32_t iFirstFrame;
00227 int32_t iLastFrame;
00228 char szFilename[256];
00229
00230 } sRecordingStatus;
00231
00232
00233
00234
00236
00242 typedef struct sFrameOfData
00243 {
00244 int32_t iFrame;
00245 float fDelay;
00246
00247 int nBodies;
00248 sBodyData BodyData[MAX_N_BODIES];
00249
00250 int nUnidentifiedMarkers;
00251 tMarkerData* UnidentifiedMarkers;
00252
00253 sAnalogData AnalogData;
00254
00255 sRecordingStatus RecordingStatus;
00256
00257 } sFrameOfData;
00258
00259
00260
00261 #ifdef __cplusplus
00262 extern "C" {
00263 #endif
00264
00265
00266
00267
00274 int Cortex_GetSdkVersion(unsigned char Version[4]);
00275
00276
00277
00286 int Cortex_SetVerbosityLevel(int iLevel);
00287
00288
00289
00302 int Cortex_SetErrorMsgHandlerFunc(void (*MyFunction)(int iLogLevel, const char* szLogMessage, void *params), void *params);
00303
00305 int Cortex_SetRequestPort(unsigned short port);
00306 int Cortex_SetMulticastPort(unsigned short port);
00307
00308
00309
00325 int Cortex_SetDataHandlerFunc(void (*MyFunction)(sFrameOfData* pFrameOfData, void *params), void *params);
00326
00327
00328
00340 int Cortex_Initialize(const char* szCortexNicCardAddress);
00341
00342
00343
00354 int Cortex_GetHostInfo(sHostInfo *pHostInfo);
00355
00356
00357
00362 int Cortex_Exit();
00363
00364
00365
00385
00386 int Cortex_Request(const char* szCommand, void** ppResponse, int *pnBytes, double timeout);
00387
00388
00389
00397
00398 sBodyDefs* Cortex_GetBodyDefs(double timeout);
00399
00400
00401
00410 int Cortex_FreeBodyDefs(sBodyDefs* pBodyDefs);
00411
00412
00413
00424
00425 sFrameOfData* Cortex_GetCurrentFrame(double timeout);
00426
00427
00439 int Cortex_CopyFrame(const sFrameOfData* pSrc, sFrameOfData* pDst);
00440
00441
00442
00456 int Cortex_FreeFrame(sFrameOfData* pFrame);
00457
00458
00459
00476 int Cortex_SendHtr(sHierarchy *pHierarchy, tSegmentData *pFrame);
00477
00478 int Cortex_SetMetered(bool bActive, float fFixedLatency);
00479
00480
00481
00482
00483
00484 #define ZYX_ORDER 1
00485 #define XYZ_ORDER 2
00486 #define YXZ_ORDER 3
00487 #define YZX_ORDER 4
00488 #define ZXY_ORDER 5
00489 #define XZY_ORDER 6
00490
00491
00492 #define XYX_ORDER 7
00493 #define XZX_ORDER 8
00494 #define YZY_ORDER 9
00495 #define YXY_ORDER 10
00496 #define ZXZ_ORDER 11
00497 #define ZYZ_ORDER 12
00498
00499
00500
00501
00522 void Cortex_ConstructRotationMatrix(
00523 double angles[3],
00524 int iRotationOrder,
00525 double matrix[3][3]);
00526
00527
00528
00549 void Cortex_ExtractEulerAngles(
00550 double matrix[3][3],
00551 int iRotationOrder,
00552 double angles[3]);
00553
00554
00555
00556 #ifdef __cplusplus
00557 }
00558 #endif
00559
00560 #endif