This is the RoboRacer (F1TENTH) repo of the CAVREL Team. The repo has the following components
- The F1TENTH Gym Platform
f1tenth_gym - The simulation environment leveraging the F1TENTH Gym through a ROS bridge
sim_ws - The control software stack for the CAVREL Racer
racer_ws
- Ubuntu 20.04 (Focal Fossa) or Ubuntu 22.04 (Jammy Jellyfish) environment
- ROS 2 Foxy Fitzroy or ROS 2 Humble Hawksbill (Instructions for ROS Foxy - https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html)
- Python 3 (Comes with Ros 2)
-
Update and Upgrade System Packages:
sudo apt update && sudo apt upgrade -
Install Pip for Python 3: (if not already installed)
sudo apt install python3-pip
-
Navigate to the Home Folder or Desired Directory:
cd $HOME
-
Clone the Repository:
git clone https://github.com/f1tenth-ucf/cavrel_racer
This guide walks you through configuring your system to set up the F1Tenth Gym ROS environment 1. This repo also content some control algorithms and some maps as well.
-- Last Tested: 05/13/2025
-
Navigate to the Folder that has the repository:
cd cavrel_racer -
Navigate to the F1Tenth Gym folder:
cd f1tenth_gym -
Install the Python Dependencies For the F1Tenth Gym:
pip3 install -e .
-
Go to the repository parent folder and navigate to the f1tenth_gym_ros folder:
cd sim_ws/src/f1tenth_gym_ros -
Confirm/Update the Map Path Parameter:
-
Open the
sim.yamlfile located in the folder atconfig/sim.yaml. -
Change the map_path parameter to point to the correct location:
-
The maps are in the
mapfolderex:
map_path: "<your_home_dir>/cavrel_racer/sim_ws/src/f1tenth_gym_ros/maps/levine"
-
-
Initialize and Update
rosdep:If you have not yet initialize rosdep on this machine
sudo rosdep init
For ROS2 Foxy:
rosdep update --include-eol-distros --rosdistro foxy
For ROS2 Humble:
rosdep update
-
Navigate to the Simulation's Top Level Folder
sim_wsand Install ROS Dependencies:For ROS2 Foxy:
rosdep install -i --from-path src --rosdistro foxy -y
For ROS2 Humble:
rosdep install -i --from-path src --rosdistro humble -y
-
Build The Workspace
colcon build
-
Source the ROS 2 Setup Script if not Already Sourced
Replace
.bashwith.shor.zshdepending on your terminalFor ROS2 Foxy:
source /opt/ros/foxy/setup.bashFor ROS2 Humble:
source /opt/ros/humble/setup.bash -
Navigate to the Simulation's Top Level Folder
sim_wsand Source the Local Workspace Setup Script:source install/local_setup.bash -
Run the Simulation Environment
ros2 launch f1tenth_gym_ros gym_bridge_launch.py
An rviz window should pop up showing the simulation
/scan: The ego agent's laser scan
/ego_racecar/odom: The ego agent's odometry
/map: The map of the environment
A tf tree is also maintained.
/drive: The ego agent's drive command via AckermannDriveStamped messages
The keyboard teleop node from teleop_twist_keyboard is also installed as part of the simulation's dependency.
To run it, make sure kb_teleop is set to True in sim.yaml. Open another terminal, run:
ros2 run teleop_twist_keyboard teleop_twist_keyboardThen, press i to move forward, u and o to move forward and turn, , to move backwards, m and . to move backwards and turn, and k to stop in the terminal window running the teleop node.
-
Open a new terminal
-
Source the ROS 2 Setup Script if not Already Sourced
Replace
.bashwith.shor.zshdepending on your terminalFor ROS2 Foxy:
source /opt/ros/foxy/setup.bashFor ROS2 Humble:
source /opt/ros/humble/setup.bash -
Navigate to the top level parent folder of the repository
cavrel_racer -
Go to the
racer_ws -
Build the workspace and source the the packages
colcon build source install/local_setup.bash -
Run the desired control node
ex:
ros2 run gap_follow gap_follow_node
If you are running the simulation and running the gap followind node, you should be able to see the car moves in the simulation
Footnotes
-
Those set of instructions are based on the Installation Instruction for F1Tenth Gym ROS Simulation as of 08/28/2024 ↩