文章目录
- 1.工作空间目录
- 1.1 package.xml
- 2.启动节点的方式
- 2.1 一次启动一个
- 2.2 一次启动多个
- 3.ROS常用命令
- 3.1 增
- 3.2 查
- 3.3 执行
- 3.3.1 加载环境变量
- 3.3.2 运行节点
- 3.4 查看计算图
- 4.创建功能包
- 4.1 选择工作目录
- 4.2 创建功能包目录
- 4.3 建立功能包
1.工作空间目录
1.1 package.xml
- 固定格式
2.启动节点的方式
2.1 一次启动一个
- executable file:对于C语言,这个文件就是CMakeLists.txt中用add_executable生成的可执行文件;对于python,这个文件就是CMakeLists.txt中用catkin_install_python指向的文件
对应语法:
2.2 一次启动多个
如果想要一次性启动一个包里的多个节点,而不是一行行地输入rosrun指令…
- 我们需要一个launch文件,它的固定格式是这样的:
- node:包含的某个节点
- pkg:功能包
- type:被运行的节点文件
- name:为节点命名
- output:设置日志的输出目标
然后,在终端输入:
3.ROS常用命令
3.1 增
创建新的ROS功能包:
3.2 查
列出所有功能包:
查找某个功能包是否存在,如果存在返回安装路径:
3.3 执行
3.3.1 加载环境变量
先进入工作目录,然后:
3.3.2 运行节点
roscore
:ROS的系统先决条件节点和程序的集合,必须运行 roscore 才能使 ROS 节点进行通信。新开一个终端并输入:
roscore 将启动:
- ros master
- ros 参数服务器
- rosout 日志节点
3.4 查看计算图
在节点正在运行的情况下,终端输入:
4.创建功能包
4.1 选择工作目录
首先,选择一个路径作为工作目录。这里我选择了如下路径作为工作目录
4.2 创建功能包目录
然后,在工作空间目录下:
src目录下会多出一个锁定的CMakeLists.txt文件,不用管它。
4.3 建立功能包
先进入src目录
然后使用ROS提供的指令直接创建功能包即可:
roscpp、rospy、std_msgs、message_generatio是你所需要的依赖,你可以自由决定想要哪些依赖