< >
Home » ROS2与VSLAM入门教程 » ROS2与VSLAM入门教程-识别aruco标签

ROS2与VSLAM入门教程-识别aruco标签

ROS2与VSLAM入门教程-识别aruco标签

说明:

  • 介绍如何通过相机识别aruco,并输出定位信息

步骤:

mkdir -p ~/ros2_common_ws/src/
cd ~/ros2_common_ws/src/
git clone https://github.com/JMU-ROBOTICS-VIVA/ros2_aruco
cd ~/ros2_common_ws
colcon build 

生成标签: 

  • 用法:
usage: aruco_generate_marker [-h] [--id ID] [--size SIZE] [--dictionary]

Generate a .png image of a specified maker.

optional arguments:
  -h, --help     show this help message and exit
  --id ID        Marker id to generate (default: 1)
  --size SIZE    Side length in pixels (default: 200)
  --dictionary   Dictionary to use. Valid options include: DICT_4X4_100,
                 DICT_4X4_1000, DICT_4X4_250, DICT_4X4_50, DICT_5X5_100,
                 DICT_5X5_1000, DICT_5X5_250, DICT_5X5_50, DICT_6X6_100,
                 DICT_6X6_1000, DICT_6X6_250, DICT_6X6_50, DICT_7X7_100,
                 DICT_7X7_1000, DICT_7X7_250, DICT_7X7_50, DICT_ARUCO_ORIGINAL
                 (default: DICT_5X5_250)
  • 执行命令, 生成类型为DICT_5X5_250, ID为1的图片
ros2 run ros2_aruco aruco_generate_marker --dictionary --id 1
  • 在执行命令的目录下生成,格式为marker_0001.png
  • 打印图片,备用

测试

  • 启动相机
ros2 launch usb_camera_driver usb_camera_node.launch.py
  • 启动识别
ros2 run ros2_aruco aruco_node
  • 输出图像, 订阅话题/camera/image
ros2 run rqt_image_view rqt_image_view
  • 使用上面打印好的图片, 放在相机前
  • 输出话题内容
$ ros2 topic echo /aruco_poses
---
header:
  stamp:
    sec: 1650513291
    nanosec: 542453098
  frame_id: camera_link
poses:
- position:
    x: 0.13896723022821936
    y: 0.12572121486305457
    z: 2.275772904085674
  orientation:
    x: -0.6706633751152827
    y: 0.7362438833718298
    z: -0.09030141267443521
    w: 0.001111910763589855
- position:
    x: 0.5106235737579339
    y: 0.09617090140030936
    z: 2.378101916432664
  orientation:
    x: -0.6676603373673069
    y: 0.7385988095454484
    z: -0.0894411367050601
    w: 0.02649066834806577

纠错,疑问,交流: 请进入讨论区点击加入Q群

获取最新文章: 扫一扫右上角的二维码加入“创客智造”公众号


标签: ros2与vslam入门教程