ROS create workspace and package


ROS create workspace and package

1. Introduction

workspace is a folder, containing relative files and folder

  • src: Source Space
  • build: Build Space
  • devel: Development Space
  • install: Install Space

example

image-20220529201346535

2. create workspace

create workspace

1
mkdir -p ~/catkin_ws/src
1
cd ~/catkin_ws/src
1
catkin_init_workspace

compile the workspace

1
cd ~/catkin_ws/ # go back to the workspace root
1
catkin_make
1
catkin_make install

setup the environment variable

1
source devel/setup.bash
1
echo $ROS_PACKAGE_PATH # check environemnt variable

3. create package

1
cd ~/catkin_ws/src # go to src folder under your root folder
1
catkin_create_pkg <package_name> [depend1] [depend2] [depend3]

example

1
catkin_create_pkg test_pkg roscpp rospy std_msgs

compile the package

1
cd ~/catkin_ws # go back to root folder again
1
source ~/catkin_ws/devel/sessssstup.bash

Author: Liang Junyi
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Liang Junyi !
  TOC