数梅派连接arduino出现Permission denied: '/dev/ttyUSB0'错误解决

全部错误信息:

pi@pi:~$ roslaunch ros_arduino_python arduino.launch
... logging to /home/pi/.ros/log/21167e0a-74bf-11e7-b0e3-b827ebc62e10/roslaunch-pi-5106.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://pi.local:44455/

SUMMARY
========

PARAMETERS
 * /arduino/accel_limit: 0.2
 * /arduino/base_controller_rate: 10
 * /arduino/base_frame: base_link
 * /arduino/baud: 115200
 * /arduino/encoder_resolution: 52
 * /arduino/gear_reduction: 30.0
 * /arduino/left_Kd: 24
 * /arduino/left_Ki: 0
 * /arduino/left_Ko: 100
 * /arduino/left_Kp: 20
 * /arduino/motors_reversed: False
 * /arduino/port: /dev/ttyUSB0
 * /arduino/rate: 50
 * /arduino/right_Kd: 24
 * /arduino/right_Ki: 0
 * /arduino/right_Ko: 100
 * /arduino/right_Kp: 17
 * /arduino/sensorstate_rate: 10
 * /arduino/timeout: 0.1
 * /arduino/use_base_controller: True
 * /arduino/wheel_diameter: 0.068
 * /arduino/wheel_track: 0.287
 * /rosdistro: kinetic
 * /rosversion: 1.12.6

NODES
  /
    arduino (ros_arduino_python/arduino_node.py)

auto-starting new master
process[master]: started with pid [5129]
ROS_MASTER_URI=http://pi.local:11311

setting /run_id to 21167e0a-74bf-11e7-b0e3-b827ebc62e10
process[rosout-1]: started with pid [5142]
started core service [/rosout]
process[arduino-2]: started with pid [5145]
Connecting to Arduino on port /dev/ttyUSB0 ...
Serial Exception:
(<class 'serial.serialutil.SerialException'>, SerialException(13, "could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'"), <traceback object at 0x75608328>)
Traceback follows:
Traceback (most recent call last):
  File "/home/pi/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/src/ros_arduino_python/arduino_driver.py", line 65, in connect
    self.port = Serial(port=self.port, baudrate=self.baudrate, timeout=self.timeout, writeTimeout=self.writeTimeout)
  File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 180, in __init__
    self.open()
  File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 294, in open
    raise SerialException(msg.errno, "could not open port %s: %s" % (self._port, msg))
SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
Cannot connect to Arduino!
[arduino-2] process has died [pid 5145, exit code 1, cmd /home/pi/catkin_ws/src/ros_arduino_bridge/ros_arduino_python/nodes/arduino_node.py __name:=arduino __log:=/home/pi/.ros/log/21167e0a-74bf-11e7-b0e3-b827ebc62e10/arduino-2.log].
log file: /home/pi/.ros/log/21167e0a-74bf-11e7-b0e3-b827ebc62e10/arduino-2*.log

主要错误信息:

SerialException: [Errno 13] could not open port /dev/ttyUSB0: [Errno 13] Permission denied: '/dev/ttyUSB0'
Cannot connect to Arduino!

终端输入:

sudo usermod -a -G dialout pi

重新插拔usb后,再次运行

pi@pi:~$ roslaunch ros_arduino_python arduino.launch
... logging to /home/pi/.ros/log/2761f1ee-74c0-11e7-b0e3-b827ebc62e10/roslaunch-pi-5440.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://pi.local:37379/

SUMMARY
========

PARAMETERS
 * /arduino/accel_limit: 0.2
 * /arduino/base_controller_rate: 10
 * /arduino/base_frame: base_link
 * /arduino/baud: 115200
 * /arduino/encoder_resolution: 52
 * /arduino/gear_reduction: 30.0
 * /arduino/left_Kd: 24
 * /arduino/left_Ki: 0
 * /arduino/left_Ko: 100
 * /arduino/left_Kp: 20
 * /arduino/motors_reversed: False
 * /arduino/port: /dev/ttyUSB0
 * /arduino/rate: 50
 * /arduino/right_Kd: 24
 * /arduino/right_Ki: 0
 * /arduino/right_Ko: 100
 * /arduino/right_Kp: 17
 * /arduino/sensorstate_rate: 10
 * /arduino/timeout: 0.1
 * /arduino/use_base_controller: True
 * /arduino/wheel_diameter: 0.068
 * /arduino/wheel_track: 0.287
 * /rosdistro: kinetic
 * /rosversion: 1.12.6

NODES
  /
    arduino (ros_arduino_python/arduino_node.py)

auto-starting new master
process[master]: started with pid [5451]
ROS_MASTER_URI=http://pi.local:11311

setting /run_id to 2761f1ee-74c0-11e7-b0e3-b827ebc62e10
process[rosout-1]: started with pid [5464]
started core service [/rosout]
process[arduino-2]: started with pid [5481]
Connecting to Arduino on port /dev/ttyUSB0 ...
Connected at 115200
Arduino is ready.
[INFO] [1501375438.888724]: Connected to Arduino on port /dev/ttyUSB0 at 115200 baud
Updating PID parameters
Updating PID parameters
[INFO] [1501375439.043502]: Started base controller for a base of 0.287m wide with 52 ticks per rev
[INFO] [1501375439.045340]: Publishing odometry data at: 10.0 Hz using base_link as base frame

成功连接arduino,enjoy!

参考:
http://www.ncnynl.com/archives/201612/1209.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值