0
$\begingroup$

Rosanswers logo

I'm having an interesting issue with rosserial. When uploading some arduino code, for example Hello World , and running:

rosrun rosserial_python serial_node.py /dev/ttyUSB0

I am able to connect with no issue. If I upload the same code, but unplug and plug back in the arduino hardware before running rosserial I am unable to connect. And only see a repeating:

Lost sync with device, restarting...

I have made sure that the hardware is actually still on the correct serial port. Something about the arduino losing power is changing how it is able to communicate....sounds crazy I know. Has anyone else seen this issue?

-Parker


Originally posted by 0pc0 on ROS Answers with karma: 78 on 2012-03-08

Post score: 3


Original comments

Comment by Kevin on 2012-03-08:
Could it be a USB thing? Is the Arduino IDE still connected and rosserial can't access it? Just blindly guessing.

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

This answer might be suitable for you as well: http://answers.ros.org/question/11237/rosserial-lost-sync-with-device


Originally posted by Bence Magyar with karma: 358 on 2012-03-08

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$
0
$\begingroup$

Rosanswers logo

Bence, thanks for the link but that did not work. I am a colleague of Parker's and have been working with him on this issue. Upon further research we have found that the problem only occurs if the serial cable is disconnected after using serial_node.py to communicate with the node. In other words we can flash the Arduino with the Hello World sketch, disconnect and reconnect the USB cable and communicate with the node via serial_node.py. However if we disconnect the USB cable after doing so, regardless of whether the Arduino is powered via the barrel plug, we are no longer able to communicate with the node via serial_node.py upon reconnecting the serial cable.

Even more strange I just tried this at home and the results are completely different. In fact everything works as expected. I flash the Arduino and communicate with it via serial_node.py. I then disconnect the USB cable, reconnect it and communicate with it via serial_node.py again. No problem. I can repeat this process as much I as I like and all works well.

In both cases our machines are running Ubuntu 11.10, ROS electric and are completely up-to-date with respect to software updates. Spot checking the ros-electric packages shows they are the same version on both machines. It's fine that it works at home but we need it to work in the lab as well. Any thoughts as to how to correct this issue would be greatly appreciated.


Originally posted by Dustin with karma: 328 on 2012-03-09

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by ahendrix on 2012-03-09:
Are you using the same model of arduino at home and in the lab?

Comment by Dustin on 2012-03-09:
In fact I am using the exact same unit.

Comment by ahendrix on 2012-03-09:
Are you using the same kernel version on both machines? Are there any extra udev rules on your lab machine? I've found that sometimes certain udev rules can start a process that steals the /dev/ttyUSB0 device.

Comment by Dustin on 2012-03-11:
It is the same kernel on both machines and the udev rules are the same except my machine has two additional rules. One called 40-joystick.rules and one called 40-virtualbox-guest-dkms.rules.

Comment by ahendrix on 2012-03-11:
Well, I'm out of easy ideas. This sounds like trouble between your lab machine and the USB to serial chip on your arduino; I would look at the kernel logs (dmesg) and google around for other people having similar issues.

Comment by Dustin on 2012-03-11:
Same here. Unfortunately this was working just last week without error on the same machine. Reviewing the change log for software updates reveals nothing out of the ordinary though. One thing that stands out is that rosserial_python sends a request to synchronize but the Arduino node never responds.

$\endgroup$
0
$\begingroup$

Rosanswers logo

For anyone else having this issue, we found a workaround. When the device was unplugged from the USB port, we'd need to reprogram it or change the baud rate a couple times. I noticed the devices worked fine when using minicom and other serial programs, so we looked at the source of these programs to see what they're doing. minicom "resets" the modem by setting the baud to 0 and back. We just made SerialClient.py do the same:

self.port = Serial(port, baud, timeout=self.timeout*0.5)

changes to

self.port = Serial(port, 0, timeout=self.timeout*0.5)
self.port.baudrate = baud
time.sleep(2.0) # give usb chip time to reset

Originally posted by kvogt with karma: 21 on 2014-02-09

This answer was NOT ACCEPTED on the original site

Post score: 2


Original comments

Comment by Wafaay on 2017-03-20:
It didn't work ... I am using rosserrial-indigo and still have the same issue

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.