Classes | Defines | Typedefs | Enumerations | Functions
cortex.h File Reference
#include <stdint.h>
Include dependency graph for cortex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  sAnalogData
 All the analog data for one frame's worth of time. More...
struct  sBodyData
 A structure containing ALL the data to drive one markerset. More...
struct  sBodyDef
 The description of a single tracking object that will have streaming data. More...
struct  sBodyDefs
 The description of all the data that will stream from Cortex. More...
struct  sFrameOfData
 ALL the data for one frame streamed from Cortex. More...
struct  sHierarchy
 The rudimentary description of a skeleton's bones and hierarchy. More...
struct  sHostInfo
 The description of the connection to Cortex. More...
struct  sRecordingStatus
 The recording status tells us the frame numbers and capture filename. More...

Defines

#define MAX_N_BODIES   100
#define XEMPTY   9999999.0f
#define XYX_ORDER   7
#define XYZ_ORDER   2
#define XZX_ORDER   8
#define XZY_ORDER   6
#define YXY_ORDER   10
#define YXZ_ORDER   3
#define YZX_ORDER   4
#define YZY_ORDER   9
#define ZXY_ORDER   5
#define ZXZ_ORDER   11
#define ZYX_ORDER   1
#define ZYZ_ORDER   12

Typedefs

typedef enum maReturnCode maReturnCode
typedef enum maVerbosityLevel maVerbosityLevel
typedef struct sAnalogData sAnalogData
 All the analog data for one frame's worth of time.
typedef struct sBodyData sBodyData
 A structure containing ALL the data to drive one markerset.
typedef struct sBodyDef sBodyDef
 The description of a single tracking object that will have streaming data.
typedef struct sBodyDefs sBodyDefs
 The description of all the data that will stream from Cortex.
typedef struct sFrameOfData sFrameOfData
 ALL the data for one frame streamed from Cortex.
typedef struct sHierarchy sHierarchy
 The rudimentary description of a skeleton's bones and hierarchy.
typedef struct sHostInfo sHostInfo
 The description of the connection to Cortex.
typedef struct sRecordingStatus sRecordingStatus
 The recording status tells us the frame numbers and capture filename.
typedef double tDofData
 Usually an angle value in degrees.
typedef float tForceData [7]
 X,Y,Z, fX,fY,fZ, mZ.
typedef float tMarkerData [3]
 X,Y,Z.
typedef double tSegmentData [7]
 X,Y,Z, aX,aY,aZ, Length.

Enumerations

enum  maReturnCode {
  RC_Okay = 0, RC_GeneralError, RC_ApiError, RC_NetworkError,
  RC_TimeOut, RC_MemoryError, RC_Unrecognized
}
enum  maVerbosityLevel {
  VL_None = 0, VL_Error, VL_Warning, VL_Info,
  VL_Debug
}

Functions

void Cortex_ConstructRotationMatrix (double angles[3], int iRotationOrder, double matrix[3][3])
int Cortex_CopyFrame (const sFrameOfData *pSrc, sFrameOfData *pDst)
int Cortex_Exit ()
void Cortex_ExtractEulerAngles (double matrix[3][3], int iRotationOrder, double angles[3])
int Cortex_FreeBodyDefs (sBodyDefs *pBodyDefs)
int Cortex_FreeFrame (sFrameOfData *pFrame)
sBodyDefsCortex_GetBodyDefs (double timeout)
sFrameOfDataCortex_GetCurrentFrame (double timeout)
int Cortex_GetHostInfo (sHostInfo *pHostInfo)
int Cortex_GetSdkVersion (unsigned char Version[4])
int Cortex_Initialize (const char *szCortexNicCardAddress)
int Cortex_Request (const char *szCommand, void **ppResponse, int *pnBytes, double timeout)
int Cortex_SendHtr (sHierarchy *pHierarchy, tSegmentData *pFrame)
int Cortex_SetDataHandlerFunc (void(*MyFunction)(sFrameOfData *pFrameOfData, void *params), void *params)
int Cortex_SetErrorMsgHandlerFunc (void(*MyFunction)(int iLogLevel, const char *szLogMessage, void *params), void *params)
int Cortex_SetMetered (bool bActive, float fFixedLatency)
int Cortex_SetMulticastPort (unsigned short port)
int Cortex_SetRequestPort (unsigned short port)
 configures Cortex ports
