当前位置:网站首页>[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. ︎
边栏推荐
猜你喜欢
随机推荐
第八单元 中间件
drf路由组件Routers
网络安全第一次作业(2)
rpm包的卸载与安装[通俗易懂]
你接受不了60%的暴跌,就没有资格获得6000%的涨幅 2021-05-27
不精确微分/不完全微分(Inexact differential/Imperfect differential)
政策利空对行情没有长期影响,牛市仍将继续 2021-05-19
The world's largest Apache open source foundation is how it works?
第二届中国Rust开发者大会(RustChinaConf 2021~2022)线上大会正式开启报名
如何解决1045无法登录mysql服务器
The most complete ever!A collection of 47 common terms of "digital transformation", read it in seconds~
第十四单元 视图集及路由
瑞吉外卖笔记——第08讲读写分离
【Tensorflow】AttributeError: '_TfDeviceCaptureOp' object has no attribute '_set_device_from_string'
动手学ocr(一)
配置zabbix自动发现和自动注册。
Flask-RESTful请求响应与SQLAlchemy基础
此次519暴跌的几点感触 2021-05-21
Diodes and their applications
Gstreamer Plugin注册流程详解