-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstructions.txt
80 lines (58 loc) · 2.92 KB
/
instructions.txt
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
# Instructions to communicate with the ATI FT Gamma Sensor
1. Connect the serial output from the ATI DAQ black box to a
Serial to USB adaptor cable and then plug in the USB cable to the computer.
2. Open the ati_ft_sensor.py file and scroll to the bottom.
Change the following lines to your needs:
a = AtiFtServer('localhost', 10000, serial_port='COM1', mode='ascii', encrypt_flag=True)
a.listen()
- The first parameter is the IP of the ATI server. If the ATI server will run on the same machine
as the Client the parameter localhost is fine.
- The serial_port is the COM port that the Serial to USB
cable is connected to for Windows is propably 'COM1' to 'COM6' and for Linux "/dev/ttyUSB0".
For Linux use dmesg | grep tty to see where the ATI Controller is connected to. For windows open the device
manager and go to Ports (COM & LPT) to find in which port the ATI Controller is connected to.
- The mode parameters has to options, ascii and binary for the communication.
The ascii mode works better, the binary mode gives false measurements.
- The encrypt flag is for the SHA-256 encryption between the Server and the Client.
When finished, close the file.
###########################################################################################################
###### THE ATI FT SENSOR FILE CAN BE USED WITH PYTHON 2.7.x and PYTHON 3.6.x and on Windows or Linux ######
###########################################################################################################
Then open the encryption.py file and replace the following line
in the generate_key function:
password_provided = "root"
with your own password, save the file, exit and run it as:
python3 encryption.py
If there are no errors then there will be a key.key file in the working directory
and the following lines will be shown in the terminal:
hello
encrypted_hello
decrypted_hello
Then run the ati_ft_sensor.py file as:
python3 ati_ft_sensor.py
Do the same with the computer that will communicate with the ATI FT sensor. Use the same
password and generate the same key.key in order to be able to communicate with encryption.
To communicate with the Server use the following lines:
from ATI_FT.ati_ft_sensor import Client
Send these commands to see the ATI Server options
daq = AtiFtClient('localhost', 10000, encrypt_flag=True)
daq.send('hello')
daq.receive()
daq.send('help')
daq.receive()
To return the message use:
msg = daq.receive(ret=True)
Remember to always start with hello at the start of every command as:
daq.send('hello')
m = daq.receive(ret=True)
daq.send('forces')
forces_torques = daq.receive(ret=True)
try:
forces_torques = [float(x) for x in forces_torques.split(',')]
except Exception as e:
"""
Catch exception where server has not initialized and fixed the correct
sequence for the ATI FT Sensor and fixing sequence is transmitted.
"""
print(f'[ATI FT CLIENT]: SERVER NOT INITIALISED \n {e}')
forces_torques = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]