ROS study notes (2) - Creating ROS workspace & Introduction to function packages

Creating a ROS workspace & Introduction to function packages

1. Work space

Workspace (workspace) is a folder that stores files related to project development. A workspace usually contains four folders:
src: Code Space (Source Space)
build: Compilation Space (Build Space)< a i=3> devel:Development Space install:Install Space

2. Function package

2.1. Introduction

Function package, also known as package, refers to a specific file structure and folder combination. Usually, program codes that implement the same specific function are put into a package, such as camera data collection.

2.2. File structure

  • CMakeLists.txt: Defines the package name, dependencies, source files, target files and other compilation rules of the package, which is an indispensable component of the package;
  • package.xml: Describes the package name, version number, author, dependencies and other information of the package, which is an indispensable component of the package;
  • src: Stores ROS source code, including C++ source code (.cpp) and Python module (.py);
  • include: stores the header file corresponding to the C++ source code;
  • scripts: Stores executable scripts, such as shell scripts (.sh), Python scripts (.py);
  • msg: stores customized format messages (.msg);
  • srv: Stores services in custom formats (.srv);
  • models: stores 3D models of robots or simulation scenes (.sda, .stl, .dae, etc.);
  • urdf: stores the robot model description (.urdf or .xacro);
  • launch: Store launch files (.launch or .xml)
    Usually ROS files are organized in the above form, which is a convention Naming convention is recommended to be followed. Among the above paths, only CMakeLists.txt and package.xml are required, and the remaining paths are determined based on whether the software package is needed.

3. Programming implementation

For a clear explanation of the commands used below, please see my other article "ROS Common Commands".

mkdir catkin_ws
cd catkin_ws/
mkdir src
cd src/
catkin_init_workspace
cd ~/catkin_ws/
catkin_make
source devel/setup.bash

Guess you like

Origin blog.csdn.net/weixin_44415639/article/details/122431586