当前位置:网站首页>[ROS] (01) Create ROS workspace
[ROS] (01) Create ROS workspace
2022-08-02 14:18:00 【CynalFly】
Articles are only study notes during personal study,主要参考ROS教程1.
1. 创建catkin工作空间
CatkinA workspace is a folder,可以在其中修改、构建和安装 catkin 包.
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make
在运行上述命令后,在catkin_wsunder the workspacebuild
、devel
、src
The three directory folders(这3个catkinBuild system default).
build
(Build Space):catkin(CMake)cache information and other middlewaredevel
(Development Space):生成目标文件(包括头文件、动态链接库、静态链接库、可执行文件等)、环境变量src
(Source Space):ROS的catkin软件包(源码)
Tips:Some of the earlier tutorials remain
catkin_init_workspace
This initialization command,它的作用就是在catkin_ws
工作空间的src
目录下创建CMakeLists.txt
文件.但实际上catkin_make
命令包含了catkin_init_workspace
,No need to call again(当然你也可以使用,没有任何影响).
接下来设置环境变量,首先source
一下新生成的setup.*sh
文件(在develYou can see a few in the directorysetup.*sh
):
source devel/setup.bash
But the above command only works on the current terminal,This results in the need to open a new terminal every timesource
命令一下,Refresh environment variables,才能使用ROS相关命令.解决办法是,在终端中输入如下命令,So every time you open the terminal,.bashrc
会自动运行:
echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc
我们用 vi 编辑器打开 ~/.bashrc
文件,在文件的末尾(红色框内)This line is what we addedROS系统的环境变量,The previous line is what we createdcatkin_ws工作空间的环境变量.在终端中输入如下命令:
vi ~/.bashrc
Want to see environment variables,在终端中输入如下命令:
echo $ROS_PACKAGE_PATH
After passing the above command,The display contains those saved withROS软件包的路径,And use colons between each path(:)分隔开来.
路径PATH格式:/home/<
username
>/catkin_ws/src:/opt/ros/<distro
>/share
2. catkin工作空间结构
要查看catkin工作空间的结构,可以使用tree命令,显示文件结构,在终端中输入如下命令:
cd ~/catkin_ws
sudo apt install tree
tree
The displayed structure is shown below:
.
├── build
│ ├── atomic_configure
│ │ ├── env.sh
│ │ ├── local_setup.bash
│ │ ├── local_setup.sh
│ │ ├── local_setup.zsh
│ │ ├── setup.bash
│ │ ├── setup.sh
│ │ ├── _setup_util.py
│ │ └── setup.zsh
│ ├── catkin
│ │ └── catkin_generated
│ │ └── version
│ │ └── package.cmake
│ ├── catkin_generated
│ │ ├──
......
├── devel
│ ├── cmake.lock
│ ├── env.sh
│ ├── lib
│ ├── local_setup.bash
│ ├── local_setup.sh
│ ├── local_setup.zsh
│ ├── setup.bash
│ ├── setup.sh
│ ├── _setup_util.py
│ └── setup.zsh
└── src
└── CMakeLists.txt -> /opt/ros/melodic/share/catkin/cmake/toplevel.cmake
ROS.otg. ROS教程[EB/OL]. 2020-12-22[2022-7-5]. http://wiki.ros.org/cn/ROS/Tutorials. ︎
边栏推荐
猜你喜欢
随机推荐
Flask上下文,蓝图和Flask-RESTful
What are the file encryption software?Keep your files safe
deal!It's July 30th!
The bad policy has no long-term impact on the market, and the bull market will continue 2021-05-19
rpm包的卸载与安装[通俗易懂]
网络安全第五次作业
Geoffery Hinton:深度学习的下一个大事件
泡利不相容原理适用的空间范围(系统)是多大?
[ROS](05)ROS通信 —— 节点,Nodes & Master
logback源码阅读(二)日志打印,自定义appender,encoder,pattern,converter
机器学习——交叉验证法
[ROS](06)ROS通信 —— 话题(Topic)通信
跑跑yolov5吧
[ROS]ROS常用工具介绍(待续)
[ROS](03)CMakeLists.txt详解
The future of financial services will never stop, and the bull market will continue 2021-05-28
Swagger 的使用
drf源码分析与全局捕获异常
ping命令的使用及代码_通过命令查看ping路径
智能指针-使用、避坑和实现