RQt展示

功能介绍

TogetheROS.Bot兼容ROS2 foxy版本,支持通过RQt预览压缩格式图像,可以大幅度降低网络带宽消耗。

支持平台

平台 运行方式 示例功能
地平线RDK Ubuntu 20.04 启动MIPI摄像头获取图像,在PC上使用RQt预览

准备工作

地平线RDK平台

  1. 地平线RDK已烧录好地平线提供的Ubuntu 20.04系统镜像。

  2. 地平线RDK已成功安装tros.b。

  3. PC已安装Ubuntu 20.04系统、ROS2 Foxy桌面版和可视化工具RQt,并且和地平线RDK在同一网段(IP地址前三位相同)。

    ROS2 Foxy安装参考:https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html

    PC 端 rqt-image-view安装方法为:sudo apt install ros-foxy-rqt-image-view ros-foxy-rqt

使用方式

地平线RDK平台

  1. 通过SSH登录开发板,启动板端相关程序 a. 启动F37 camera

    source /opt/tros/setup.bash
    
    ros2 launch mipi_cam mipi_cam.launch.py mipi_image_width:=640 mipi_image_height:=480 mipi_video_device:=F37
    

    b. 启动hobot_codec, 发布compressed格式图像

    source /opt/tros/setup.bash
    
    ros2 launch hobot_codec hobot_codec_encode.launch.py codec_out_format:=jpeg-compressed codec_pub_topic:=/image_raw/compressed
    
  2. 如程序输出如下信息,说明节点已成功启动

    [INFO] [launch]: All log files can be found below /root/.ros/log/2023-05-15-17-08-02-144621-ubuntu-4755
    [INFO] [launch]: Default logging verbosity is set to INFO
    [INFO] [mipi_cam-1]: process started with pid [4757]
    [mipi_cam-1] This is version for optimizing camera timestamp 
    
    [INFO] [launch]: All log files can be found below /root/.ros/log/2023-05-15-17-08-17-960398-ubuntu-4842
    [INFO] [launch]: Default logging verbosity is set to INFO
    [INFO] [hobot_codec_republish-1]: process started with pid [4844]
    
  3. PC机上订阅话题,并预览摄像头数据;

    # 配置ROS2环境
    source /opt/ros/foxy/local_setup.bash
    ros2 run rqt_image_view rqt_image_view
    

    选择话题/image_raw/compressed,图像效果图如下:

    ../../_images/rqt-result.png

注意事项

  1. 如遇到PC端ros2 topic list未识别到摄像头topic,做如下排查:

    • 检查地平线RDK是否正常pub图像

      source /opt/tros/setup.bash
      ros2 topic list
      

      输出:

      /camera_info
      /hbmem_img000b0c26001301040202012020122406
      /image_raw
      /image_raw/compressed
      /parameter_events
      /rosout
      
    • 检查PC和地平线RDK网络能否ping通;

    • PC和地平线RDK IP地址是否前三位相同;