Not able to open port in Jetson TX2
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: Not able to open port in Jetson TX2
Unfortunately I cant help with this since I don't have a jetson but I've approved the post so maybe one of our other Jetson uses will post. We do have a few of them.
This is a Jetson setup problem which means I really don't have any usefull knowledge to help you with. About all I can think of is did you try running python with sudo? Maybe a permissions problem. You can also go into the roboclaw.py file and add print lines to the Open function to get the specific error code/message
This is a Jetson setup problem which means I really don't have any usefull knowledge to help you with. About all I can think of is did you try running python with sudo? Maybe a permissions problem. You can also go into the roboclaw.py file and add print lines to the Open function to get the specific error code/message
Re: Not able to open port in Jetson TX2
Here's what's wrong:
Open() fails to open the port, because it returns 0.
If you open "roboclaw.py", and check Open() (lines 1030-1035 in my version), you'll see that Open() is supposed to return 1 on success, and 0 if the serial library raises an exception, which in your case it does.
You can try the following snippet:
If it raises a SerialException exception (something like "serial.serialutil.SerialException: [Errno 13] could not open port /dev/ttyS0: [Errno 13] Permission denied: ‘/dev/ttyACM0’"), you'll know that it's an access issue.
On the Raspberry Pi, If you run your code as an ordinary user (without sudo), you need to add the user to the "dialout" group, otherwise the serial ports are inaccessible to you. I don't know if TX2 follows a similar pattern...
Open() should be re-raising such exceptions imho, not devour them in an oblivious 0 result...
Open() fails to open the port, because it returns 0.
If you open "roboclaw.py", and check Open() (lines 1030-1035 in my version), you'll see that Open() is supposed to return 1 on success, and 0 if the serial library raises an exception, which in your case it does.
You can try the following snippet:
Code: Select all
import serial
x = serial.Serial("/dev/ttyACM0")
On the Raspberry Pi, If you run your code as an ordinary user (without sudo), you need to add the user to the "dialout" group, otherwise the serial ports are inaccessible to you. I don't know if TX2 follows a similar pattern...
Open() should be re-raising such exceptions imho, not devour them in an oblivious 0 result...
Go tell the Spartans, stranger passing by,
that here, obedient to their laws, we lie.
that here, obedient to their laws, we lie.
- Basicmicro Support
- Posts: 1594
- Joined: Thu Feb 26, 2015 9:45 pm
Re: Not able to open port in Jetson TX2
Yes, my mistake. Forgot we just captured the exception and return 0 or not 0.
James is correct, we should pass on the exception. You can modify the roboclaw.py file to do just that if you prefer. Then you can catch the exception and print out the error message to get a bit more detail.
The roboclaw.py library was written to be as easy to use as possible but in doing so we hide a lot. The assumption is you have working serial ports which isn't necessarily true of course.
James is correct, we should pass on the exception. You can modify the roboclaw.py file to do just that if you prefer. Then you can catch the exception and print out the error message to get a bit more detail.
The roboclaw.py library was written to be as easy to use as possible but in doing so we hide a lot. The assumption is you have working serial ports which isn't necessarily true of course.