ros 2 on arm macs with docker

Setting up the f1tenth_gym_ros simulator on M1/M2/M3 Mac

setup:

Use this link to download docker for apple silicon mac: docker-download

Once docker is installed, ensure it is working by running:

docker --version

then use the following commands to grab the f1tenth_gym_ros repo

clone the simulator repository

git clone https://github.com/f1tenth/f1tenth_gym_ros.git

change directory to this folder

cd f1tenth_gym_ros

open docker desktop and run the following command to setup the container

docker-compose up

after the container is set up, open a new terminal instance (leave the previous one open) and use the following to execute the novnc server for the simulator

docker exec -it f1tenth_gym_ros-sim-1 /bin/bash

Navigate to http://localhost:8080/vnc.html. You should see the noVNC logo with the connect button. Click the connect button to connect to the session.

launching the simulation:

run the following commands in the bash prompt to source the necessary scripts

source /opt/ros/foxy/setup.bash
source install/local_setup.bash

launch the simulator

ros2 launch f1tenth_gym_ros gym_bridge_launch.py

An rviz window with an f1tenth preset will display in the novnc local server

keyboard teleop:

then, run this command to enable the keyboard

ros2 run teleop_twist_keyboard teleop_twist_keyboard

This will enable the keyboard and you can press the shown keys to move the car around