Page 1 of 1

Re: RoboClaw 2x15A Motor Controller (V5E) - Freeze/Hang

Posted: Tue Mar 12, 2019 1:11 pm
by Basicmicro Support
Please contact support@basicmicro.com. We have a prerelease that may help out(reduced command latency). The change may be related to your problem or not. We have not had any reports of this kind of problem so it may be unrelated but lets check if you have the same problem with the pre-release first before downgrading to an older release.

Re: RoboClaw 2x15A Motor Controller (V5E) - Freeze/Hang

Posted: Tue Mar 12, 2019 1:46 pm
by ChrisA
I see the same problem using ROS I get hangs and freezes. Then I added a write timeout and now get timeout exceptions.

The problem might be in Py Serial. Without setting the write timeout i would hang "forever" but the timeout prevents that

Here is my modification to roboclaw_driver.py (write_timeout=0.1 fixes the hang on writes problem)

Code: Select all

def Open(comport, rate):
    global port
    port = serial.Serial(comport,
                         baudrate=rate,
                         timeout=0.1,
                         interCharTimeout=0.01,
                         write_timeout=0.1)
    return

I have a very small Python test script that can 100% reproduce the problem.

I have not tried the Supplied test scripts. I think I will

That said, I have not yet ruled out a hardware problem. Perhaps EMI from the motor and power cables is getting into the USB cable? I'll try using zip-ties to keep all the wires apart.

I do think it is a roboclaw firmware issue because a reset always fixes the problem. But this is REALLY hard to debug because we don't have access to the roboclaw's view of the USB interface. It is a black box.

Re: RoboClaw 2x15A Motor Controller (V5E) - Freeze/Hang

Posted: Wed Mar 13, 2019 10:47 am
by Basicmicro Support
A real serial port write will never freeze or timeout(unless there is something wrong with the PC) because we dont use flow control.

USB virtual serial ports are different. If there is a problem they can cause a Write to hang. USB does NOT like noise. DC motors produce a lot of noise. USB is not considered a robust communications connection. It is fine for setup and basic testing.

By definition Writes to a serial will output data without regards to the Roboclaw state because we do not use hardware flow control on a actual serial port. However when using USB this is not true because USB has flow control of its own. If USB has a glitch it can cause a Write to fail(either locking up or timing out as you are showing).

Reseting the Roboclaw just causes the USB port to reinit on both the Roboclaw and the PC which is how you fix a hung USB port on a PC. BUt that does pretty conclusivley indicate the problem is the USB port connection. I started using a USB isolation adapter and have zero(so far) USB glitches since.

Here is an amazon link to the one I purchased:

https://www.amazon.com/SMAKN-Isolator-D ... B00XXPO4UG