#
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
Note: macOS usually comes with Git pre-installed. You can check if it's already installed by typing git --version
in your terminal. If it's not installed, or you want to update it to the latest version, follow the steps below.
Docker: Download Docker Desktop for Mac from the official Docker website. Open the downloaded
.dmg
file and drag Docker.app to your Applications folder.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.
Docker: Download Docker Desktop for Windows from the official Docker website. Follow the installation instructions provided by the installer.
Git: Download the official Git for Windows from the Git website. When you've downloaded the installer, run it and follow the instructions.
WSL Follow this tutorial to enable WSL which will allow running
bash
commands: Using bash natively - Windows
Windows 11 and WSL2
if you run into any errors like execvpe /bin/bash failed 2
:
- run
wsl --install -d Ubuntu
- then
wsl --set-default Ubuntu
- you should then be able to run
bash
and enter the Linux terminal.
If you have issues about \r
not being a known character, delete your f1tenth
folder then clone it again inside the Linux environment.
Note: Most Linux distributions come with Git pre-installed. You can check if it's already installed by typing git --version
in your terminal. If it's not installed, or you want to update it to the latest version, follow the steps below.
Optionally: Linux users can opt to skip Docker steps as the code is already native on Linux distributions. However, it requires downloading any requirements that are handled by the Dockerfile. Advanced users should choose this option.
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
Git: Open a terminal and type the following command:
sudo apt install git
Note: Fedora comes with Git pre-installed. You can check if it's already installed by typing git --version
in your terminal. If you want to update it to the latest version, follow the steps below.
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
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:
#
📁 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.
Knowledge check
Experiment with cd {directory}
("Change Directory") to navigate folders.
Keep in mind that ~
signifies your HOME directory (/home/{your name}
on Linux, C:\Users\{your name}
on Windows, and /Users/{your name}/
on Mac). Finally, cd ..
brings you back one 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