rqt_shell 源码详细分析

rqt_shell 源码详细分析

工作区路径:/home/cp/work2/ros2Learn/ros2_humble/src/ros-visualization/rqt_shell
版本:1.0.2

rqt_shell 在 rqt 窗口内嵌入 系统 shell(bash 等),便于在同一 GUI 中执行命令。


1. 结构

1
2
3
4
5
rqt_shell/
├── plugin.xml # Shell → rqt_shell.shell.Shell
└── src/rqt_shell/
├── main.py
└── shell.py

2. 实现要点

  • 使用 QProcess 启动用户默认 shell
  • 将 stdout/stderr 接到 QTextEdit
  • 键盘输入转发至 shell stdin
  • 不自动 source ROS(需用户自行 source setup.bash)

3. 插件

1
2
<class name="Shell" type="rqt_shell.shell.Shell"
base_class_type="qt_gui_py::Plugin">

菜单:Plugins → System Tool → Shell


4. 与 rqt_py_console 区别

插件 内容
rqt_shell 系统 bash/zsh
rqt_py_console 嵌入式 Python 解释器

5. 小结

轻量 终端模拟器 插件,依赖少,适合快速 ros2 topic list 等。

文章互动

阅读 --

留言

0 条留言

正在加载留言…