13 #define G_LASTINDEX 999
18 int previous_rd,
int rd);
23 osA.open(fileA, ios::out | ios::trunc);
24 osB.open(fileB, ios::out | ios::trunc);
29 "RC 0;' Disable Recording\n"
30 "DP 0, 0;' Set current position to 0\r"
31 "DM posA[1000], posB[1000];' Define a new array that will hold positional data\r"
32 "RA posA[], posB[];' Sets position array to be where recorded data will be stored\r"
33 "RD _TPA, _TPB;' Defines Position to be the type of data that will be recorded\r"
34 "RC 1,-1000;' Begins recording at 512Hz in continuous mode\r"
35 "MO AB;' Turns motors off\r"
36 "AI -1;' Waits for active low on Input 1\r"
37 "RC 0;' Disable Recording after Input 1 goes low\r"
38 "EN;' End program", 0));
47 e(
GCmdI(g,
"MG _RD", &rd));
55 e(
GCmdI(g,
"MG _RC", &recording));
63 return GALIL_EXAMPLE_OK;
68 int previous_rd,
int rd)
GCLIB_DLL_EXPORTED void GCALL GSleep(unsigned int timeout_ms)
Uses GUtility() and G_UTIL_SLEEP to provide a blocking sleep call which can be useful for timing-base...
GCLIB_DLL_EXPORTED GReturn GCALL GCmdI(GCon g, GCStringIn command, int *value)
Wrapper around GCommand that provides the return value of a command parsed into an int.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload(GCon g, GCStringIn program, GCStringIn preprocessor)
Downloads a program to the controller's program buffer.
GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
GCLIB_DLL_EXPORTED GReturn GCALL GArrayUpload(GCon g, const GCStringIn array_name, GOption first, GOption last, GOption delim, GBufOut buffer, GSize buffer_len)
Uploads array data from the controller's array table.
#define G_COMMA
For GArrayUpload(), use this value in the delim field to delimit with commas.
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
#define G_HUGE_BUFFER
Most reads from Galil hardware are small. This value will hold the largest array or program upload/do...
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
void e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.
GReturn record_position(GCon g, char *fileA, char *fileB)
Record user's training and saves to a text file.
void write_array_to_file(GCon g, ofstream &os, const char *array_name, int previous_rd, int rd)
Grabs data from array on controller and writes it to the given text file.