nickovs / kld7

A Python driver for the K-LD7 radar module
9 stars 2 forks source link

Timeout error #2

Closed GabauerDavid closed 2 years ago

GabauerDavid commented 2 years ago

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.

nickovs commented 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.

GabauerDavid commented 2 years ago

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