4.ROS workspace

The ros workspace is a folder used to store ros function packages. It usually ends with ws. Let's create a space named ros_ws as an example to explain how to create a ros workspace.

4.1 Create workspace folder

Take creating the ros_ws space in the ~ directory as an example, and enter in the terminal,

4.2 Create src to store function packages

We create a src folder in the src directory of the workspace to store the function package created later, and enter it in the terminal.

4.3 Initialize workspace

Terminal input,

image-20231023113151509

4.4 Compile workspace

Use the catkin_make command to compile the functions in the entire workspace. You need to compile in the workspace directory,

image-20231023113833236

4.5 Add workspace to environment variables

Add the workspace to the environment variable so that you can find the function package when you open the terminal. Otherwise, you need to source the workspace every time to find the function package and related programs. Enter in the terminal.

Enter the following command to refresh the environment variables or reopen the terminal to take effect. Enter in the terminal,