代码在ROS中的组织方式:
1.C++
|—CmakeLists.txt #Package的编译规则
|—package.xml #Package的描述信息
|—src/ #源代码文件
|—include/ #C++头文件
|—scripts/ #可执行脚本
|—msg/ #自定义消息
|—srv/ #自定义服务
|—models/ #3D模型文件(.sda, .stl, .dae等)
|—urdf/ #urdf文件(.urdf或.xacro)
|—launch/ #launch文件
2.Python
|—CmakeLists.txt #Package的编译规则
|—package.xml #Package的描述信息
|—setup.py
|—src/your_package/__init__.py modulefiles.py #Python modules exported as libraries or used in your nodes
|—nodes/ #installable Python nodes go here
|—scripts/ #可执行脚本
|—msg/ #自定义消息
|—srv/ #自定义服务
|—models/ #3D模型文件(.sda, .stl, .dae等)
|—urdf/ #urdf文件(.urdf或.xacro)
|—launch/ #launch文件
__init__.py的作用:
__init__.py文件的作用是将文件夹变为一个Python模块, Python中的每个模块的包中都有该文件。
CMakeLists.txt
和package.xml
是必须的,其余路径根据软件包是否需要来决定。