@JerryNing --license Apache-2.0

首先用 VS Code 打开主目录下的 chapt2 文件,并打开集成终端,输入如下命令:

ros2 pkg create demo_python_pkg --build-type ament_python --license Apache-2.0 --- going to create a new package package name: demo_python_pkg destination directory: /home/fishros/chapt2 package format: 3 version: 0.0.0 description: TODO: Package description maintainer: ['fishros <fishros@todo.todo>'] licenses: ['Apache-2.0'] build type: ament_python dependencies: [] creating folder ./demo_python_pkg creating ./demo_python_pkg/package.xml creating source folder creating folder ./demo_python_pkg/demo_python_pkg creating ./demo_python_pkg/setup.py creating ./demo_python_pkg/setup.cfg creating folder ./demo_python_pkg/resource creating ./demo_python_pkg/resource/demo_python_pkg creating ./demo_python_pkg/demo_python_pkg/__init__.py creating folder ./demo_python_pkg/test creating ./demo_python_pkg/test/test_copyright.py creating ./demo_python_pkg/test/test_flake8.py creating ./demo_python_pkg/test/test_pep257.py

上述命令中ros2 pkg create是 ROS 2 命令行工具 pkg 模块下,用于创建功能包的命令 demo_python_pkg是功能包的名字,后面--build-type ament_python用于指定功能包的构建类型为ament_python,最后的--license Apache-2.0用于声明功能包的开源协议。