当前位置:网站首页>ROS workspace coverage
ROS workspace coverage
2022-07-27 06:19:00 【Three assassins】
The so-called workspace coverage , Refers to... In different workspaces , There are function packages with duplicate names .
ROS In development , The user-defined workspace can be customized, and multiple user-defined workspaces can exist at the same time , There may be a situation : Although function packages in a specific workspace cannot have the same name , However, the function package of the customized workspace and the built-in function package can have the same name, or the function package with the same name can also appear in different customized workspaces , Then when calling the function package with this name , Which one will be called ? such as : Custom workspace A There are function packs turtlesim, Custom workspace B There are also feature packs turtlesim, Of course, the built-in space of the system also exists turtlesim, If the turtlesim package , Which workspace will be called ?
Realization
0. New workspace A And the workspace B, Create function packs in both workspaces : turtlesim.
1. stay ~/.bashrc Under the document Additional Of the current workspace bash The format is as follows :
source /home/ user / route / working space A/devel/setup.bash
source /home/ user / route / working space B/devel/setup.bash
2. New command line :source .bashrc Load environment variables
3. see ROS Environmental variables echo $ROS_PACKAGE_PATH
result : Custom workspace B: Custom space A: System built-in space
4. Call the command :roscd turtlesim Will enter the custom workspace B
reason
ROS Can parse .bashrc file , And generate ROS_PACKAGE_PATH ROS Package path , In this variable, according to .bashrc Set workspace priority in configuration , Certain principles should be followed when setting :ROS_PACKAGE_PATH The value in , and .bashrc The order of configuration is reversed ---> The priority of post configuration is higher , If you change the custom space A And custom space B Of source The order , So when calling , Will enter the workspace A.
Conclusion
When the function package has the same name , According to ROS_PACKAGE_PATH lookup , Priority will be given to those before configuration .
hidden danger
There are safety risks , For example, the current workspace B Higher priority , Means when the program calls turtlesim when , The workspace will not be called A It will not call the built-in turtlesim, If the workspace A There are other function packages that depend on their own turtlesim, And in accordance with ROS Principles involved in workspace coverage , Then the actual execution will call the workspace B Of turtlesim, This leads to execution exceptions , There are potential safety hazards .
BUG explain :
When in .bashrc In file source After multiple workspaces , Possible situations , stay ROS PACKAGE PATH Contains only two workspaces , You can delete a custom workspace build And devel Catalog , again catkin_make, And then reload .bashrc file , Problem solving .
边栏推荐
猜你喜欢

ROS话题名称设置

Non photorealistic rendering (NPR) paper understanding and reproduction (unity) - stylized highlights for cartoon rendering and animation

非重叠矩形中的随机点(力扣每日一题)

多线程CAS、synchronized锁原理 、JUC以及死锁

Simple understanding of network principle

遥感影像识别进展2022/5/5

切线空间以及TBN矩阵

Wireshark IP address domain name resolution

Understand the pointer in a picture

Basic concepts of software testing
随机推荐
软件测试用里篇
Leetcode one question per day 30. Concatenate substrings of all words
Pzk learns string function of C language (1)
[5.20 special] MATLAB, I'm confessing to you
UnityShader-高斯模糊
机器人导航实现
通信机制比较
力扣 110. 平衡二叉树
Thesis writing (harvest)
1 semi automatic crawler
允许或者禁止同时连接到一个non-domain和一个domain网络
Strategies for common locks in multithreading
Non photorealistic rendering (NPR) paper understanding and reproduction (unity) - stylized highlights for cartoon rendering and animation
Solve binary tree (6)
IP核之PLL
多坐标变换
Dynamic planning for solving problems (5)
[Arduino] reborn Arduino monk (1)
Calculation of Huffman tree, code implementation and proof, graphic interpretation
Dynamic planning for solving problems (4)