6.ROS2-topic

文章目录

终端中的topic操作

bash 复制代码
# 可以查看主题的信息
ros2 topic info /robot_news
# ros2终端也是一个订阅者
ros2 topic echo /robot_news
# 查看接口
ros2 interface show <Type>
ros2 interface show example_interfaces/msg/String
# 会显示一些关键词 datatype
# 消息终端的频率
ros2 topic hz /robot_news
# 消息的带宽
ros2 topic bw /robot_news
# 发布主题 -r 是rate -r 5 表示 
ros2 topic pub -r 5 /robot_news example_interfaces/msg/String "{data: 'hello from the terminal'}"

重命名(remap) topic

bash 复制代码
# 更改节点名称
ros2 run my_py_pkg robot_news_station --ros-args -r __node:=my_station
# 更改主题名称
ros2 run <pkg_name> <node_name> --ros-args -r <topic_name>:=<new_topic_name>
# 例子,同时更改主题和节点
ros2 run my_py_pkg robot_news_station --ros-args -r __node:=my_station -r robot_news:=abc

用RQT检测topic

bash 复制代码
# 打开rqt图形界面
rqt-graph 
相关推荐
前网易架构师-高司机20 小时前
ROS2 Jazzy+Gazebo Harmonic 环境下,用 URDF 搭建机器人,配置物理属性、插件与桥接,修复车轮和激光雷达故障 (手把手保姆级教程)
开发语言·算法·golang·机器人·ros
波特率11520011 天前
在ROS2当中两种rmw比较(CycloneDDS和FastDDS)
ros·ros2·dds
kobesdu15 天前
【ROS2实战笔记-19】ROS2 生命周期节点的启动顺序、状态转换陷阱与热备方案
java·前端·笔记·机器人·ros·ros2
波特率11520015 天前
ROS2当中的几个关键的环境变量
机器人·ros·ros2
勤自省16 天前
ROS2从入门到“重启解决”:21讲8~12章踩坑血泪史与核心总结
linux·开发语言·ubuntu·ssh·ros
kobesdu17 天前
【ROS2实战笔记-20】ROS2 bag 录播与时间模拟:从基础操作到高级调试技巧
笔记·机器人·ros·ros2
kobesdu17 天前
【ROS2实战笔记-18】ROS2 通信的隐秘控制:DDS 配置参数如何决定系统性能
网络·人工智能·笔记·机器人·开源·ros·人形机器人
kobesdu18 天前
Cartographer 定位优化:降低计算量、提升实时性与稳定性
ros·移动机器人·cartographer
kobesdu21 天前
【ROS2实战笔记-14】多机器人系统的三层工具箱:从零基础集群到跨仿真实现
笔记·机器人·ros