Outputs from TX2 for host PC programs

Hello,

I am looking to use the TX2 as an embedded system with a host PC. With remote access, I can now run my program on the TX2 and visualize the output in the terminal. However, I would like to now use the output from this TX2 program for a program on the host PC.

In more detail, the TX2 program captures images, performs a face detection, and outputs the coordinates of the face in the terminal. I would now like to use these coordinates for a program on the host PC. What is this concept called? Is this a fast process? Can this be performed through a USB?

Any insight, references, or tutorials welcome.

You could write some TCP network code which isn’t too complicated to do this. Possibly piping through netcat (“man nc” if the package is installed) would do the job. nc is similar to “cat” of a file and redirecting somewhere else, except it uses network addresses for piping/redirecting instead of files and pure stdio.

USB has one host and one device. The end using the USB device is usually the host, the device is something like a keyboard or USB network dongle. Normally a Jetson does not have the ability to be a device, except for recovery mode making it available for flash. The micro-B USB port could be turned into a custom device…the effort would not be trivial. Simple network programming is fairly trivial.

This is typically called a “network service model.”
Typically, you will define a simple protocol. For your case, you could just say that the protocol is “one line per detection event, with zero or more coordinate pairs per line.”
The host would connect to the service, and receive the data. You can use simple TCP sockets for this.
More advanced mechanisms would use some RPC system (remote procedure call) or even try to expose the data over HTTP, but it sounds like that’s actually the wrong approach for your need.

You could do the same thing over USB if you could get the Jetson into Device mode (where it looks like a device to the PC.)
You would want the virtual device of the Jetson to expose either a virtual serial port, which would show up as /dev/ttyXXX (or COM#:) on the host PC, or some custom bulk transfer endpoint, which would have to use libusb (or the Windows 10 equivalent – Windows before 10 don’t have user-level generic USB access.)

I would go the networking path, because it is more flexible, allows multiple hosts to connect to the same device (if you want) and doesn’t depend on the under-documented “on-the-go” USB features of the Jetson.

Most languages (certainly C and Python) have simple tutorials for simple network servers and clients. Your Jetson would be a “server” creating a socket and listen()/accept()/send() to connections on some particular port (pick a number – 1234 is a fine port number for your server ;-) Your host would just call connect() and recv() to receive the data.
You will also want to familiarize yourself with socket() and perhaps getaddrinfo().