How edit code from another device

Hi, I want to write code from my computer but run on jetson nano via python3 command on the command line.
is there is a way for this?

İt can be from a command like python3 ssh@192.168.1.4:example.py
or I can open code that in jetson from computer with vs code or another thing

All of them acceptable for me. I have bno055 on jetson nano and I want to write a code that uses this sensor on my computer and run on jetson nano without any uploading downloading process.

You can connect to Nano by ssh and edit the file by vim or any other editor in Nano.

1 Like

I will add to the use of ssh which is what you are describing the need for (there are many ways to use ssh)…

If you are on a Linux or UNIX-like system, and talking to the Jetson without the need for a GUI being forwarded, check these examples out (where I am pretending your login name is “name”, and IP address is 192.168.1.4):

ssh name@192.168.1.4 ls
ssh name@192.168.1.4 whoami
ssh name@192.168.1.4 uname -a

Those return the result of a command, but do not stay logged in. You can just “ssh name@192.168.1.4”, and then run commands without it logging out (note that it does not name a command, it only names a login account over ssh).

Does your command require a GUI output? There are two cases for this:

  • Triggering a command on the Jetson which runs on the Jetson monitor.
  • Triggering a command on the Jetson which remote displays to the local PC.

For an ssh command to display to the Jetson’s GUI the “DISPLAY” environment variable must point at the GUI session, and you must have logged via ssh on the account which owns the DISPLAY. Usually that is “:0”, but if this is not correct, then you can go to the GUI and open a terminal, then “echo $DISPLAY” to see what it is (it could for example be “:1” or “:10”). Then, if the GUI program you wish to run is “xterm” (I only use that because it is something present and using the GUI on most every Linux system):

ssh name@192.168.1.4
export DISPLAY=":0"
xterm

For the case of remote display from the text-only Jetson to a separate host PC you would enable ssh forwarding with either the “-X” or “-Y” option (usually one would use “-Y”, but as far as actual result goes, “-X” works too…the difference is in how security is handled…see “man ssh” for a description). Be cautioned though that the GPU used for such a command (and the related graphics libraries) run on the host PC and not on the Jetson. Example:

ssh -Y name@192.168.1.4
xterm

Note that if you set up ssh keys, then you don’t have to use a password if your key is valid for the destination. Commands “just work” without the hassle of always sending a password. I have a single key on my host PC, and have set ssh to accept keys but no other login on several Jetsons. I then put an alias in my “/etc/hosts” to name each Jetson with a short name, and it is trivial and very convenient and secure to do anything with ssh. For example, I have a Jetson NX Xavier aliased as “nx”, and a Jetson AGX Xavier aliased as “xv”, so the following “just works” without passwords or IP addresses:

# See what the kernel release is:
ssh name@xv uname -r
# See what the kernel command line is:
ssh name@nx cat /proc/cmdline
# Shutdown:
ssh name@xv shutdown -h now

If you are interested in setting up keys from a Linux host PC to Jetson just ask.

2 Likes

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