Skip to content

buildhat.exc.DeviceNotFound: No device found #122

@OliverFaust

Description

@OliverFaust

Hi,

Writing to the device in a hard loop causes a `No device found' after some time. Here is the complete call trace:

Traceback (most recent call last):
File "/home/pi/Python/xBoxController/minimalError.py", line 5, in
pair.start(0,0)
File "/usr/local/lib/python3.9/dist-packages/buildhat/motors.py", line 390, in start
self._rightmotor.start(speedr)
File "/usr/local/lib/python3.9/dist-packages/buildhat/motors.py", line 229, in start
self._write(cmd)
File "/usr/local/lib/python3.9/dist-packages/buildhat/devices.py", line 155, in _write
self.isconnected()
File "/usr/local/lib/python3.9/dist-packages/buildhat/devices.py", line 91, in isconnected
raise DeviceNotFound("No device found")
buildhat.exc.DeviceNotFound: No device found

The time delay, after which that error occurs, seems to be random. I have observed that error anywhere from 1 min to 5 min. That might indicate a runtime problem with the framework, such as a buffer overrun.
Here is a minimal example to reproduce the error:

import buildhat

pair = buildhat.MotorPair('A', 'B')
while True:
    pair.start(0,0)

Debugging revealed that BuildHAT.DEVTIMEOUT followed by BuildHAT.DISCONNECTED occurred in serinterface.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions