With ROS 2 Humble setup, run
Copy sudo apt install ros-humble-gazebo-ros-pkgs
Workspace Setup
Create workspace folder
Copy 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.
Copy git clone https://github.com/ros/ros_tutorials.git -b humble-devel
Resolve dependencies
Copy cd ~/Desktop/test_ws/
rosdep install -i --from-path src --rosdistro humble -y
Build the workspace
If the above error occurs when building turtlesim, run
Copy pip install empy
pip install lark
and then rebuild
Copy rm -rf ~/Desktop/test_ws/build/
rm -rf ~/Desktop/test_ws/install/
colcon build
The fix method above is found here .
Source the workspace
Copy source ~/Desktop/test_ws/install/setup.bash
RVIZ Setup
Copy 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.
Copy cd ~/Desktop/test_ws/src/
ros2 pkg create --build-type ament_cmake two_wheeled_robot
Create some extra folders
Copy cd ~/Desktop/test_ws/src/two_wheeled_robot/
mkdir config launch maps meshes models params rviz urdf worlds
Build the package
Copy cd ~/Desktop/test_ws/
colcon build
Copy colcon_cd two_wheeled_robot
URDF