Debian Package 功能包 | Source Repositories 源代码 |
---|---|
Automatic installation 自动安装 | "Latest" code “最新”代码 |
Stable versions 稳定版本 | Manual compilation 手动编译 |
Prebuilt binaries 预建二进制文件 | Allows code adjustments 允许代码调整 |
Debian:
$ sudo apt install ros-<distro>-package-name
实例:$ sudo apt install ros-foxy-nav2-core
! package_name: nav2_core --> install:ros-foxy-nav2-core
<distro>
/...$ rosdep install --from-paths src --ignore-src --rosdistro foxy -y
$ wget https://raw.githubusercontent.com/ROBOTIS-GIT/turtlebot3/foxy-devel/turtlebot3.repos
$ vcs import src < turtlebot3.repos
Python功能包
$ ros2 pkg create --build-type ament_python --dependencies [deps] --node-name my_node my_package
文件:
CMake功能包
$ ros2 pkg create --build-type ament_cmake --dependencies [deps] --node-name my_node my_package
package.xml
依赖关系
setup.py
实例 (turtlebot_teleop package): 路径: ~/devel_src/src/turtlebot/turtlebot_teleop
setup(
...
entry_points={
'console_scripts': [
'teleop_keyboard =
turtlebot3_teleop.script.teleop_keyboard:main'
],
},
)
安装teleop_keyboard的可执行文件到devel_ws/install/turtlebot3_teleop/lib/ turtlebot3_teleop/。
CMakeLists.txt
定义编译规则。 例如:
主要是 CMake,加上特定于 ament 的内容。
CMakeLists.txt案例:
使用案例:
具体参考colcon官方帮助文档。
Lint 工具:静态检查 Python 或 C++ 源代码的错误和标准合规性。
对于Python功能包
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
对于CMake功能包
<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
ament_lint_auto
: ament_cmake_copyright, ament_cmake_cppcheck,ament_cmake_flake8, ament_cmake_lint_cmake, ament_cmake_pep257, ament_xmllint
ament_lint_common
: ament_clang_format, ament_clang_tidy, ament_cmake_clang_format, ament_cmake_clang_tidy
Colcon 在编译 src/ 时候创建 build/ install/ log/
用于开发
准备安装
环境设置文件
---> ROS可以找到并使用ROS环境内的任何资源
编译工作空间示例:
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有