Hi, I’m new to ODrive and now want to seek some help.
My condition is I used (raspberry pi 4’s UART) or a (USB to TTL) to control ODrive with ASCII Protocol.
Take the (USB to TTL) component’s communication with ODrive as example, I want to find how many responses could I get with a maximum requests?
Here is my code:
import serial
ted = serial.Serial(port='/dev/tty.wchusbserial1470', baudrate=115200)
for i in range(300):
ted.write("r vbus_voltage\n".encode('ascii'))
ted.write("r axis0.motor.config.current_lim\n".encode('ascii'))
ted.write("r axis0.controller.config.vel_limit\n".encode('ascii'))
for j in range(300):
vv = ted.readline()
cl = ted.readline()
vl = ted.readline()
print(j, "---", vv, cl, vl)
And finally I got the result below:
0 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
1 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
2 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
3 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
4 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
5 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
6 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
7 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
8 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
9 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
10 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
......
140 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
141 --- b'24.415649\r\n' b'10.000000\r\n' b'20000.000\r\n'
142 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
143 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
144 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
145 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
146 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
147 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
148 --- b'24.400343\r\n' b'10.000000\r\n' b'20000.000\r\n'
149 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
150 --- b'24.415649\r\n' b'10.000000\r\n' b'20000.000\r\n'
151 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
152 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
153 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
154 --- b'24.385035\r\n' b'10.000000\r\n' b'20000.000\r\n'
155 --- b'200.000\r\n' b'24.385035\r\n' b'10.000000\r\n'
156 --- b'20000.000\r\n' b'24.400343\r\n' b'10.000000\r\n'
157 --- b'20000.000\r\n' b'24.400343\r\n' b'10.000000\r\n'
158 --- b'20000.000\r\n' b'24.385035\r\n' b'10.000000\r\n'
Item 0 to 154 are normal response, at item 155 there exists a b’200.000\r\n’ break the order.
It seems I got 155 (0-154) normal responses and total 159 responses, as I set the baudrate 115200, what’s the relation between response number I could fetch and baudrate or any other thing like buffer?
Besides, I tried several rounds, at the end of result read from ODrive, always missed or added some strange data, any hint for these?
Thx and best regards!