ROS *** 作备忘

ROS *** 作备忘,第1张

基础 *** 作 1.创建工作空间并初始化
mkdir -p custom_ws/src
cd custom_ws
catkin_make
2.进入/custom_ws/src创建ros包并添加依赖
cd src
catkin_create_pkg custom_pkg roscpp rospy std_msgs
3.进入 /custom_ws/src/custom_pkg添加scripts目录并编辑Python文件
cd custom_pkg
mkdir scripts
4.在/custom_ws/src/custom_pkg/scripts下编写Python文件file1.pyfile2.py 5.为Python文件添加可执行权限
chmod +x file1.py
chmod +x file2.py
6.编辑/custom_ws/src/custom_pkg下的 CamkeList.txt文件
catkin_install_python(PROGRAMS
	scripts/file1.py
	scripts/file2.py
	DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
7.进入/custom_ws目录并编译
cd custom_ws
catkin_make
8.执行ROS
#命令行窗口1
roscore

#命令行窗口2
cd custom_ws
source ./devel/setup.bash
rosrun custom_pkg file1.py

#命令行窗口3
cd custom_ws
source ./devel/setup.bash
rosrun custom_pkg file2.py

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/868500.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-13
下一篇 2022-05-13

发表评论

登录后才能评论

评论列表(0条)

保存