Workspace - dhanushshettigar/Getting-Started-With-ROS2 GitHub Wiki
ROS 2 Workspace Setup
What is a ROS 2 Workspace?
A ROS 2 workspace is a directory where ROS 2 packages are built and stored. It contains all the code, dependencies, and build artifacts required for developing and running your ROS 2 applications.
To start building nodes and packages, you first need to set up a workspace.
Steps to Create a ROS 2 Workspace:
1. Create the Workspace Directory
First, open a terminal and create a directory for your workspace. We'll also create a src
folder where the packages will go:
mkdir -p ros2_ws/src
cd ..
2. Build the Workspace
Once the directory is set, use colcon to build the workspace:
colcon build
3. Source the Workspace
After building, source the workspace so that ROS 2 can recognize the packages:
source install/setup.bash
This ensures the workspace is active and ROS 2 is aware of the packages in this workspace.
4. Adding Packages
Now your workspace is ready for adding packages! You can proceed to create packages for nodes, services, or any ROS 2 components.
Conclusion
Setting up a ROS 2 workspace is essential for organizing and building your robotic system's code. With your workspace ready, you can now start adding nodes and developing your ROS 2 applications.