Adapted from Christina’s notes:

JupyterHub Documentation

https://chatgpt.com/share/6442001c-e9a9-402f-9e39-6e41a7f423ef

Setup Multipass: (Optional for testing)

# In local terminal - this is the Ubuntu VM
multipass launch 22.04 -n "<name>" -d 30GB -m 4G
multipass shell <name>

# If you need to increase the resources later 
multipass stop <name>
multipass set local.<name>.memory=4G
multipass set local.<name>.disk=30G
multipass start <name>
multipass shell <name>

Prepare for Install:

# In Ubuntu environment
sudo apt update && sudo apt full-upgrade -y 
sudo apt install net-tools
ifconfig # identify IP address e.g. 10.211.55.4, will be the address of hub

# Required dependencies
sudo apt install -y \\
 python3 \\
 python3-dev \\
 git \\
 curl \\
 net-tools \\
 gnupg \\
 lsb-release \\
 build-essential \\
 cmake

Install TLJH:

# TLJH JupyterHub
sudo apt install python3 python3-dev git curl -y
curl -L <https://tljh.jupyter.org/bootstrap.py> | sudo -E python3 - --admin <admin-user-name> # Replace <admin-user-name> with first admin user

# Restart the hub
sudo tljh-config reload

# Show hub settings
sudo tljh-config show

Configure Hub Settings

Install ROS2:

Prepare For Install:

# Make sure you have a locale which supports UTF-8.
locale  # check for UTF-8
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
locale  # verify settings

# First ensure that the Ubuntu Universe repository is enabled.
sudo apt install software-properties-common
sudo add-apt-repository universe

# Now add the ROS 2 GPG key with apt.
sudo apt update && sudo apt install curl -y
sudo curl -sSL <https://raw.githubusercontent.com/ros/rosdistro/master/ros.key> -o /usr/share/keyrings/ros-archive-keyring.gpg

# Then add the repository to your sources list.
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] <http://packages.ros.org/ros2/ubuntu> $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null

Install ROS2:

sudo apt update
sudo apt upgrade

sudo apt install ros-humble-desktop
sudo apt install ros-humble-ros-base

echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
echo "export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp" >> ~/.bashrc
echo "export RMW_IMPLEMENTATION=rmw_fastrtps_cpp" >> ~/.bashrc
source ~/.bashrc

Install UR ROS2 Driver

sudo apt-get install ros-humble-ur

Setup Environment:

# Identify environmental variables
# In order to set the required variables (e.g. path to ROS files, etc.) in TLJH, need to look at what's set in Ubuntu
printenv

# These are the relevant variables for ROS IRON
ROS_VERSION=2
ROS_PYTHON_VERSION=3
AMENT_PREFIX_PATH=/opt/ros/humble
PYTHONPATH=/opt/ros/humble/lib/python3.10/site-packages
LD_LIBRARY_PATH=/opt/ros/iron/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib/aarch64-linux-gnu:/opt/ros/humble/lib
ROS_LOCALHOST_ONLY=0 
PATH=/opt/ros/humble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
ROS_DISTRO=humble
RMW_IMPLEMENTATION=rmw_fastrtps_cpp

# Setup config file for TLJH
sudo -i
cd /opt/tljh/config/jupyterhub_config.d/
nano my_config.py

c.Spawner.environment = {
'LD_LIBRARY_PATH': '/opt/ros/humble/opt/rviz_ogre_vendor/lib:/opt/ros/humble/lib/aarch64-linux-gnu:/opt/ros/humble/lib',
'AMENT_PREFIX_PATH': '/opt/ros/humble',
'PYTHONPATH': '/opt/ros/humble/lib/python3.10/site-packages',
'PATH': '/opt/ros/h
umble/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin',
'ROS_VERSION':'2',
'ROS_PYTHON_VERSION':'3',
'ROS_LOCALHOST_ONLY':'0', # outdated
'ROS_DISTRO':'humble',
'RMW_IMPLEMENTATION':'rmw_fastrtps_cpp'
}

Create New Kernel