A beginner's guide to start working with projects based on ROS2 using C++
This reposotory contains useful ROS2 demos.
To run this example without issues, the following environment setup are preferred.
Operating System | UBUNTU 22.04 (Jammy) |
ROS2 Version | ROS2 Humble |
**Note: ** In my case, I have an Ubuntu 22.04 boot on my PC.
ROS2 humble only works well with Ubuntu 22.04. To better follow the installation process
clone this repo at home directory.
cd
git clone https://github.com/kimsniper/ros2.git
Step 1: Follow installation mentioned in the link below:
https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
Step 2: Navigate to /opt/ros/humble. There is a file named setup.bash, this file should be source at bashrc file
Place the text below at the bottom area of .bashrc file
source /opt/ros/humble/setup.bash
Step 3: Install colcon build tool
sudo apt install python3-colcon-common-extensions
Step 4: Source colcon build tool argcomplete
This is to allow colcon build to have autocompletion. Place the text below at the bottom area of .bashrc file
source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash
Step 5: In home directory create the workspace directory and under it, create src directory. Then inside the workspace directory, run the following command
colcon build
Step 6: An additional three directories will be created inside the workspace. Navigate inside install directory and there will be a setup.bash file \
Be sure to source it everytime a new terminal windows is opened
OR
Place the text below at the bottom area of .bashrc file
source ~/ros2/ros2_ws/install/setup.bash
Navigate to the ros2 workspace directory and run the following command.
Build all packages
colcon build
Build specific package
colcon build --packages-select `name_of_package`
See the Colcon Tutorial Link for full steps to configure and build ROS2 packages.
sudo apt install ros-humble-gazebo*
Then source the setup.bash at .bashrc file
source /usr/share/gazebo/setup.bash
sudo apt install ros-humble-joint-state-publisher-gui
sudo apt install ros-humble-xacro
Usage tutorial to every packages is provided in a readme file inside package directories.