当前位置:网站首页>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
边栏推荐
- Example 005: three numbers sorting input three integers x, y, Z, please output these three numbers from small to large.
- Esphone Feixun DC1 soft change access homeassstant
- Halcon affine transformations to regions
- STM32 lights up the 1.8-inch screen under Arduino IDE
- C# LINQ源码分析之Count
- Reasons for the insecurity of C language standard function scanf
- Run menu analysis
- How can fresh students write resumes to attract HR and interviewers
- 12、动态链接库,dll
- Adaboost使用
猜你喜欢

Guess riddles (2)

TypeScript手把手教程,简单易懂

Example 010: time to show

Arduino burning program and Arduino burning bootloader

319. Bulb switch

Example 008: 99 multiplication table

每日一题——替换空格

Example 003: a complete square is an integer. It is a complete square after adding 100, and it is a complete square after adding 168. What is the number?

Pytorch entry record

Example 006: Fibonacci series
随机推荐
图解八道经典指针笔试题
Numpy 小坑:维度 (n, 1) 和 维度 (n, ) 数组相加运算后维度变为 (n, n)
ECMAScript6介绍及环境搭建
Guess riddles (3)
Halcon affine transformations to regions
Pytorch entry record
Example 004: for the day of the day, enter a day of a month of a year to judge the day of the year?
我从技术到产品经理的几点体会
猜谜语啦(10)
golang 基础 —— golang 向 mysql 插入的时间数据和本地时间不一致
Dynamic dimensions required for input: input, but no shapes were provided. Automatically overriding
Lori remote control LEGO motor
696. Count binary substring
Illustration of eight classic pointer written test questions
Business modeling of software model | overview
2022.7.4-----leetcode.1200
EA introduction notes
Guess riddles (5)
Some pitfalls of win10 network sharing
Arrangement of some library files