11 using System.Collections.Generic;
14 using System.Threading;
34 StreamWriter writerA =
new StreamWriter(fileA,
false);
35 StreamWriter writerB =
new StreamWriter(fileB,
false);
40 "RC 0;' Disable Recording\n" +
41 "DP 0, 0;' Set current position to 0\r" +
42 "DM posA[1000], posB[1000];' Define a new array that will hold positional data\r" +
43 "RA posA[], posB[];' Sets position array to be where recorded data will be stored\r" +
44 "RD _TPA, _TPB;' Defines Position to be the type of data that will be recorded\r" +
45 "RC 1,-1000;' Begins recording at 512Hz in continuous mode\r" +
46 "MO AB;' Turns motors off\r" +
47 "AI -1;' Waits for active low on Input 1\r" +
48 "RC 0;' Disable Recording after Input 1 goes low\r" +
56 bool leading_comma =
false;
64 Write_Array_To_File(
gclib, writerA,
"posA", previous_rd, rd, leading_comma);
67 Write_Array_To_File(
gclib, writerB,
"posB", previous_rd, rd, leading_comma);
75 }
while (recording > 0);
83 private static void Write_Array_To_File(
gclib gclib, StreamWriter writer,
string array_name,
int previous_rd,
int rd,
bool leading_comma)
85 List<double> values =
new List<double>();
89 values.AddRange(
gclib.
GArrayUpload(array_name, (
short)previous_rd, (
short)(rd - 1)));
104 for (
int i = 0; i < values.Count(); i++)
109 leading_comma =
true;
111 writer.Write(String.Format((
"{0:0.000}"), values[i]));
Provides a class of shared constants and methods for gclib's example projects.
const int GALIL_EXAMPLE_OK
Examples success code.
string GCommand(string Command, bool Trim=true)
Used for command-and-response transactions.
void GProgramDownload(string program, string preprocessor="")
Allows downloading of a DMC program from a string buffer.
List< double > GArrayUpload(string array_name, Int16 first=-1, Int16 last=-1)
Uploads array data from the controller's array table.
Int16 GCmdI(string Command)
Used for command-and-response transactions.
Provides a class that binds to gclib's unmanaged dll. Wraps each call and provides a more user-friend...
static int Record_Position(gclib gclib, string fileA, string fileB)
Record user's training and saves to a text file.