int Cortex_SetVerbosityLevel (int iLevel)

Define Documentation

#define MAX_N_BODIES   100

Definition at line 59 of file cortex.h.

#define XEMPTY   9999999.0f

Definition at line 62 of file cortex.h.

#define XYX_ORDER   7

Definition at line 492 of file cortex.h.

#define XYZ_ORDER   2

Definition at line 485 of file cortex.h.

#define XZX_ORDER   8

Definition at line 493 of file cortex.h.

#define XZY_ORDER   6

Definition at line 489 of file cortex.h.

#define YXY_ORDER   10

Definition at line 495 of file cortex.h.

#define YXZ_ORDER   3

Definition at line 486 of file cortex.h.

#define YZX_ORDER   4

Definition at line 487 of file cortex.h.

#define YZY_ORDER   9

Definition at line 494 of file cortex.h.

#define ZXY_ORDER   5

Definition at line 488 of file cortex.h.

#define ZXZ_ORDER   11

Definition at line 496 of file cortex.h.

#define ZYX_ORDER   1

Definition at line 484 of file cortex.h.

#define ZYZ_ORDER   12

Definition at line 497 of file cortex.h.


Typedef Documentation

typedef enum maReturnCode maReturnCode

Return codes

Verbosity setting for internal messages

typedef struct sAnalogData sAnalogData

All the analog data for one frame's worth of time.

This includes the raw analog samples, processed forces, and also angle encoder values (if available).

typedef struct sBodyData sBodyData

A structure containing ALL the data to drive one markerset.

This contains the markerset's name, the marker positions, the segment positions relative to each segment's parent, and the DOFs.

typedef struct sBodyDef sBodyDef

The description of a single tracking object that will have streaming data.

This description includes the object's name, the marker names, the skeleton hierarchy, and the DOF names.

typedef struct sBodyDefs sBodyDefs

The description of all the data that will stream from Cortex.

This description includes all the body descriptions, the analog channels, and the number of forceplates.

typedef struct sFrameOfData sFrameOfData

ALL the data for one frame streamed from Cortex.

This include the two items that describe the frame. The first is the frame number. The second is the time delay measuring the delay between the real world action and the host sending this frame. The actual data for the frame includes the data for each body, the unidentified markers, and data that is associated with the analog captures.

typedef struct sHierarchy sHierarchy

The rudimentary description of a skeleton's bones and hierarchy.

This description is defined by szSegmentNames[iSegment], and iParent[iSegment]

typedef struct sHostInfo sHostInfo

The description of the connection to Cortex.

This contains information about the host machine, the host program, and the connection status.

The recording status tells us the frame numbers and capture filename.

typedef double tDofData

Usually an angle value in degrees.

Data for one degree of freedom

Definition at line 79 of file cortex.h.

typedef float tForceData[7]

X,Y,Z, fX,fY,fZ, mZ.

Data for one forceplate

Definition at line 75 of file cortex.h.

typedef float tMarkerData[3]

X,Y,Z.

Data for one marker

Definition at line 71 of file cortex.h.

typedef double tSegmentData[7]

X,Y,Z, aX,aY,aZ, Length.

Data for one segment

Definition at line 67 of file cortex.h.


Enumeration Type Documentation

Return codes

Enumerator:
RC_Okay 

Okay.

RC_GeneralError 

General Error.

RC_ApiError 

Invalid use of the API.

RC_NetworkError 

Network Error.

RC_TimeOut 

No response from Cortex.

RC_MemoryError 

