작성자: 박준규

2023.01.22(일) Happy 설날~

수정 2023.01.28(토) (changed to ROS2 Foxy and Ubuntu 20.04)

https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html

We will be utilizing Multipass to create an Ubuntu 20.04 virtual machine on our Mac. Then we will be installing ROS2 Foxy on our VM.

These steps assume that you already have brew installed: https://brew.sh

  1. Install Multipass:

    brew install --cask multipass
    
  2. Setup an Ubuntu virtual environment:

    multipass launch 20.04 -n ros-foxy -c 4 -m 8G -d 40G
    
  3. We can now connect to the Ubuntu VM using Terminal:

    multipass shell ros-foxy
    
  4. Once logged in, set up a password for the user ubuntu:

    sudo passwd ubuntu
    

    Untitled

  5. The Ubuntu VM currently only supports CLI. To support GUI and for us to RDP into the machine, we will install ubuntu-desktop and xrdp:

    #update APT list
    sudo apt update 
    
    #install Ubuntu Desktop and XRDP
    sudo apt install ubuntu-desktop xrdp
    
  6. Install Microsoft Remote Desktop on your Mac:

    Untitled

  7. To connect to the Ubuntu VM using Microsoft Remote Desktop, we need to know the IPv4 address of the VM.

    In a new Terminal window:

    multipass info ros-foxy
    

    With the IPv4 address known, we can now connect to the Ubuntu VM using Microsoft Remote Desktop.

  8. Now in the Ubuntu VM Terminal, install locales:

    sudo apt update && sudo apt install locales
    
  9. Set locale to UTF-8:

    Verify settings:

    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-8sudo apt update && sudo apt install curl
    sudo curl -sSL <https://raw.githubusercontent.com/ros/rosdistro/master/ros.key> -o /usr/share/keyrings/ros-archive-keyring.gpg
    
    locale
    
  10. Setup Sources

    You will need to add the ROS2 apt repository to your system.

    First ensure that the Ubuntu Universe repository is enabled:

    sudo apt install software-properties-common
    sudo add-apt-repository universe
    

    Now add the ROS2 GPG key with apt:

    sudo apt update && sudo apt install curl
    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
    
  11. Install ROS2 Packages

    Update your apt repository caches after setting up the repositories:

    sudo apt update
    

    ROS2 packages are built on frequently updated Ubuntu systems. It is always recommended that you ensure your system is up to date before installing new packages:

    sudo apt upgrade
    

    Install ROS2:

    sudo apt install ros-foxy-desktop python3-argcomplete
    sudo apt install ros-foxy-ros-base python3-argcomplete
    sudo apt install ros-dev-tools