博主是新手小白,所以该专栏名为"一起学ROS+AI",本篇为此专栏第一篇,欢迎一起学习交流。
环境 ubuntu20.04+ros2 foxy
假设环境已经搭建好,以后再补上环境安装篇。
yolov8在ros2上github地址:
GitHub - mgonzs13/yolov8_ros: Ultralytics YOLOv8 for ROS 2
为了方便使用,fork到gitee,也可也使用下面这个链接:
https://gitee.com/chenjianbin0822/yolov8_ros
步骤:
-
source /opt/ros/foxy/setup.sh
-
按照仓库Installation进行安装:
$ cd ~/ros2_ws/src
$ git clone https://github.com/mgonzs13/yolov8_ros.git
$ pip3 install -r yolov8_ros/requirements.txt
$ cd ~/ros2_ws
$ rosdep install --from-paths src --ignore-src -r -y
$ colcon build
博主之前已经测试过,从以下开始
2.1. rosdep install --from-paths src --ignore-src -r -y
显示:#All required rosdeps installed successfully
2.2 colcon build
显示:
Starting >>> yolov8_ros
Starting >>> yolov8_msgs
Finished <<< yolov8_ros [1.98s]
Starting >>> yolov8_bringup
Finished <<< yolov8_bringup [5.05s]
Finished <<< yolov8_msgs [35.2s]
Summary: 3 packages finished [36.9s]
-
执行:. install/setup.sh, 注意,有个"."符号
-
启动人体关键点算法:
ros2 launch yolov8_bringup yolov8.launch.py model:=yolov8m-pose.pt
显示:
[INFO] [launch]: All log files can be found below YOURPATH/.ros/log/2023-12-16-11-19-34-170991-ubuntu2004-rdk-34339
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [yolov8_node-1]: process started with pid [34341]
[INFO] [tracking_node-2]: process started with pid [34343]
[INFO] [debug_node-3]: process started with pid [34345]
成功加载起来,怎么测试,请听下回分解