rqt_plot 源码详细分析
工作区路径:/home/cp/work2/ros2Learn/ros2_humble/src/ros-visualization/rqt_plot
版本:1.1.5
rqt_plot 订阅话题字段并 实时 2D 绘图(时间序列),支持多种 plotting backend。
1. 结构
1 | rqt_plot/ |
2. 工作流程
- 用户输入 topic + field path(如
/joint_states.position[0]) - 创建
rclpysubscription - 解析消息字段(动态类型 introspection)
- 追加 (time, value) 到曲线
- 使用 matplotlib 或 pyqtgraph 渲染(可配置 backend)
3. 插件
1 | <class name="Plot" type="rqt_plot.plot.Plot" |
菜单:Plugins → Visualization → Plot
4. 依赖
rclpy, rqt_py_common, python_qt_binding, matplotlib / pyqtgraph
5. 与 rqt_bag_plugins PlotPlugin 区别
| 包 | 场景 |
|---|---|
| rqt_plot | 在线 live 订阅 |
| rqt_bag_plugins PlotPlugin | 离线 bag 回放曲线 |
6. 小结
轻量 oscilloscope 式 调试工具,适合调 PID、传感器噪声等。
正在加载留言…