ros2 常用命令

查看安装的包

ros2 pkg list

筛选安装的包

ros2 pkg list | grep ground

列出某个包里所有的节点

ros2 pkg executables <pkg_name>

列出某个包的前缀路径

ros2 pkg prefix <pkg_name>

ros2 播包工具

ros2 run plotjuggler plotjuggler
# 运行某个节点
ros2 run <pkg> <execute>

重启后就可能看到话题

ros2 daemon stop   

列出所有主题

ros2 topic list

打印某个主题

ros2 topic echo <topic_name>

安装ros2依赖

rosdep install -y --from-paths src --ignore-src --rosdistro $ROS_DISTRO
# src是放代码的路径

编译

colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release

用vcs拉所有代码

sense.repos写法:

repositories:
  kiss-slam:
    type: git
    url: ssh://xxxx.git
    version: dev
  depthai_cam:
    type: git
    url:   xxx.git
    version: master

vcs import src < sense.repos

用vcs更新所有代码

vcs pull src

测试通信

ros2 topic pub /hello_topic std_msgs/String "data: 'xxxx'"
ros2 topic echo /hello_topic

选择某一个包进行编译

colcon build --packages-select probabilistic_occupancy_grid_map

使用链接方式进行编译

colcon build --symlink-install

设置本地回环

export ROS_LOCALHOST_ONLY=1

可能会报错,因为lo没有开启广播,执行

sudo ip link set lo multicast on

设置分组

export ROS_DOMAIN_ID=51
  • 8
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值