-
Notifications
You must be signed in to change notification settings - Fork 0
/
utilities.h
79 lines (71 loc) · 2.63 KB
/
utilities.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#pragma once
#ifndef UTILITIES_H
#define UTILITIES_H
#include <math.h>
#include <NIDAQmx.h>
#include <stdio.h>
//#include "DAQ.h"
#define TRUE 1
#define FALSE 0
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
const int controlFreq = 1000;
const double PI = 3.14159265358979323846;
const double shaftRadius = 0.003;// motor shaft radius in cm
const double loadCellScale1 = (1/sqrt(2.0)) * 50.53; //From calibration test with weights
const double loadCellScale2 = (1/sqrt(2.0)) * 50.53; //From calibration test with weights
const double loadCellScale3 = (1/sqrt(2.0)) * 50.53; //From calibration test with weights
const int sampleFreq = 50000;
const double motorMinVoltage = -7;
const double motorMaxVoltage = 7;
const int messageMinVoltage = 0;
const double messageMaxVoltage = 0.03;
const double loadCellMinVoltage = -10;
const double loadCellMaxVoltage = +10;
const int encoderPulsesPerRev = 500;
/*
const uInt32 MESSAGE_NO_CONNECTION = 0x00000000;
const uInt32 MESSAGE_IDLE = 0x00000003;
const uInt32 MESSAGE_KINEMATIC = 0x00000004;
const uInt32 MESSAGE_RECORD = 0x00000005;
const uInt32 MESSAGE_PERTURB = 0x00000006;
const uInt32 MESSAGE_TERMINATE = 0x00000007;
*/
#define STATE_INIT 0
#define STATE_WINDING_UP 1
#define STATE_OPEN_LOOP 2
#define STATE_CLOSED_LOOP 3
#define STATE_PARADIGM_LENGTH_CALIBRATION 4
#define STATE_RUN_PARADIGM_SERVO_PERTURBATION 5
#define STATE_RUN_PARADIGM_MANUAL_PERTURBATION 6
#define STATE_RUN_PARADIGM_VOLUNTARY_MOVEMENT 7
#define STATE_SHUTTING_DOWN 8
#define STATE_RUN_PARADIGM_CDMRP_IMPLANT 9
extern int dataAcquisitionFlag[12];
const int NUM_NEURON = 128;
const int SAMPLING_RATE = 1024;
const int DATA_EVT_LCEVEL = 9;
const int DATA_EVT_SPINDLE_IA_GAIN = 1;
const int DATA_EVT_SPINDLE_IA_OFFSET = 3;
const int DATA_EVT_GAMMA_DYN = 4;
const int DATA_EVT_GAMMA_STA = 5;
const int DATA_EVT_SPINDLE_II_GAIN = 10;
const int DATA_EVT_SPINDLE_II_OFFSET = 6;
const int DATA_EVT_SYN_IA_GAIN = 3;
const int DATA_EVT_SYN_CN_GAIN = 10;
const int DATA_EVT_SYN_II_GAIN = 11;
const int DATA_EVT_CORTEX_DRIVE = 8;
const int DATA_EVT_CORTEX_MIXED_INPUT = 9;
const int DATA_EVT_S_WEIGHT = 6;
int proceedState(int *);
int ReInterpret(float32, int32 *);
int ReInterpret(int32, int32 *);
int ReInterpret(int, float *);
typedef unsigned char BYTE;
#define BICEP 0
#define TRICEP 1
extern float GGAIN; //default is (0.9/1000) //0.4/2000 is safe
extern float TBIAS;
//work in progress
void configParser(FILE *);
void testParser(FILE *);
#endif