-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstagetest.cpp
116 lines (97 loc) · 2.55 KB
/
stagetest.cpp
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include <stdio.h>
#include <string>
#include <time.h>
#include <cstdio>
#include <queue>
#include <iostream>
#include <cstring>
#include "stage.h"
#define SIMULATED_HARDWARE 1
#define REAL_HARDWARE 0
#define PAUSE_EXIT 1000000000 // millis
#define NETWORK_SERVER 1
int main(int argc, char *argv[])
{
Stage::Stage_system_t stage_sys;
Stage stage;
// API test
#if SIMULATED_HARDWARE
stage.stage_simulator_connect(&stage_sys);
#endif
#if REAL_HARDWARE
stage.stage_connect(&stage_sys);
#endif
if (stage.clear_fault_axes_xya(&stage_sys) == -1)
{
printf("Failed to clear axes faults. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
};
if (stage.enable_axes_xya(&stage_sys) == -1)
{
printf("Failed to enable axes. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
}
if (stage.commute_axes_xya(&stage_sys, 4000) == -1)
{
printf("Failed to commute axes. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
}
if (stage.set_accel_axes_xya(&stage_sys, 2) == -1)
{
printf("Failed to set axes acceleration. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
}
#if REAL_HARDWARE
if (stage.get_fault_axes_xya(&stage_sys) == -1)
{
printf("Failed to get axes faults. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
}
#endif
// movement test
if (stage.move_stage_smooth_mm(&stage_sys, 1, 3) == -1)
{
printf("Failed to shift stage. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
}
if (stage.move_stage_smooth_mm(&stage_sys, 0, 3) == -1)
{
printf("Failed to shift stage. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
}
if (stage.move_stage_smooth_mm(&stage_sys, 3, 3) == -1)
{
printf("Failed to shift stage. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
}
#if GETPOS
if (stage.get_pos_axes_xya(&stage_sys) == -1)
{
printf("Failed to get axes position. Exiting.\n");
Sleep(PAUSE_EXIT);
return -1;
}
#endif
printf("-------------------------\n");
printf("System Status Report:\n");
printf("-------------------------\n");
printf("FAULT_X: %d\n", stage_sys.FAULT_X);
printf("FAULT_Y: %d\n", stage_sys.FAULT_Y);
printf("FAULT_A: %d\n", stage_sys.FAULT_A);
printf("FPOS_X: %f\n", stage_sys.FPOS_X);
printf("FPOS_Y: %f\n", stage_sys.FPOS_Y);
printf("FPOS_A: %f\n", stage_sys.FPOS_A);
printf("-------------------------\n");
while (true)
{
};
return 0;
}