Gazebo Setup
With ROS 2 Humble setup, run
sudo apt install ros-humble-gazebo-ros-pkgs
Workspace Setup
Create workspace folder
mkdir -p ~/Desktop/test_ws/src
cd ~/Desktop/test_ws/src/
Add pre-existing packages into this folder. We will add the ros_tutorials repository to our workspace. It contains the following packages: roscpp_tutorials, rospy_tutorials, ros_tutorials, and turtlesim.
git clone https://github.com/ros/ros_tutorials.git -b humble-devel
Resolve dependencies
cd ~/Desktop/test_ws/
rosdep install -i --from-path src --rosdistro humble -y
Build the workspace
colcon build

If the above error occurs when building turtlesim, run
pip install empy
pip install lark
and then rebuild
rm -rf ~/Desktop/test_ws/build/
rm -rf ~/Desktop/test_ws/install/
colcon build
The fix method above is found here.

Source the workspace
source ~/Desktop/test_ws/install/setup.bash
RVIZ Setup
sudo apt install ros-humble-joint-state-publisher-gui
sudo apt install ros-humble-xacro
Create a ROS 2 Package
Move to the src (source) folder of your workspace and create the package using the following command.
cd ~/Desktop/test_ws/src/
ros2 pkg create --build-type ament_cmake two_wheeled_robot
Create some extra folders
cd ~/Desktop/test_ws/src/two_wheeled_robot/
mkdir config launch maps meshes models params rviz urdf worlds
Build the package
cd ~/Desktop/test_ws/
colcon build
colcon_cd two_wheeled_robot
URDF
Last updated
Was this helpful?