当前位置:网站首页>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_make
3、 ... 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.bash
among :std_msgs yes ros About message dependency ,rospy python Dependence ,cpp yes c++ Dependence
边栏推荐
猜你喜欢
【NOI模拟赛】汁树(树形DP)
Explore the authentication mechanism of StarUML
Yolov4 target detection backbone
Halcon: check of blob analysis_ Blister capsule detection
Halcon shape_ trans
Guess riddles (2)
Business modeling | process of software model
Pytorch entry record
资源变现小程序添加折扣充值和折扣影票插件
Agile project management of project management
随机推荐
js异步错误处理
kubeadm系列-00-overview
MPSoC QSPI Flash 升级办法
Old Wang's esp8266 and old Wu's ws2818 light strip
Program error record 1:valueerror: invalid literal for int() with base 10: '2.3‘
2022.7.4-----leetcode. one thousand and two hundred
Basic number theory -- Euler function
Shift operation of complement
每日一题——替换空格
容易混淆的基本概念 成员变量 局部变量 全局变量
深度学习模型与湿实验的结合,有望用于代谢通量分析
Esphone Feixun DC1 soft change access homeassstant
Bit operation related operations
Run菜单解析
Redis implements a high-performance full-text search engine -- redisearch
Example 006: Fibonacci series
Chapter 18 using work queue manager (1)
Halcon clolor_ pieces. Hedv: classifier_ Color recognition
【日常训练--腾讯精选50】557. 反转字符串中的单词 III
How to manage the performance of R & D team?