-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create driver throws exception on open() #17
Comments
Problem understood. From http://sourceforge.net/p/pyserial/code/HEAD/tree/tags/release2_7/CHANGES.txt: Version 2.6 2011-11-02Bugfixes:
On Ubuntu 14.04: On the working Ubuntu 12.04 system, the same command shows VERSION = '2.5' The actual code which throws the exception is in serialposix.py: I confirmed by opening a port in python manually that it does throw that exception. So the root cause is the API changed between pySerial 2.5 used on Ubuntu 12.04 and pySerial 2.6 used on Ubuntu 14.04. The solution is the open() statement has to be removed in Indigo. I'll submit a pull request for the github official turtlebot repo in a little while, which will fix some other breaks in the turtlebot build, but someone should fix the yujinrobot repo. |
Fix issue #17: open() throws exception.
Fixed with this merge: #18 |
The open() of /dev/ttyUSB0 fails for reasons that are hard to understand. The error message (from a modified msg in create_driver.py that prints Exception.message in the log) is:
[ERROR] [WallTime: 1405999978.886373] Failed to open port /dev/ttyUSB0, Error: Port is already open.. Please make sure the Create cable is plugged into the computer.
The relevant code in create_driver.py is:
class SerialCommandInterface(object):
def init(self, tty, baudrate):
self.ser = serial.Serial(tty, baudrate=baudrate, timeout=SERIAL_TIMEOUT)
self.ser.open()
The exception is thrown by self.ser.open(). If I comment out self.ser.open() the open is successful and robot initialization proceeds.
The pySerial API doc says:
class serial.Serial
init(lots of params)
The port is immediately opened on object creation, when a port is given. It is not opened when port is None and a successive call to open() will be needed.
turtlebot_node passes in port. Thus it appears self.ser.open() is not needed, and various internet posts report that open() on an already-open serial port will throw an exception, though the API doc doesn't say that. But this driver code hasn't changed since before fuerte, so why would it suddenly break? Did something change between python 2.7.3 (in 12.04/Fuerte) and python 2.7.6 (in Trusty/Indigo) related to calling open() on already open ports? Or is something in my environment misconfigured?
Any suggestions?
The text was updated successfully, but these errors were encountered: