Skip to content
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

Testing Errors in jetbot_motors.py and jetbot_oled.py #37

Closed
asoong98 opened this issue Jan 12, 2021 · 10 comments · Fixed by #48 · May be fixed by #49
Closed

Testing Errors in jetbot_motors.py and jetbot_oled.py #37

asoong98 opened this issue Jan 12, 2021 · 10 comments · Fixed by #48 · May be fixed by #49

Comments

@asoong98
Copy link

asoong98 commented Jan 12, 2021

Jetson Nano (Developer Kit Vesion) - Jetpack 4.4.1 [L4T 32.4.4]

I've followed the configuration, installation, and build steps as they were listed, but I get IOError: [Errno 121] Remote I/O error for the following commands.

$ rosrun jetbot_ros jetbot_oled.py
$ rosrun jetbot_ros jetbot_motors.py

I've double checked my connections and tried running my own script to test the qwiic oled. I'm able to connect and use the qwiic oled using the sparkfun-qwiic-micro-oled Python3 library.
import qwiic_micro_oled
my_oled = qwiic_micro_oled.QwiicMicroOled()
my_oled.begin()
my_oled.clear(my_oled.PAGE)
my_oled.print("Hello")
my_oled.display()

However, it doesn't seem to work with the Adafruit_SSD1306 library.

The fact that I'm able to connect and use the qwiic oled leads me to believe that this is not a connection issue... However, I am a beginner to these things so I may be wrong. Please let me know if I should provide more information

The error is as follows for $ rosrun jetbot_ros jetbot_oled.py:

Traceback (most recent call last):
File "/home/jetbot/jbworkspace/catkin_ws/src/jetbot_ros/scripts/jetbot_oled.py", line 43, in
disp.begin()
File "/home/jetbot/.local/lib/python2.7/site-packages/Adafruit_SSD1306/SSD1306.py", line 148, in begin
self._initialize()
File "/home/jetbot/.local/lib/python2.7/site-packages/Adafruit_SSD1306/SSD1306.py", line 292, in _initialize
self.command(SSD1306_DISPLAYOFF) # 0xAE
File "/home/jetbot/.local/lib/python2.7/site-packages/Adafruit_SSD1306/SSD1306.py", line 129, in command
self._i2c.write8(control, c)
File "/home/jetbot/.local/lib/python2.7/site-packages/Adafruit_GPIO/I2C.py", line 114, in write8
self._bus.write_byte_data(self._address, register, value)
File "/home/jetbot/.local/lib/python2.7/site-packages/Adafruit_PureIO/smbus.py", line 268, in write_byte_data
self._device.write(data)
IOError: [Errno 121] Remote I/O error

This is the output when I run $ i2cdetect -y -r 1. Seems like the Nano is able to detect the motor driver and micro oled.

 0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f

00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- 3d -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- 5d -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

@dusty-nv
Copy link
Owner

Hi @asoong98 , I think the SparkFun components may required their own drivers based on Qwiic. I think that because they have their own image for SparkFun JetBot: https://learn.sparkfun.com/tutorials/assembly-guide-for-sparkfun-jetbot-ai-kit/5-software-setup-guide-from-nvidia Although I think they have their own ROS nodes too.

@asoong98
Copy link
Author

Hi @dusty-nv, thanks for the response. I think you're right, my problem is that my version of the Jetbot uses the Qwiic connectors. I've reflashed my SD card with the SparkFun image, but the jetbot_ros library that they have preinstalled is yours, which is written for Adafruit. Do you happen to know of any Qwiic alternatives? I'll also follow up with SparkFun and see what they say.

Thanks!

@blackout85
Copy link

Hey @asoong98 @dusty-nv ,

I'm encountering this same error. I found a thread on Sparkfun's forums about it here:
https://forum.sparkfun.com/viewtopic.php?f=107&t=54647

Here's the repo they say you need:
https://github.com/sparkfun/Qwiic_SCMD_Py

If you open up this package you'll see that there's a python node seemingly comparable to the jetbot_motors.py node. I've still been struggling with getting this to work for me. I cloned this repo as well as another dependency that was required which is also mentioned on the same page, into my ~/catkin_ws/src. I then performed catkin_make and sourced my devel space before trying to rosrun the proper node from this sparkfun package and I got a "rospack: error no package by that exists" error. I played around by using the rospack command to find the jetbot_ros package and it worked so now I'm mystified completely haha. But maybe we can all put our heads together and figure it out?

@santaimpersonator
Copy link

@asoong98 There is a fork of this repo, for the SparkFun hardware: https://github.com/sparkfun/jetbot_ros

I originally, didn't put in changes for the OLED display because the code from the jetbot repo would be running as a background service, on our custom images anyways. Also, having two different sets of code controlling the screen caused issues.

I just started a new branch to allow for the use or either of the Adafruit or SparkFun recommended hardware: https://github.com/sparkfun/jetbot_ros/tree/update-hardware_scan

@blackout85
Copy link

blackout85 commented Jun 25, 2021 via email

@santaimpersonator
Copy link

Well, after testing a debugging a bunch. SparkFun can't provide support for the OLED display with Jetbot ROS.

Unfortunately, Jetbot ROS relies on Python 2, which breaks the utilization of the OLED Python package functionality at multiple points. Our package was intended to be utilized with Python 3, since Python 2 has long been deprecated.

  • I did my best with a workarounds for the various errors, but now I am at the point where the package just isn't compatible with this implementation.

That being said, tying in the Qwiic SCMD package was straight forward and the code appears to work with our hardware. Currently, I don't have an Adafruit Motor HAT to test. If someone could verify the functionality, that would be awesome. Then I can submit a pull request.

To test the new code implementation, checkout this branch of our repo:

  • git clone -b update-hardware_scan https://github.com/sparkfun/jetbot_ros
  • If anyone finds a way to get Jetbot ROS to work with Python 3, let me know.

@blackout85
Copy link

blackout85 commented Jun 28, 2021 via email

@santaimpersonator
Copy link

santaimpersonator commented Jun 28, 2021

Our kit uses a different motor driver and OLED display, so the code needs to support the different hardware.

The fork I created provides support for the motor driver. There is no support for the OLED due to the Python 2 issues.

You will also need to install the Python package for the motor driver in the SparkFun kit: sparkfun@dc782f6

  • pip install sparkfun-qwiic

@alanyuchenhou
Copy link
Contributor

@santaimpersonator Your PR #42 is very helpful. However, it is based on an older version (ros1 without docker) and could not merge. Let me add support for sparkfun jetbot to the current version (ros2 with docker).

@santaimpersonator
Copy link

@alanyuchenhou Thanks for doing that. I'll close my pull request (#42).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants