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

General discussion of using Roboclaw motor controllers
Post Reply
davidlu
Posts: 1
Joined: Tue Mar 12, 2019 7:30 am

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

Post by davidlu » Tue Mar 12, 2019 7:41 am

Hi,

After I have updated the my roboclaw to the latest firmware (v4.1.29), the roboclaw would freeze(motor stops rotating) after I run the example python script(roboclaw_speedacceldistance.py and roboclaw_mixedspeedaccel.py) in ubuntu for a while. After I killed the script and rerun the script, the motor would run for a while and then freeze again. The timing that the freeze occurs is not consistent. Sometime happens very fast sometime it would take a while.

Previously, before updating the firmware, the roboclaw was working perfectly.

Is it possible to downgrade the firmware? Or is there any fix to prevent the freeze?

Hope someone could enlighten me.

Thanks.

User avatar
Basicmicro Support
Posts: 1201
Joined: Thu Feb 26, 2015 9:45 pm

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

Post by Basicmicro Support » Tue Mar 12, 2019 1:11 pm

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.

ChrisA
Posts: 23
Joined: Mon May 22, 2017 4:32 pm

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

Post by ChrisA » Tue Mar 12, 2019 1:46 pm

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.

User avatar
Basicmicro Support
Posts: 1201
Joined: Thu Feb 26, 2015 9:45 pm

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

Post by Basicmicro Support » Wed Mar 13, 2019 10:47 am

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

Post Reply