-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
89 lines (72 loc) · 1.57 KB
/
test.c
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
80
81
82
83
84
85
86
87
#include <stdlib.h>
#include <stdio.h>
#include "vatthex.h"
#include <argp.h>
int TestCorrections( int ID )
{
double temp = 20.0;
double el = 3.14159/4.0;
Axis xp[6];
GetHexPos(ID, xp);
printf("Hexapod Postion!!!!\n");
PrintHexPos(xp);
printf("Corrected POSTIONS_________________\n");
uncorrect(xp, el, temp);
PrintHexPos(xp);
GetHexPos(ID, xp);
correct(xp, el, temp);
printf("The zero postion__________________n\n");
PrintHexPos(xp);
xp[XX].pos = 0.0;
MoveOneAxis(ID, &xp[XX]);
return 1;
}
void TestGCS(int ID, const char * cmd )
{
char resp[200];
printf( "sending commnad '%s'\n", cmd );
if ( !GenericCommand(ID, cmd, resp, 200) )
printf("ERROR!\n");
else
printf( "Got Response:\n%s\n", resp );
}
void TestError(int ID)
{
char buff[200];
int errno;
errno = GetError(ID, buff, sizeof(buff));
printf("Error no. is %i and description is %s\n", errno, buff );
}
int main(int argc, char *argv[])
{
if(argc != 3)
{
printf("Wrong number of args!\n");
exit(-1);
}
int port = atoi(argv[2]);
char szIDN[200];
char szDescription[500];
int nPIdevices=PI_EnumerateTCPIPDevices( szDescription, 500, "" );
if(nPIdevices == 0)
{
printf("No Devices found\n");
}
else
{
printf("%i PI devices found: \n%s\n", nPIdevices, szDescription);
}
int ID = PI_ConnectTCPIP(argv[1], port);
Axis xp[6];
if(PI_qIDN(ID,szIDN,199) == FALSE)
{
printf("qIDN failed. Exiting.\n");
return -1;
}
printf("ID == %i\n IDN = %s\n", ID, szIDN);
//TestGCS(ID, "POS?" );
GetHexPos(ID, xp);
ReferenceIfNeeded(ID, xp);
//TestGCS(ID, "*IDN?");
TestError(ID);
}