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.py
、file2.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
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)