ROS

/dev/ttyUSB0 권한없음 오류 해결 과정 (삽질)

donie 2021. 1. 14. 00:53

1. [Errno 13] Permission denied: '/dev/ttyUSB0'

sudo chmod a+rw /dev/ttyUSB0

터미널에서 위 명령어 실행하여 해결

참고: sudomod.com/forum/viewtopic.php?t=6075

 

[SOLVED] arduino [Errno 13] Permission denied: '/dev/ttyUSB0' - sudomod

Post by obsidianspider » Thu Jun 07, 2018 2:13 pm This is meant to help anyone else who may have run into the error that I did. I'm just learning Arduino/ESP32 stuff and my development laptop is a Chromebook running GalliumOS. I ran into an issue where I

sudomod.com

 

2. [Errno 16] Device or resource busy: '/dev/ttyUSB0'

이미 내가 아두이노에서 초음파센서를 사용하고 있어서 그런 것 같아, 아두이노 실행 종료.

 

3. [Errno 5] Input/output error: '/dev/ttyUSB0'

sudo chmod 0666 /dev/ttyUSB0

위 명령어를 실행했더니 sudo: unable to resolve host hs 이런 메시지가 나와서 일단 재부팅.

참고: stackoverflow.com/questions/49503129/pyserial-input-output-error

 

PySerial Input/Output Error

I have a quadruped robot running with an SSC-32 servo controller. The servo controller has a serial port, so I purchased a USB-to-Serial cable to send commands to it. Because I am most proficient w...

stackoverflow.com

 

4. 다시 [Errno 13] Permission denied: '/dev/ttyUSB0'

재부팅했더니 다시 [Errno 13] Permission denied: '/dev/ttyUSB0'

sudo: unable to resolve host {hostname}부분을 다시 살펴보다가 혹시 hostname때문인가 싶어서 hostname을 수정하였다.

참고: www.psychz.net/client/question/en/sudo-unable-to-resolve-host.html#:~:text=When%20the%20terminal%20is%20stuck,%22%2Fetc%2Fhostname%22.

 

Sudo Unable To Resolve Host ...

Trusted By 25,000+ Customers (Since 2001)

www.psychz.net

호스트네임 변경 방법

새로 터미널을 열자 호스트네임이 바뀜.

재부팅.

 

5. 여전히 [Errno 13] Permission denied: '/dev/ttyUSB0'

첫번째 방법이었던 권한 수정

sudo chmod a+rw /dev/ttyUSB0

 

6. 해결

드디어 성공.

 

+ 아래 QnA글도 참고. 다른 해결방법이지만 hostname때문에 발생하는 문제인 점은 동일하다.

answers.ros.org/question/52093/rosserial-helloworld/?answer=52129#post-id-52129

 

rosserial helloworld - ROS Answers: Open Source Q&A Forum

Hi all, I am trying to get the example helloWorld working from the rosserial package, and everything went smooth until the command: rosrun rosserial_python serial_node.py /dev/ttyACM0 the error msg is: raise SerialException("could not open port %s: %s" % (

answers.ros.org

 

7. [Errno 5] Input/output error: '/dev/ttyUSB0'

한 번 실행은 되는데 두번째 실행하면 실행이 안되는 문제 발생.

아래와 같이 첫번째 실행은 잘 되는데,

종료하고 두번째 실행하면 아래와 같이 안됨.

그래서 위 글을 참고해서

sudo adduser selfdriving dialout

다음 실행권한을 바꿔주었다.

sudo chmod a+rw /dev/ttyUSB0

 

roslaunch ultrasonic ultra.launch

1번째 실행 -> 성공

2번째 실행 -> 실패

3번째 실행 -> 성공

4번째 실행 -> 성공

5번째 실행 -> 실패

6번째 실행 -> 성공

 

처음 한 번만 실행할 수 있는 건가 했더니 랜덤인가보다.

앞으로 실행이 안되면 종료하고 다시 실행해보는 걸로..