当前位置:网站首页>ROS learning 1- create workspaces and function packs
ROS learning 1- create workspaces and function packs
2022-07-05 08:45:00 【m0_ forty-six million ninety-three thousand eight hundred and t】
One 、 Workspace concept
stay ros Workspaces in are collectively referred to as workspace, It is used to store the relevant documents you need for a project development , stay ros It is a folder with empty seat space .
This folder usually contains 4 Subfolders ;
src: Used to store function packs
build( Compilation space ): It is used to store binary files generated during compilation
devel( Development space ): The executable generated after compilation , Everything generated by the final compilation will eventually run here
install( Installation space ): use install The results of successful installation of instructions are placed here
Two 、 The process and instructions for creating a workspace are as follows :
2.1 Create workspace process
1、 Create a workspace
Create a folder , Then create a... In the folder src A folder ( Here you need to pay attention to the name of the workspace. You can go anywhere , But in the workspace src The name cannot be changed , Because the above introduction says src It is used to store function packs , In the future ros I will use it at work src This path goes to your Feature Pack )
Give the folder you just created the nature of the workspace , stay src Input command in :catkin_init_workspace
2、 Compile workspace
Compiled to make ros I know there is such a workspace , You can find it in the future :catkin_make( But here we need to pay attention to compiling under the main directory of the workspace )
The compiled results will be placed in build and devel Under the folder , So you will see that these two folders will be automatically generated after you compile
Finally, let me explain , because install Folders are not commonly used in our development process , and ros2 hold install and delve The contents of the document have been merged , So don't care about it . But if you want this folder, you can create it yourself : In the workspace main directory :catkin_make install that will do
The overall code is as follows
Create a workspace
midir -p ~/catkoin_ws/src
cd ~/catkin_ws/src
catkin_init_workspace
Compile workspace
cd ~/catkin_ws/
catkin_make3、 ... and 、 Create Feature Pack
ROS Of Catkin A feature of the compiling system is to make the program package ( be called catkin package perhaps ROS package) In the form of , It can be understood as modularization .
The process of creating a function package is as follows ;
1、 Create Feature Pack :
catkin_create_pkg < Function report name > Dependencies 1 Dependence 2...( When creating a function package, you should create it in the workspace src Create under directory )
2、 Compile function packs : take c++ And other high-level languages to compile the code into a language that the machine can see and understand
catkin_make( To compile in the workspace home directory )
3、 Configure workspace environment variables : What is environment variable ? Easy to understand explanation 「 What exactly is an environment variable ?」| Code | Chihokyo BLOG | Wangcai's blog What this website says is quite clear ( After reading it, my understanding is : When the system runs a program or instruction , Sometimes you need to use its path , And when you don't tell the specific path , Then it will be in PATH Looking for , So some software needs your command path .)
source ~/catkin_cs/devel/setup.bash
notes : After compilation, you must use source Command to refresh the workspace environment , When you first learn, you may think , Do it once in the workspace source Then it will be done once and for all, and it will not be used in the future source 了 , This view is wrong . The fact is that , Every time catkin_make after , To carry out source, But if you are afraid of forgetting , You can also set up a method for this workspace once and for all :
stay home Next , Hidden files found .bashrc(ctrl+h Can show hidden files ), Then add in the last line that you should always source Instructions , for example source /home/ Your username /catkin_ws/devel/setup.bash, Keep it .bashrc file , Then restart the terminal , Let the settings just take effect .
for example :
cd ~/catkin_ws/src
catkin_create_pkg test_pkg std_msgs rospy roscpp
cd ~/catkin_ws
catkin_make
source ~/catkin_ws/devel/setup.bashamong :std_msgs yes ros About message dependency ,rospy python Dependence ,cpp yes c++ Dependence
边栏推荐
- 每日一题——输入一个日期,输出它是该年的第几天
- 某公司文件服务器迁移方案
- Warning: retrying occurs during PIP installation
- 287. 寻找重复数-快慢指针
- [牛客网刷题 Day4] JZ32 从上往下打印二叉树
- How to manage the performance of R & D team?
- Infected Tree(树形dp)
- Example 004: for the day of the day, enter a day of a month of a year to judge the day of the year?
- Apaas platform of TOP10 abroad
- 整形的分类:short in long longlong
猜你喜欢
随机推荐
js异步错误处理
Run menu analysis
2022.7.4-----leetcode.1200
猜谜语啦(8)
C# LINQ源码分析之Count
Pytorch entry record
An enterprise information integration system
Halcon blob analysis (ball.hdev)
Go dependency injection -- Google open source library wire
Halcon affine transformations to regions
Bit operation related operations
[daily training] 1200 Minimum absolute difference
How to manage the performance of R & D team?
Lori remote control LEGO motor
[牛客网刷题 Day4] JZ32 从上往下打印二叉树
【日常训练】1200. 最小绝对差
Yolov4 target detection backbone
golang 基础 —— golang 向 mysql 插入的时间数据和本地时间不一致
【日常训练--腾讯精选50】557. 反转字符串中的单词 III
UE pixel stream, come to a "diet pill"!








