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

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

compile the workspace

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

setup the environment variable

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

3. create package

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

example

catkin_create_pkg test_pkg roscpp rospy std_msgs

compile the package

cd ~/catkin_ws # go back to root folder again
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