Skip to content

Communication ‐ Basestation & Rover

Aman Sidhu edited this page Jun 10, 2025 · 12 revisions

How to connect to the Jetson via ssh over Ethernet (Linux)

Jetson IP Address (Ethernet Port): 192.168.1.69

Jetson Username: rover

Jetson Password: mcgillrobotics

Install SSH:

If you do not already have ssh installed, you can install it using the following commands:

sudo apt update
sudo apt install openssh-client

Creating a Static IP address on your local Ethernet Port

In order to communicate with the Jetson, we need to set our device's Ethernet IP address to have the same subnet as the Jetson's Ethernet IP address (subnet: 192.168.1.xxx). The reason we chose (subnet: 192.168.1.xxx) as our subnet is because it needs to match the subnet of the Antenna's router.

Depending if you installed the Desktop or Server version of Ubuntu, you can use one of the two following options to set a static IP address:

Option 1: Setting IP address via GUI

  1. Go to Settings → Network
  2. Click the gear icon next to your Ethernet adapter
  3. Go to the IPv4 tab
  4. Set
  • Method: Manual
  • Address: 192.168.1.xxx You can choose any number for xxx, 0-255, as long as it is not 1 or 10 (Antenna Router at Base Station and Rover, respectively), 69 (Jetson Ethernet Port), or 17 (Raspberry PI 5 Ethernet Port)
  • Netmask: 255.255.255.0
  • Gateway: Leave empty
  1. Click Apply, turn off and on Ethernet connection, and reconnect the Ethernet cable

Option 2: Using terminal

Use

ip a

to find your device's Ethernet interface, should be something like enXXX for example enp3s0 or etho0. Then, run:

nmcli connection show

And you see something like:

NAME                UUID                                  TYPE      DEVICE
Wired connection 1  7c59...                               ethernet  eth0

Note the name of the connection and that corresponds with your ethernet interface that you see ("Wired Connection 1" and "etho0" in this example).

Next, replace the following CHANGE ME's with your device information in the following lines:

  • <CHANGE ME 1>: Name of Connection in double quotes ""
  • <CHANGE ME 2>: Any number 0-255 except 1 or 10 (Antenna Router at Base Station and Rover, respectively), 69 (Jetson Ethernet Port), or 17 (Raspberry PI 5 Ethernet Port)
nmcli connection modify <CHANGE ME 1> \
  ipv4.addresses 192.168.1.<CHANGE ME 2>/24 \
  ipv4.gateway 192.168.1.1 \
  ipv4.dns "8.8.8.8 1.1.1.1" \
  ipv4.method manual

Finally,

nmcli connection down <CHANGE ME 1>
nmcli connection up <CHANGE ME 1>

Test Connection

If not done already, connect an Ethernet cable from the Jetson to your device's Ethernet port. The Jetson has a static IP address set to 192.168.1.69, so to check that everything is configured correctly, simply ping it.

ping 192.168.1.69

If you get responses, you’re connected!

SSH into the Jetson

  • Accept the host key (yes)
  • Enter the Jetson's password: mcgillrobotics
  • You're in!

Bonus and Recommended, SSH without password

Generate SSH key

On your device create a ssh key,

ssh-keygen -t ed25519 -C "auto-ssh"

Press Enter to accept defaults.

Copy SSH key to Jetson

Next, use ssh-copy-id (you'll enter the Jetson's password one time):

ssh-copy-id [email protected]

This adds your public key to the device's ~/.ssh/authorized_keys.

Test Passwordless SSH

You should log in without a password now.

Create a shortcut in SSH config file

In ~/.ssh /, edit or create a config file (literally just named config with no extensions). Then fill it with:

Host jetson
    HostName 192.168.1.69
    User rover
    IdentityFile ~/.ssh/id_ed25519

Now just type: ssh jetson

Control LAN Communication using ROS2

Overview:

ROS2 enables devices on the same LAN to see topics published on different devices on the same network and subscribed to them. We currently use this feature to communicate control commands and receive feedback from our scripts without needing to instantiate any websockets ourselves.

