Skip to content

Setup (Orin)

manx52 edited this page Jul 23, 2024 · 2 revisions

Prerequisites

Device Minimum Requirements

  • 128 GB SSD NVME

Remove unnecessary packages

sudo apt-get -y purge chromium-browser thunderbird libreoffice* cuda-samples-10-2

# See disk size remaining
df -h

Verify CUDA on Jetson Orin

cd /usr/bin
sudo ./tegrastats

Install useful development tools

# Code dependencies
sudo apt-get install -y python3-pip vim git git-lfs
pip3 install pre-commit
echo "export PATH=/home/$USER/.local/bin:$PATH" >> ~/.bashrc && source ~/.bashrc

Install ROS Noetic ( http://wiki.ros.org/noetic/Installation/Ubuntu )

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
sudo apt install ros-noetic-desktop-full -y
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential -y
sudo rosdep init
rosdep update

Install catkin-tools https://catkin-tools.readthedocs.io/en/latest/installing.html

sudo sh \
    -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" \
        > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y python3-catkin-tools

Setting up source code

Setup your ssh-keys

ssh-keygen # Then keep entering, don't set a password
cd ~/.ssh &&  cat id_rsa.pub # Get contents of public key
# on github > Settings > SSH and GPG Keys > New SSH Key, paste the key

Create a catkin workspace, download the meta repo and its submodules:

mkdir -p ~/catkin_ws/src && cd ~/catkin_ws
catkin init
catkin config --cmake-args -DCMAKE_BUILD_TYPE=Debug # For Debug builds
cd src
git clone --recurse-submodules [email protected]:utra-robosoccer/soccerbot.git

To update and sync the submodules to the latest version of the branch, run this inside the evtol_software folder

git pull
git checkout <desired_branch>
git submodule sync
git submodule update --init --recursive
git-lfs pull
git submodule foreach git-lfs pull

Installation

Installing package dependencies

# Pip dependencies and precommit
cd ~/catkin_ws/src/soccerbot/
pip3 install --upgrade pip
sudo pip3 install -U jetson-stats
pip3 install -r requirements.txt
pre-commit install # Will setup your pre-commit, will format and check all files on commit

# Rosdep dependencies
sudo rosdep init # Only need to do this once
rosdep update
cd ~/catkin_ws/src/soccerbot/
rosdep install --from-paths . --ignore-src -r -y

Running Instructions

Launching Natively

cd ~/catkin_ws
catkin build soccerbot
source ~/devel/setup.bash
roslaunch soccerbot soccerbot.multi.launch

Pull and Run the ARM image for Jetson Nano

docker login -u utrasoccer # Password dckr_pat_r8_EwMV7RmiYNG2VbnculJUqc1w
docker compose -f compose.yaml pull soccerbot_arm64
docker compose -f compose.yaml up soccerbot_arm64

MISC Setup

Add a Configuration for SFTP (Pycharm)

Under Pycharm > Settings > Build, Execution, Deployment, add a SSH connecction

  • Make sure the root path is /home/soccer or the user in the tx2
  • Under Mappings, make sure
    • local path is /home/user name/catkin_ws/src/soccerbot
    • Deployment path /catkin_ws/src/soccerbot
    • Leave web path blank

Now you can right click a file or directory > Deployment > Upload to device

Setup auto ssh on personal computer, this will make it so you don't need to enter the password every time
ssh-copy-id robot1@robot1_ip

Setup Automatic Hotspot

  • Turn off auto connect on other wifi and turn on hotspot autoconnect
sudo nmcli connection modify Techatronic connection.autoconnect no
sudo nmcli connection modify EuroExoticCar connection.autoconnect no
sudo nmcli connection modify Hotspot connection.autoconnect yes

Setup Automatic Connection to Hotspot

  • Create a bash file. sudo nano ~/hotspot.sh and add
#!/usr/bin/env bash
sudo nmcli connection up Hotspot
  • Give permission sudo chmod 755 ~/hotspot.sh

Setup Automatic Wifi

  • Create a bash file. sudo nano ~/wifi.sh and add
#!/usr/bin/env bash
sudo nmcli connection up Techatronic
  • Give permission sudo chmod 755 ~/wifi.sh

Setup Automatic Docker

  • Create a bash file. sudo nano ~/docker.sh and add
#!/usr/bin/env bash
cd ~/catkin_ws/src/evtol_software
docker compose -f compose.yaml up evtol_arm64
  • Give permission sudo chmod 755 ~/docker.sh

Setting up multi-computer system

Ground Station

address  | netmask       | gateway
10.0.0.1 | 255.255.255.0 | 192.168.1.1

Orin

address  | netmask       | gateway
10.0.0.2 | 255.255.255.0 | 192.168.1.1

Px4 6x

address  | netmask       | gateway
10.0.0.3 | 255.255.255.0 | 192.168.1.1
  • Verify that Orin, Ground station and Px4 can communicate on the network.
  • Use ping 10.0.0.2 on RPI and ping 10.0.0.1 on Jetson

Other Instructions

  • Sometimes you need to source ~/.bashrc in a terminal to get it to work
  • To exit gazebo quicker run
# For noetic
sudo gedit /opt/ros/noetic/lib/python3/dist-packages/roslaunch/nodeprocess.py

change these 2 lines

_TIMEOUT_SIGINT  = 1.0 #seconds
_TIMEOUT_SIGTERM = 1.0 #seconds

updater

#!/usr/bin/env bash
cd ~/catkin_ws/src/evtol_software
git stash
git pull
git submodule sync
git submodule update --init --recursive
git-lfs pull
git submodule foreach git-lfs pull
docker compose -f compose.yaml build evtol_arm64

TODO need to do for ftp server

TODO need to do for https://www.xrdp.org/