Closed GabauerDavid closed 2 years ago
Hi @GabauerDavid . Without a little more context it is hard to tell what is the problem. Also, I don't have access to a Windows machine (which it looks like you are using) so it's a bit harder to say. There are a few things that you could try though.
_read_packet
is timing out. Please include an import traceback
before your code and then wrap the last three lines of your test in:
try:
...
except Exception as e:
print(traceback.format_exc())
So that you can see which call is timing out. The call chain will likely show that it was called by _get_response
, which was called by _send_command
but the question is which command was timing out? If it is the INIT
command on line 163 then it is almost certainly a serial port issue.
Dear @nickovs, Thanks a lot for the fast response. Indeed I am using a Windows machine for this application. Seems as if I have a serial port issue. When I open the Device Manager, I see that the K-LD7 is on COM4 which is also the port I set in my code. Also, have disabled/enabled the device. For completeness, please find the traceback below - maybe it will help others:
Traceback (most recent call last):
File "*\python\helpers\pydev\pydevd.py", line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "*\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "*/kld7.py", line 3, in <module>
with KLD7(COM_Port) as radar:
File "*\kld7\kld7\device.py", line 163, in __init__
response = self._send_command('INIT', SUPPORTED_RATES.index(baudrate))
File "*\kld7\kld7\device.py", line 242, in _send_command
return self._get_response()
File "*\kld7\kld7\device.py", line 264, in _get_response
reply, payload = self._read_packet()
File "*\kld7\kld7\device.py", line 250, in _read_packet
raise Exception("Timeout waiting for reply")
Exception: Timeout waiting for reply
I get the an error when running the following code:
from kld7 import KLD7 COM_Port = "COM4" with KLD7(COM_Port) as radar: for target_info in radar.stream_TDAT(): print(target_info)
File "*\kld7\kld7\device.py", line 250, in _read_packet raise Exception("Timeout waiting for reply") Exception: Timeout waiting for reply
Thanks a lot for your support in advance.