# Lost sync with rosserial_python and wrong key transmission

Hi everyone,

I've been doing maps with a two-wheeled robot by using navigation stack and gmapping. For some reason when I source my encoders with a minor voltage, the maps I got are more accurate than higher voltages.

The thing is, that I have a huge problem with the synchronization. For different supplies values for the encoders I have, rosserial_python, which uses serial_node, lost sync suddenly while I'm mapping. Also, there is something I haven't figured out for teleop_twist_keyboard. Seems that it doesn't receive the messages through topics at the time it should, probably for an insufficent transmission time. It works perfectly when I don't supply the encoders, but if do that, I cannot mapping because it wouldn't read them.

So, if I want to make a good map and navigate through it, first I need to be able to teleop the robot without having problems of sync and that it detects al keys I press. That's because sometimes it doesn't detects some keys I press, like turn left, right and I have to wait a few seconds in order to it reads the keys I've already pressed.

I'm sure that once solving this, I'll be able to navigate through the maps I got, because I've followed all instructions on ROS, and when the robot tries to navigate from some point to another it get lost and keeps advancing in one direction, surely because of the delay of transmission.

The problem must reside on motor.conroller6.ino. Here is my github page with the files, specifically that file. I've read in other related topics like this and this one, and I have spinonce() in the loop function for arduino, and the millis() seems to be fine for me. Also changing LOOPTIME only affects the responding time, but doesn't change the behavior.

Here is motorcontroller6.ino

The typical error of sync

    Traceback (most recent call last):
File "/opt/ros/kinetic/lib/rosserial_python/serial_node.py", line 85, in <module>
client.run()
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosserial_python/SerialClient.py", line 503, in run
self.requestTopics()
File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosserial_python/SerialClient.py", line 389, in requestTopics
self.port.flushInput()
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 532, in flushInput
self.reset_input_buffer()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 566, in reset_input_buffer
termios.tcflush(self.fd, termios.TCIFLUSH)
termios.error: (5, 'Input/output error')
[serial_node-26] process has died [pid 30108, exit code 1, cmd /opt/ros/kinetic/lib/rosserial_python/serial_node.py __name:=serial_node __log:=/home/gerson/.ros/log/58647904-9a10-11e7-aafb-3ca0672cc307/serial_node-26.log].
log file: /home/gerson/.ros/log/58647904-9a10-11e7-aafb-3ca0672cc307/serial_node-26*.log


I hope you guys help me to solve this problem which is keeping me stuck for navigation.

edit retag close merge delete

( 2017-09-15 10:34:24 -0600 )edit

I've updated the post. Thanks

( 2017-09-15 10:57:07 -0600 )edit

Sort by » oldest newest most voted

I've solved the synchronization problem just using the original teleop_twist_keyboard.py file. I realized that if I change the raw keys for other, even if it hasn't mistakes, I'll always have sync problems. So, is better don't move anything in there.

On the other hand, for navigation I thought that because of odd keys reading and sync, the wheeled robot wasn't navigating as should. But its behavior isn't changed. Definitely I have a wrong configuration for the navigation. At least I can discard this problem for navigation :)

Cheers

more