总结使用rosrun无法运行python文件的可能的小细节
- 没有给python文件以可运行权限
python文件可以运行,但是使用rosrun显示该文件不是一个可执行的文件,这是由于该文件没有给可执行权限。使用
chmod +x hello.py
即可
- 说明流程
对整个流程进行一个简单的说明
- 使用catkin_create_pkg name dependency创建对应的工作包,注意后面的依赖加上,防止后续修改
- 在CMAKELISTS文件中,添加python的文件,如下图:
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
catkin_install_python(PROGRAMS
scripts/ros_depth.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)