Building a ROS 2 package
Packages are basic software units in ROS 2. They are organized in a ROS 2 workspace, where we can build the packages and run the nodes. Creating a ROS 2 workspace is very easy; we can create any number of ROS workspaces in our OS. The main purpose of creating a ROS workspace is to organize a set of packages. For example, if we are working on a navigation project, we can keep all the navigation-related packages inside this workspace. This is a good practice to get into to organize the robot packages.
There are two types of workspaces in ROS 2. First is the base workspace, which refers to the ROS 2 installation itself. We are adding the source /opt/ros/<distro>/setup.bash
command in the ~/.bashrc
file to source the base workspace. If the base workspace is not sourced, the core ROS packages and tools will not be visible in the terminal. The next type of workspace is an overlay workspace. These are user-created workspaces. Once created, you can build...