# Setup - Introduction

# Welcome to your first AVC - F1Tenth tutorial!

Today, we will master basic terminal commands and establish a robust development environment for our ROS 2 autonomous project.

Before we dive in, we need to set up a few prerequisites. This step is crucial for the smooth operation of our project.
Do not skip this step (unless the libraries are already installed and up-to-date), or you may encounter issues with commands not working.


# 🔨 Prerequisite Installation

# Installing Docker and Git

  1. Docker: Download Docker Desktop for Mac from the official Docker website. Open the downloaded .dmg file and drag Docker.app to your Applications folder.

  2. Git: If you have Homebrew installed, open your terminal and type the following command:

    brew install git

    If you don't have Homebrew installed, you can install it first by following the instructions on the Homebrew website.

  1. Docker: Download Docker Desktop for Windows from the official Docker website. Follow the installation instructions provided by the installer.

  2. Git: Download the official Git for Windows from the Git website. When you've downloaded the installer, run it and follow the instructions.

  3. WSL Follow this tutorial to enable WSL which will allow running bash commands: Using bash natively - Windows

  1. Docker: Open a terminal and type the following commands:

    sudo apt-get update
    sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
    sudo apt-get update
    sudo apt-get install docker-ce
  2. Git: Open a terminal and type the following command:

    sudo apt install git
  1. Docker: Open a terminal and type the following commands:

    sudo dnf -y install dnf-plugins-core
    sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
    sudo dnf install docker-ce
    sudo systemctl start docker
    sudo systemctl enable docker
  2. Git: Open a terminal and type the following command:

    sudo dnf install git

Remember to check if these programs were installed correctly by typing docker --version and git --version in your terminal. You should see the installed version of Docker and Git respectively.

This and following tutorials are written with a UNIX shell in mind. If you are not in a UNIX shell, some commands are different. Make sure to replace the following:

Bash command Windows command
ls dir
clear cls
rm del
rm -r rmdir
man help
mv move
cat type
vi, emacs, nano edit

# 📁 Step 1: Create a New Folder Structure

Let's start by navigating to your home directory. Open your terminal and enter the commands:

cd ~/

The cd command will change your current directory.


# 📚 Step 2: Clone the Repository

Now, let's clone the tutorial repository from GitHub using the git command.

git clone https://gitlab.msu.edu/canvas/soar/public/f1tenth

This will create a new directory named f1tenth inside your home directory, which will contain all the files for the tutorials.


# 🚀 Step 3: Set Up the Docker Container

Next, navigate to the f1tenth directory, and list the new files that have been added:

cd f1tenth
ls

You should see some scripts (.sh files), a src directory, and other files.

Ensure that you have Docker installed and running. You can verify this by typing:

docker --version

You should see Docker's version number if it's correctly installed. If not, please verify Docker Desktop is running or revisit the installation instructions to ensure Docker is set up correctly.

To get the Docker container up and running, use the provided run_docker.sh script:

bash run_docker.sh

This will build and launch the Docker container needed for the tutorials.

If successful, you should see a prompt that says: {your_name}@{random_stuff}[DOCKER]:/ros2_ws#


# 🧼 Step 4: Prepare the src/ folder.

Next, delete the contents of the src/ directory as we will be setting up the code on our own. You can always refer to the complete codebase here if you get stuck later.

find src/ -mindepth 1 -maxdepth 1 -type d ! -name 'f1tenth_gym_ros' -exec rm -rf {} +

This command will remove all files in src/ except for f1tenth_gym_ros and .gitignore, which is the simulator and some hidden files.


And voilà! You've successfully set up your environment for the F1Tenth tutorials.

Congratulations! 🎉 Now, let's get coding