ros2常用功能

本文介绍了ROS2中的关键功能,包括包创建、colcon命令的使用、symlink-install选项、rosdepc国内版本的依赖管理、参数和动态配置、QoS策略设置、以及GDB回溯调试。还提及了新概念如生命周期节点、组合和错误代码。
摘要由CSDN通过智能技术生成

ros2常用功能

创建包

ros2 pkg create --build-type ament_cmake --node-name my_node my_package --license Apache-2.0

colcon

命令使用tab补齐

echo "source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash" >> ~/.bashrc

常用便捷命令

  • --packages-up-to builds the package you want, plus all its dependencies, but not the whole workspace (saves time)

  • --symlink-install saves you from having to rebuild every time you tweak python scripts

  • --event-handlers console_direct+ shows console output while building (can otherwise be found in the log directory)

  • --packages-select my_package

参数、launch文件修改后无需重新build

启用--symlink-install后将不会把文拷贝到install目录,而是通过创建符号链接的方式。修改参数和launch文件后无需重新编译程序。

the option --symlink-install. This allows the installed files to be changed by changing the files in the source space (e.g. Python files or other non-compiled resources) for faster iteration.

rosdepc

rosdepc 是小鱼制作的国内版rosdep,是一个用于安装依赖的工具。该工具的安装可以采用一键安装进行,选项编号为3。安装完成后运行一次rodepc update即可使用。

安装rosdepc:

wget http://fishros.com/install -O fishros && . fishros

使用rosdepc:

rosdepc install -r --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y

参数和动态配置

在 ROS1 中,全局参数和节点特定动态配置参数是两个独立的概念。

在 ROS2中,正在使用统一的方法。它类似于动态配置,名为"全局参数服务"的节点将接受无条件设置值的请求。在 ROS1中需要对所有参数进行轮询,如果发生改变就发布出去,但ROS2中只要发生改变就可以通知其他节点。

Monitoring for parameter changes (C++) — ROS 2 Documentation: Humble documentation

qos策略设置:

当订阅不到消息时可以参考

使用GDB回溯调试

Get Backtrace in ROS 2 / Nav2 — Nav2 1.0.0 documentation

新概念:生命周期节点、组合和错误代码

Adding a New Nav2 Task Server — Nav2 1.0.0 documentation

  • 4
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值