Memory allocation failed.

RC_Unrecognized 

Request string not recognized.

Definition at line 31 of file cortex.h.

Verbosity setting for internal messages

Enumerator:
VL_None 

No Messages.

VL_Error 

Error Message.

VL_Warning 

Warning Message [DEFAULT VALUE].

VL_Info 

Informational Message.

VL_Debug 

Debug Message.

Definition at line 46 of file cortex.h.


Function Documentation

void Cortex_ConstructRotationMatrix ( double  angles[3],
int  iRotationOrder,
double  matrix[3][3] 
)

This function constructs a rotation matrix from three Euler angles.

This function and its inverse are utility functions for processing the HTR rotations we send in each frame of data. We send Euler angles in ZYX format (some interpretations would call it XYZ). Using these conversion utilities should protect against any misinterpretations.

Parameters:
matrix- 3x3 rotation matrix.
iRotationOrder- one of:

ZYX_ORDER XYZ_ORDER YXZ_ORDER YZX_ORDER ZXY_ORDER XZY_ORDER

Parameters:
angles- the angles in degrees.
int Cortex_CopyFrame ( const sFrameOfData pSrc,
sFrameOfData pDst 
)

This function copies a frame of data.

The Destination frame should start initialized to all zeros. The CopyFrame and FreeFrame functions will handle the memory allocations necessary to fill out the data.

Parameters:
pSrc- The frame to copy FROM.
pDst- The frame to copy TO
Returns:
RC_Okay, RC_MemoryError
int Cortex_Exit ( )

This function stops all activity of the SDK.

This function should be called once before exiting.

void Cortex_ExtractEulerAngles ( double  matrix[3][3],
int  iRotationOrder,
double  angles[3] 
)

This function decodes a rotation matrix into three Euler angles.

This function and its inverse are utility functions for processing the HTR rotations we send in each frame of data. We send Euler angles in ZYX format (some interpretations would call it XYZ). Using these conversion utilities should protect against any misinterpretations.

Parameters:
matrix- 3x3 rotation matrix.
iRotationOrder- one of:

ZYX_ORDER XYZ_ORDER YXZ_ORDER YZX_ORDER ZXY_ORDER XZY_ORDER

Parameters:
angles- the angles in degrees.
int Cortex_FreeBodyDefs ( sBodyDefs pBodyDefs)

This function frees the memory allocated by Cortex_GetBodyDefs

The data within the structure is freed and also the structure itself.

Parameters:
pBodyDefs- The item to free.
Returns:
RC_Okay
int Cortex_FreeFrame ( sFrameOfData pFrame)

This function frees memory within the structure.

The sFrameOfData structure includes pointers to various pieces of data. That data is dynamically allocated or reallocated to be consistent with the data that has arrived from Cortex. To properly use the sFrameOfData structure, you should use the utility functions supplied. It is possible to reuse sFrameOfData variables without ever freeing them. The SDK will reallocate the components for you.

Parameters:
pFrame- The frame of data to free.
Returns:
RC_Okay
sBodyDefs* Cortex_GetBodyDefs ( double  timeout)

This function queries Cortex for its set of tracking objects.

Returns:
sBodyDefs* - This is a pointer to the internal storage of the results of the latest call to this function.
See also:
Cortex_FreeBodyDefs
sFrameOfData* Cortex_GetCurrentFrame ( double  timeout)

This function polls Cortex for the current frame

The SDK user has the streaming data available via the callback function. In addition, this function is available to get a frame directly.

Note: Cortex considers the current frame to be the latest LiveMode frame completed or, if not in LiveMode, the current frame is the one that is displayed on the screen.

Returns:
sFrameOfData
int Cortex_GetHostInfo ( sHostInfo pHostInfo)

This function gets information about the connection to Cortex

This function returns IP-Address information and Cortex version information. The version info can be used to handle incompatible changes in either our code or your code.

