Closed sonelu closed 4 years ago
Performance is not from dynamixel_sdk
.
Running the following code indicates read1ByteTxRx executes in 1.273ms which is expected.
bus1 = robot.buses['SC1']
bus1.open()
ph = bus1.packet_handler
port = bus1.port_handler
start = time.time()
calls = 1000
for _ in range(calls):
temp = ph.read1ByteTxRx(port, 1, 43)
end = time.time()
print(f'duration {end-start:.5f}')
print(f'per call: {(end-start)/calls:.6f}')
Answers:
duration 1.27318
per call: 0.001273
The problem comes from the checks performed in the setter of int_value
in BaseRegister. The limits imposed on the classes that can change the int_value are very expensive.
I have removed the inspect
calls and the checks.
The fix is in a commit in branch on-device.
Describe the bug Using 10 devices on protocol 1.0 (AX-12A) there are very slow performance if using a BaseSyncRead (there are no other means to read loop for protocol 1.0 and non MX devices). 2 registers and 10 registers would mean 20 packets on the bus and the current processing time is aprox 230ms which is very high.
Need to investigate if this delay comes from the software, hardware or a combination of the two.
To Reproduce Use MHH4 robot and check the sync "voltage_temp".
Expected behavior One package should be less than 2ms which means we should expect 20 x 2(send receive) x 2ms ~ 80ms.
Screenshots N/A
Desktop (please complete the following information):
Additional context