Accessing GPIO from a Noetic Container Error

Hi all,

I am currently working with a jetracer with a jetson nano developer kit. It comes with a servo driver accessing through i2c bus, based on adafruit_servokit, which is only python3 supported.

I also intend to use ROS1 on this and the latest Jetpack it has is 4.5.1. Therefore I turned to using docker containers. And since L4T images, as far as I know, is all 18.04-based. I can’t directly wrap the driver in the ROS node unless I am in ROS noetic.

I know there are other workaround by alternating rospy and I wish to not mess up the libs. So I build a container based on ros:noetic-robot image.

And I pip install Jetson.GPIO library. But when running I got user permission problems and

File "/usr/local/lib/python3.8/dist-packages/Adafruit_Blinka-8.38.0-py3.8.egg/adafruit_blinka/agnostic/", line 21, in <module>
    chip_id =
  File "/usr/local/lib/python3.8/dist-packages/Adafruit_PlatformDetect-3.62.0-py3.8.egg/adafruit_platformdetect/", line 428, in __getattr__
    raise AttributeError()  # Avoid infinite recursion

I assume that in a container, it just failed to detect which platform it is on,
It seems that many previous discussions are based on L4T images. Are there any mature practice on running ROS noetic on Jetson Nano?


Please try this in the container and see if permission issue is not seen:
Jetson Nano permissions for GPIO pins - #8 by lhoang

Hi DaneLL,

Thanks for the reply. So I have this user group and udev rules settings. But it also confuses me that from this image, provided by Nvidia-AI-IOT, the host machine itself does have jetson.GPIO but does not apply 99-gpio.rules at all. And the result of checking

ll /dev/gpiochip*
crw------- 1 root root 254, 0 Apr  2 09:56 /dev/gpiochip0
crw------- 1 root root 254, 1 Apr  2 09:56 /dev/gpiochip1

which I think the user has been in the root group and I confirm that I can send I2C messages (thus control GPIO) in the host without applying such rules.

So I think align the user group may not be doing anything?

After reading this post about can’t access /proc. I tried to replace the Jetson.gpio lib with the one not to access /proc/device-tree/compatible.

And this leads me to the issue that the adafruit libs errors fail to access the CPU info somehow, which works fine on the host. This may just be an adafruit issue and I am still looking for solutions.

Is this still an issue to support? Any result can be shared?

Hi kayccc,

I still have not yet figured it out yet. But I think it is less of a permission problem and more of an adafruit access cpuinfo in the docker, even in the privileged mode. For practical issues, I have to adapt to a workaround.

I follow this post to make the python3 script work in a ROS melodic node. It risks a bit in others, which I plan to put in docker. So basically I do not run hardware assets-related nodes inside the docker to avoid issues.

I may come back and try again to access the GPIO, (essentially for i2c) in the future. I appreciate your help, and please feel free to close this topic if needed. If I figure it out, I will post a new one and link to this one.

Thanks again