The f1tenth simulator from f1tenth_gym_ros is containerised to avoid dependency issues and to shortcut setup.
Ubuntu 20.04
- Clone repository and submodules
git clone --recursive https://github.com/NTU-Autonomous-Racing-Team/f1tenth_simulator.git
- Build Dockerfile
Builds an image from the f1tenth_gym_ros.Dockerfile and tag it as f1tenth:gym_ros_foxy
sudo docker build -f f1tenth_gym_ros.Dockerfile -t f1tenth:gym_ros_foxy .
- Install dependencies (WIP i.e. SKIP THIS STEP)
sudo apt install -y python3-pip ros-foxy-ackermann-msgs
git clone https://github.com/f1tenth/f1tenth_gym
cd f1tenth_gym && pip3 install -e .
sudo apt install ros-foxy-navigation2
sudo apt install ros-foxy-nav2-bringup
sudo apt install ros-foxy-xacro
sudo apt install ros-foxy-joint-state-publisher
sudo rosdep init
rosdep update
rosdep install -i --from-path src --rosdistro foxy -y
- Start the container to colcon build (only run once when repo is first cloned)
./run_gym_ros.sh
- Start container to start the Rviz simulator
./run_gym_ros.sh
- Open the
./simulator/sim_ws/src/config/sim.yamlfile in a text editor e.g. vim, nano, vscode, ... - Change the
map_pathundermap_parametersto the path of the desired map.
- Copy the
map.pngandmap.yamlinto./simulator/sim_ws/src/maps - Change the directory in
./simulator/sim_ws/src/config/sim.yaml
# map parameters
map_path: '/sim_ws/src/f1tenth_gym_ros/maps/<new_map>'
- Test if topic are publishing
- Test:
ros2 topic list - Expected:
root@f1tenth_gym_ros:/# ros2 topic list /clicked_point /clock /cmd_vel /drive /ego_racecar/odom /ego_robot_description /goal_pose /initialpose /joint_states /map /map_server/transition_event /map_updates /parameter_events /rosout /scan /tf /tf_static
- Test:
- If you face a cmake cache issue, remove the generated files in the
f1tenth_ws-
rm -rf build install log -
colcon build --packages-select <package name>
-