dusty-nv / jetson-containers

Machine Learning Containers for NVIDIA Jetson and JetPack-L4T
MIT License
2.36k stars 481 forks source link

Adding adafruit_servokit librabry to exiisting jetson-inference container build #83

Open mmatesic01 opened 3 years ago

mmatesic01 commented 3 years ago

Hi,

I am sucessfully able to use container with vscode so I can write code and test. But existing build hasn't got some libaries that I would like to use. How can I premamnetly add "adafruit_servokit" library to my jetson-inference container build?

Thank you.

dusty-nv commented 3 years ago

I recommend creating your own Dockerfile to install it and using jetson-inference as the base container.

Or you can install it manually, and then use 'docker commit' to save it to a new tag.


From: mmatesic01 @.> Sent: Saturday, August 14, 2021 1:44:16 PM To: dusty-nv/jetson-containers @.> Cc: Subscribed @.***> Subject: [dusty-nv/jetson-containers] Adding adafruit_servokit librabry to exiisting jetson-inference container build (#83)

Hi,

I am sucessfully able to use container with vscode so I can write code and test. But existing build hasn't got some libaries that I would like to use. How can I premamnetly add "adafruit_servokit" library to my jetson-inference container build?

Thank you.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/dusty-nv/jetson-containers/issues/83, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADVEGK7CJCFN2QMGYHFO6QLT42TPBANCNFSM5CFJMY7A. Triage notifications on the go with GitHub Mobile for iOShttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cdustinf%40nvidia.com%7C12e89db90989497d83de08d95f4b23a0%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637645598595445286%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=hGyXOtCXGT7HW8uO2KwI3B9POYWPGFaiSJ6yMCAXbtc%3D&reserved=0 or Androidhttps://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26utm_campaign%3Dnotification-email&data=04%7C01%7Cdustinf%40nvidia.com%7C12e89db90989497d83de08d95f4b23a0%7C43083d15727340c1b7db39efd9ccc17a%7C0%7C0%7C637645598595455280%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=PM8urNsTFWYCZLmzLyY0kzDmywgWoBhcVvCXNQVKn2s%3D&reserved=0.

mmatesic01 commented 3 years ago

Hi again,

1.) I was able to build on your container by adding this to Docker file also based this setup source:

Added to Dockerfile RUN usermod -aG i2c root RUN groupadd -f -r gpio RUN usermod -a -G gpio root RUN pip3 install adafruit-circuitpython-servokit

2.) Also I run container with added --device /dev/i2c-1 in run.sh sudo docker run --runtime nvidia -it --rm --network host --device /dev/i2c-1 -e DISPLAY=$DISPLAY \ -v /tmp/.X11-unix/:/tmp/.X11-unix \ -v /tmp/argus_socket:/tmp/argus_socket \ -v /etc/enctune.conf:/etc/enctune.conf \ $V4L2_DEVICES $DATA_VOLUME $USER_VOLUME \ $CONTAINER_IMAGE $USER_COMMAND

3.) When I run this command "i2cdetect -y -r 1" out or within the container it shows me that PCF9685 controler is visible inside container. 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: 40 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: 70 -- -- -- -- -- -- --

4.) I run this simple code (servos move when I run outside container):

_from adafruit_servokit import ServoKit

_kit = ServoKit(channels=16) pan = 90 tilt = 90

kit.servo[0].angle = pan kit.servo[1].angle = tilt_

5.) But when I run the code inside container, I get the next message: _Traceback (most recent call last): File "/home/marko/Desktop/pyProg/NVIDIA/servotest.py", line 1, in from adafruit_servokit import ServoKit File "/usr/local/lib/python3.6/dist-packages/adafruit_servokit.py", line 35, in import board File "/usr/local/lib/python3.6/dist-packages/board.py", line 33, in from adafruit_blinka.agnostic import board_id, detector File "/usr/local/lib/python3.6/dist-packages/adafruit_blinka/agnostic/init.py", line 18, in chip_id = detector.chip.id File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 350, in getattr if self.id == attr: File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 350, in getattr if self.id == attr: File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 350, in getattr if self.id == attr: [Previous line repeated 320 more times] File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 154, in id self._chip_id = self._linux_id() File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/chip.py", line 235, in linux_id hardware = self.detector.get_cpuinfo_field("Hardware") File "/usr/local/lib/python3.6/dist-packages/adafruit_platformdetect/init.py", line 49, in get_cpuinfofield with open("/proc/cpuinfo", "r") as infile: File "/usr/lib/python3.6/codecs.py", line 309, in init IncrementalDecoder.init(self, errors) RecursionError: maximum recursion depth exceeded

Running this code outside container works. What else am I missing in my container?