Setup:

  • The Jetson is connected the user's computer via Ethernet

Check connection:

  • From local user:

ping 192.168.1.69

You should be able to see replies from the Jetson, if not, refer to above section on How to connect to the Jetson via ssh over Ethernet (Linux) if your device is not properly setup.

Running ROS2 on machines

Machine 1:

$ ros2 run demo_nodes_cpp talker

Machine 2:

$ ros2 run demo_nodes_cpp listener

Visual Representation

image

Resources:

Info:

This note taken by Ida and Barry during our research on 05/04/2025. While we are trying to proof-of-concept that we can publish and subscribe to a ros topic through LAN. (related to rover issue: https://github.com/mcgill-robotics/rover-2025/issues/73).

Camera Live Stream Communication via WebRTC

Our current camera stream approach utilizes WebRTC, with the relevant code found in our react-ui directory. WebRTC establishes a connection between a Jetson-powered rover (server) and a base station (client), allowing real-time video streaming from the rover's camera to a web-based client application.


📊 Architecture

+--------------------+          HTTP POST /offer           +--------------------+
|                    | <---------------------------------- |                    |
|     Client (UI)    |                                     |    Server (Jetson) |
|  React + WebRTC    | ----------------------------------> |   aiohttp + aiortc |
|                    |           SDP Answer (JSON)         |                    |
+--------------------+                                     +--------------------+
        |                                                            |
        |                   WebRTC Media Stream                      |
        | <========================================================> |
        |                                                            |
  • Server (webrtc.py) Runs on the Jetson device or rover. Captures live video from a camera (/dev/video{id}) and serves it over a WebRTC connection using aiortc.

  • Client (React app) Runs at the base station. Initiates a WebRTC connection by sending an SDP offer to the server, receives the video stream, and displays it in the browser.


🔄 Call Flow

  1. Client sends HTTP POST to the /offer endpoint on the server with an SDP offer.
  2. Server responds with an SDP answer, setting up a WebRTC connection.
  3. Video media stream is transmitted from the server to the client via WebRTC.
  4. (Optional) Data channel can be added for control signaling in the future.

⚙️ Running the Code

✅ Prerequisites

  • Both the rover (server) and the base station (client) must be on the same local network/subnet 192.168.1.XXX. Refer to this guide to setup your laptop to be on the same subnet if you have not already: Communication Setup Guide - Basestation and Jetson
  • You must know the server's IP address to configure the client. The jetson's Ethernet IP address is 192.168.1.69.
  • Chrome browser is required for setting "insecure origins treated as secure" if not using HTTPS.

💻 On the Rover (Server)

  1. Install Python dependencies:

    pip install aiohttp aiortc
  2. In the react-ui directory, navigate to the react-ui/src/services/drive directory

  3. Start up the WebRTC server using:

    python3 webrtc.py
    

💼 On the Base Station (Client)

  1. Navigate to the React app directory in our repo react-ui and install dependencies:

    npm install
  2. Update the client code (basestation) to point to the server's (rover's) IP address in API requests (e.g., http://<ROVER_IP>:8081/offer). At the moment, these are the places to define sever's IP address in the client code:

  • rover25_ws/src/react-ui/src/components/drive/CameraView.tsx Line: 44 and 69
  • rover25_ws/src/react-ui/src/components/drive/ui/WebRTCPlayer.tsx Line: 38
  1. Start the client:

    npm run dev
  2. To open the website, we recommend downloading and using Chromium, as it has fewer problems with firewall-related issues.

  3. Open Chromium and navigate to:

    chrome://flags/#unsafely-treat-insecure-origin-as-secure
    

    Add both the server address (e.g., http://<ROVER_IP>:8081) and the React client address (e.g., http://localhost:3000) to the list.

  4. Navigate to the Dashboard and use the power button in the GUI to initiate a connection. You should now see the camera on through the UI on the camera view:)


🛠️ Notes

  • Cameras are expected to be available under Linux device paths like /dev/video0, /dev/video1, etc.
  • You can double-check that the cameras are detected by running
v4l2-ctl --list-devices

on the jetson..

Clone this wiki locally