1'''
2Motion - Motion_3axis_helical_interpolation.py with synchronous mode.
3
4-------------------------------------------------------------------------------------
5Please change correct serial number or IP and port number BEFORE you run example code.
6
7For other examples please check:
8 https://github.com/WPC-Systems-Ltd/WPC_Python_driver_release/tree/main/examples
9See README.md file to get detailed usage of this example.
10
11Copyright (c) 2022-2025 WPC Systems Ltd. All rights reserved.
12'''
13
14## WPC
15from wpcsys import pywpc
16
17
18def main():
19 ## Get Python driver version
20 print(f'{pywpc.PKG_FULL_NAME} - Version {pywpc.__version__}')
21
22 ## Create device handle
23 dev = pywpc.EMotion()
24
25 ## Connect to device
26 try:
27 dev.connect("192.168.1.110") ## Depend on your device
28 except Exception as err:
29 pywpc.printGenericError(err)
30 ## Release device handle
31 dev.close()
32 return
33
34 try:
35 ## Parameters setting
36 port = 0 ## Depend on your device
37 axis = 0
38 stop_decel = 0
39 timeout = 3 ## [sec]
40
41 ## Helical parameters
42 center_x = 0
43 center_y = 0
44 finish_x = 100
45 finish_y = 100
46 pitch_axis3 = 0
47 pitch_axis4 = 0
48 rotation_num = 0
49 speed = 0
50 cal_timeout = 1000
51 helical_dir_cw = 0
52
53 ## Get firmware model & version
54 driver_info = dev.Sys_getDriverInfo(timeout)
55 print(f"Model name: {driver_info[0]}, Firmware version: {driver_info[-1]} ")
56
57 ## Motion open
58 err = dev.Motion_open(port, timeout)
59 print(f"Motion_open in port {port}, status: {err}")
60
61 ## Motion open configuration file
62 err = dev.Motion_openCfgFile('C:/Users/user/Desktop/3AxisStage_2P.ini')
63 print(f"Motion_openCfgFile, status: {err}")
64
65 ## Motion load configuration file
66 err = dev.Motion_loadCfgFile(timeout)
67 print(f"Motion_loadCfgFile, status: {err}")
68
69 ## Motion configure
70 err = dev.Motion_cfgHelicalInterpo(port, center_x, center_y, finish_x, finish_y, int(False), pitch_axis3, int(False), pitch_axis4, rotation_num,
71 speed, helical_dir_cw, cal_timeout, timeout)
72 print(f"Motion_cfgHelicalInterpo in axis{axis}, status: {err}")
73
74 ## Motion start
75 err = dev.Motion_startHelicalInterpo(port, timeout)
76 print(f"Motion_startHelicalInterpo in axis{axis}, status: {err}")
77
78 move_status = 0
79 while move_status == 0:
80 move_status = dev.Motion_getMoveStatus(port, axis, timeout)
81 if move_status != 0:
82 print(f"Move completed axis {axis}...")
83 return move_status
84
85 ## Motion stop
86 err = dev.Motion_stop(port, axis, stop_decel, timeout)
87 print(f"Motion_stop in axis{axis}, status: {err}")
88
89 ## Motion close
90 err = dev.Motion_close(port, timeout)
91 print(f"Motion_close in port {port}, status: {err}")
92 except Exception as err:
93 pywpc.printGenericError(err)
94
95 finally:
96 ## Disconnect device
97 dev.disconnect()
98
99 ## Release device handle
100 dev.close()
101
102
103if __name__ == '__main__':
104 main()