This package is intended for the following:
- Ubuntu 24.04
- ROS 2 Jazzy
- Gazebo Harmonic
Important: For the most up-to-date installation instructions, please refer to the official pages:
Make sure to install ros-jazzy-desktop
(which includes RViz2).
-
Enable the Ubuntu Universe Repository:
sudo apt install software-properties-common sudo add-apt-repository universe
-
Add ROS 2 GPG key:
sudo apt update && sudo apt install curl -y sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
-
Add ROS 2 repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
-
Install ROS 2:
sudo apt update sudo apt upgrade sudo apt install ros-jazzy-desktop
-
Install necessary tools:
sudo apt-get update sudo apt-get install curl lsb-release gnupg
-
Add Gazebo repository:
sudo curl https://packages.osrfoundation.org/gazebo.gpg --output /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg] http://packages.osrfoundation.org/gazebo/ubuntu-stable $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/gazebo-stable.list > /dev/null
-
Install Gazebo Harmonic:
sudo apt-get update sudo apt-get install gz-harmonic
-
Source the ROS 2 Environment:
source /opt/ros/jazzy/setup.bash
-
Create a Workspace:
mkdir -p ~/colcon_ws/src cd ~/colcon_ws/src
-
Clone the Repository:
git clone https://github.com/GryphonRacingAI/gra-ros2.git .
-
Install Necessary Tools
sudo apt install -y python3-colcon-common-extensions sudo apt install -y python3-rosdep sudo rosdep init rosdep update
-
Resolve Dependencies:
cd ~/colcon_ws rosdep install -i --from-path src --rosdistro jazzy -y
-
Build and Source the Workspace:
cd ~/colcon_ws colcon build --symlink-install source install/setup.bash
To source the overlays automatically every time you open a new terminal, add the following lines to the .bashrc
script:
source /opt/ros/jazzy/setup.bash
source ~/colcon_ws/install/setup.bash
or simply run the following
echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc
echo "source ~/colcon_ws/install/setup.bash" >> ~/.bashrc
Run the following command so Gazebo can find the vehicle mesh
echo "export GZ_SIM_RESOURCE_PATH=$HOME/colcon_ws/install/simulation/share/" >> ~/.bashrc
then continue in a new terminal.
To run the simulator, run the following commands
ros2 launch simulation dynamic_event.launch.py autostart:=true
This should launch Gazebo Sim, with the acceleration track and ADS-DV vehicle model spawned in.
The following launch arguments are provided for dynamic_event.launch.py
Argument | Description | Options | Default |
---|---|---|---|
event | specifies which track to spawn in based on the dynamic event | acceleration , skidpad , autocross , trackdrive |
acceleration |
autostart | starts the simulation automatically | true , false |
true |
model_file | path to the vehicle model sdf file | Any valid path to vehicle sdf model | hard-coded path |
name | sets the vehicle name in Gazebo | Any valid string | ads_dv |