Jetson Nano - Developer Kit Library Access

Hello there,

I’m working with a a group to program a jetson nano on a per-designed robot sold as “Jetbot”.
I don’t understand why a script ran in CLI works fine but then I try the same script in Jupyterlab and it fails, the same applies for scripts written in Jupyterlab and later tried in CLI. It’s also the same error which indicates the library isn’t there but how does one see it but not the other? Are they accessing different directories? If so is there a way to change this?

Example code below of one that works fine from CLI but not from the lab. The error indicates it doesn’t recognize the GPIO library.

gpio Library
include <JetsonGPIO.h>
import Jetson.GPIO as GPIO
import time

#Pin Definition
trigPin = 11
echoPin = 12

setup GPIO Channel
GPIO.setmode(GPIO.BOARD);
GPIO.setwarnings(False);
GPIO.setup(trigPin,GPIO.OUT);
GPIO.setup(echoPin,GPIO.IN);

GPIO.output(trigPin,False)
time.sleep(2)

try:

    while True:

            GPIO.output(trigPin, True)
            time.sleep(1.0)
            GPIO.output(trigPin, False)

            while GPIO.input(echoPin)==0:
                    pulse_start = time.time()

            while GPIO.input(echoPin)==1:
                    pulse_end = time.time()

            pulse_duration = pulse_end - pulse_start


            distance = pulse_duration * 17150

            print ("Distance: ", distance,"cm")

For JetBot issue, please find more information at Discussions · NVIDIA-AI-IOT/jetbot · GitHub

This may or may not be related, but wanted to warn you about possible differences in command lines.

Under Linux (or any *NIX with an X11 graphics server) there is a possibility of more than one GUI server. When that is the case the software must know which server to talk to. The answer is from the “DISPLAY” environment variable: If the person running the command has a DISPLAY set, and if that person has permission to use that DISPLAY, then this is where the command renders. There are other side-effects.

If you want to know the nuances of GPU remote commands versus local commands, when an X GUI server is involved (including GPU computations which are not graphical), then see:
https://forums.developer.nvidia.com/t/video-output-does-not-show-up-because-opengl-failed-to-create-x11-window-imagenet-camera-failed-to-create-opengl-display/68681/7

As a point of mentioning this, the library required, when associated with a GPU’s X server (whether used for display purposes or used for CUDA computations), must be provided by the system providing the display. Virtual servers are quite different than remote forwarded servers (virtual servers tend to do what you expect, remote forwarding won’t be what you expect in terms of required libraries).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.