Robotics StackExchange | Archived questions

rosserial running please

hi, I use ROS indigo. when i run rosrun rosserial_python serial_node.py /dev/ttyACM0, i receive this error:

$ rosrun rosserial_python serial_node.py /dev/ttyACM0
[INFO] [WallTime: 1461764416.016787] ROS Serial Python Node
[INFO] [WallTime: 1461764416.185233] Connecting to /dev/ttyACM0 at 57600 baud
Traceback (most recent call last):
  File "/home/pi/catkin_ws/install/lib/rosserial_python/serial_node.py", line 80, in <module>
    client = SerialClient(port_name, baud)
  File "/home/pi/catkin_ws/install/lib/python2.7/dist-packages/rosserial_python/SerialClient.py", line 382, in __init__
    self.requestTopics()
  File "/home/pi/catkin_ws/install/lib/python2.7/dist-packages/rosserial_python/SerialClient.py", line 389, in requestTopics
    self.port.flushInput()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 500, in flushInput
    termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
termios.error: (5, 'Input/output error')

What can i do please?

Asked by Emilien on 2016-05-01 08:02:29 UTC

Comments

Are you running Arduino on the same Baud rate (57600)?

Asked by Muhammed Alsayadi on 2016-05-01 16:02:46 UTC

yes on the same.

Asked by Emilien on 2016-05-01 17:20:48 UTC

Are you sure that your device is connected to your machine and assigned to /dev/ttyACM0? Do you have permission to read and write from that device? Further, are you sure that no other program is using that device?

Asked by jarvisschultz on 2016-05-02 17:13:48 UTC

i add :

cmake_minimum_required(VERSION 2.8.3)

include_directories(${ROS_LIB_DIR})

# Remove this if using an Arduino without native USB (eg, other than Leonardo)
#add_definitions(-DUSB_CON)

generate_arduino_firmware(hello
  SRCS chatter.cpp ${ROS_LIB_DIR}/time.cpp
  BOARD uno
  PORT /dev/ttyACM0
)

Asked by Emilien on 2016-05-03 03:09:01 UTC

but i don't know where is the problem

Asked by Emilien on 2016-05-03 03:10:30 UTC

Have you checked the points I mentioned? When you google the Input/output error you're getting it seems like permissions/incorrect ports/locked ports are the most common issues.

Asked by jarvisschultz on 2016-05-03 07:17:41 UTC

how? can you explain it more please?

Asked by Emilien on 2016-05-03 07:51:38 UTC

Incorrect Port Make sure when the device is connected a new file, /dev/ttyACM0 is created. You can find this by looking at the output of ls -la /dev/ttyACM* before and after connecting your device. You can also look at dmesg. A command I often use is watch -n 0.2 "dmesg |tail -n 20".

Asked by jarvisschultz on 2016-05-03 14:41:33 UTC

That last command will show the last 20 lines of dmesg, and it will continually refresh the output every 0.2 seconds. Run this command and watch how the output changes when you connect your device.

Asked by jarvisschultz on 2016-05-03 14:42:27 UTC

Permissions You need permission to read/write to the file created when the device is plugged in. If you have verified that the device is on /dev/ttyACM0 then inspect the output of ls -la /dev/ttyACM*. This will tell you the permissions and the ownership of the file.

Asked by jarvisschultz on 2016-05-03 14:44:06 UTC

If your user doesn't have r/w permissions, or belong to the owning group that has r/w permissions, then that could explain your problem. Read more here

Asked by jarvisschultz on 2016-05-03 14:45:40 UTC

Locked Port Only one process should be reading/writing to the file at a time. You could use fuser /dev/ttyACM0 to see which PIDs are using the file. You could then do ps --pid PIDVALUE to figure out which process is using the file. Try stopping these procs and see if that helps.

Asked by jarvisschultz on 2016-05-03 14:53:14 UTC

Hello, I have the same issue. I checked the three options: Incorrect Port, Permissions and Locked Port. All 3 are right. Were you able to solve this? Any ideas that might help?

Asked by rezenders on 2021-04-15 13:51:19 UTC

Answers