当前位置:网站首页>[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、srcThe 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_workspaceThis 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. ︎
边栏推荐
猜你喜欢

The most complete ever!A collection of 47 common terms of "digital transformation", read it in seconds~

The bad policy has no long-term impact on the market, and the bull market will continue 2021-05-19

The world's largest Apache open source foundation is how it works?

跑yolov5又出啥问题了(1)p,r,map全部为0

Diodes and their applications

8580 合并链表

第八单元 中间件

目标检测场景SSD-Mobilenetv1-FPN

logback源码阅读(二)日志打印,自定义appender,encoder,pattern,converter

paddleocr window10初体验
随机推荐
智能指针-使用、避坑和实现
Flask-SQLAlchemy
动态刷新日志级别
【ROS】编译软件包packages遇到进度缓慢或卡死,使用swap
瑞吉外卖笔记——第10讲Swagger
Raft对比ZAB协议
不精确微分/不完全微分(Inexact differential/Imperfect differential)
瑞吉外卖笔记——第08讲读写分离
Configure zabbix auto-discovery and auto-registration.
专访|带着问题去学习,Apache DolphinScheduler 王福政
hsql是什么_MQL语言
如何选择正规的期货交易平台开户?
Sentinel源码(五)FlowSlot以及限流控制器源码分析
rust使用mysql插入数据
Supervision strikes again, what about the market outlook?2021-05-22
Flask项目的完整创建 七牛云与容联云
数据机构---第六章图---图的遍历---选择题
How to solve mysql service cannot start 1069
8580 合并链表
方舟生存进化淘宝面板服务器是怎么一回事?