Parameters:
pHostInfo- Structure containing connection information
Returns:
RC_Okay, RC_NetworkError
int Cortex_GetSdkVersion ( unsigned char  Version[4])

This function returns a 4-byte version number.

Parameters:
Version- An array of four bytes: ModuleID, Major, Minor, Bugfix
Returns:
RC_Okay
int Cortex_Initialize ( const char *  szCortexNicCardAddress)

This function defines the connection routes to talk to Cortex.

Machines can have more than one ethernet interface. This function is used to either set the ethernet interface to use, or to let the SDK auto-select the local interface, and/or the Cortex host. This function should only be called once at startup.

Parameters:
szCortexNicCardAddress- "a.b.c.d" or HostName. "" and NULL mean AutoSelect
Returns:
maReturnCode - RC_Okay, RC_ApiError, RC_NetworkError, RC_GeneralError
int Cortex_Request ( const char *  szCommand,
void **  ppResponse,
int *  pnBytes,
double  timeout 
)

This function sends commands to Cortex and returns a response.

This function is an extendable interface between the Client programs and the Host (Cortex) program. The commands are sent as readable text strings. The response is returned unaltered.

Parameters:
szCommand- The request to send the Cortex
ppResponse- The reply
pnBytes- The number of bytes in the response
Example:
    void *pResponse=NULL;
    Cortex_Request("GetContextFrameRate", &pResponse, sizeof(void*));
    fFrameRate = *(float*)pResponse;
Returns:
RC_Okay, RC_TimeOut, RC_NotRecognized, RC_GeneralError
int Cortex_SendHtr ( sHierarchy pHierarchy,
tSegmentData pFrame 
)

This function pushes a skeleton definition to Cortex.

A skeleton, defined in an animation package can be used to start a skeleton model definition in Cortex. The hierarchy and starting pose can come from the animation package. The rest of the details of the skeleton get filled out in the Cortex interface. The parameters to this function match the parameters defining the HTR data that normally gets sent through the SDK2.

Parameters:
pHierarchy- The number of segments, their names and parent child relationships.
pFrame- One frame of HTR data dimensioned according to the number of segments defined in the pHierarchy parameter.
Returns:
- RC_Okay, RC_NetworkError
int Cortex_SetDataHandlerFunc ( void(*)(sFrameOfData *pFrameOfData, void *params)  MyFunction,
void *  params 
)

The user supplied function will be called whenever a frame of data arrives.

The ethernet servicing is done via a thread created when the connection to Cortex is made. This function is called from that thread. Some tasks are not sharable directly across threads. Window redrawing, for example, should be done via events or messages.

Parameters:
MyFunction- This user supply callback function handles the streaming data
Returns:
maReturnCode - RC_Okay

Notes: The data parameter points to "hot" data. That frame of data will be overwritten with the next call to the callback function.

int Cortex_SetErrorMsgHandlerFunc ( void(*)(int iLogLevel, const char *szLogMessage, void *params)  MyFunction,
void *  params 
)

The user supplied function handles text messages posted from within the SDK.

Logging messages is done as a utility to help code and/or run using the SDK. Various messages get posted for help with error conditions or events that happen. Each message has a Log-Level assigned to it so the user can.

See also:
Cortex_SetVerbosityLevel
Parameters:
MyFunction- This user defined function handles messages from the SDK.
Returns:
maReturnCode - RC_Okay
int Cortex_SetMetered ( bool  bActive,
float  fFixedLatency 
)
int Cortex_SetMulticastPort ( unsigned short  port)
int Cortex_SetRequestPort ( unsigned short  port)

configures Cortex ports

int Cortex_SetVerbosityLevel ( int  iLevel)

This function sets the filter level of the LogMessages.

The default verbosity level is VL_Warning.

Parameters:
iLevel- one of the maVerbosityLevel enum values.
Returns:
RC_Okay
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cortex_stream
Author(s): Daniel Maier
autogenerated on Wed Oct 31 2012 08:22:56