Robotics StackExchange | Archived questions

Doubt regarding creating a workspace - ROS2 Humble

Hello,

I am new to ROS and I am following the ROS2 Humble documentation and have a doubt regarding workspace creation.

On this tutorial (http://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Colcon-Tutorial.html) I was asked to create a workspace with the name 'ros2_ws'.

In the next tutorial (http://docs.ros.org/en/humble/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html) the idea is to create another workspace, but the same name 'ros2_ws' was used again in creating the workspace.

So I am a bit confused on what to do now. I currently have a workspace with the name 'ros2_ws' and it was sourced already by appending the .bashrc file.

Thank you

Asked by vinay97 on 2023-05-17 01:50:42 UTC

Comments

Answers

In the tutorials you mentioned, the workspace name 'ros2_ws' is used as an example, but you can actually choose any name for your workspace. The name 'ros2_ws' is just a convention commonly used to represent a ROS 2 workspace.

Since you have already created a workspace with the name 'ros2_ws' and sourced it in your .bashrc file, you can continue using that workspace for your ROS 2 development. There is no need to create another workspace with the same name.

You can source it by going opening the terminal and navigating to the work space directory by using cd command.

You can source it by :

source devel/setup.bash

Or else,

You can also add this command to bash.rc file, to avoid sourcing every time.

The purpose of a workspace in ROS is to provide a directory structure where you can organize your ROS packages. As long as you have a workspace and you have sourced it correctly, you can start creating and working with ROS packages within that workspace.

If you need to create additional workspaces in the future, you can choose different names to avoid any confusion. It's also a good practice to give your workspaces descriptive names related to the projects you're working on.

I hope this clarifies your doubt. If you have any more questions, feel free to ask!

Asked by Ranjit Kathiriya on 2023-05-17 02:57:23 UTC

Comments

Hi, thanks for the response. Sorry but it is still not clear to me.

I created 'ros2_ws' using the first tutorial (first link). But in the second tutorial, it was mentioned that we are creating a new workspace as an overlay on the first workspace (which is the ROS installation workspace that has already been created). Please correct me if I interpreted this the wrong way. If what I think is right, please let me know what can be done now.

Thanks

Asked by vinay97 on 2023-05-17 05:55:27 UTC

I created 'ros2_ws' using the first tutorial (first link).

You can use GUI Files and view it in the Home directory you can be able to see the folder.

But in the second tutorial, it was mentioned that we are creating a new workspace as an overlay on the first workspace (which is the ROS installation workspace that has already been created).

If you have created the same directory on a specific place in my case in the Home directory you will get an error message saying

mkdir: cannot create directory ‘ros2_ws’: File exists

So, I think that you may have created both work space in different location or may be creating a folder inside ros2_ws.

Asked by Ranjit Kathiriya on 2023-05-17 06:39:11 UTC