해당 실습 자료는 한양대학교 Road Balance - ROS 2 for G CampROS 2 Documentation: Foxy, 표윤석, 임태훈 <ROS 2로 시작하는 로봇 프로그래밍> 루피페이퍼(2022) 를 참고하여 작성하였습니다.


Detection Inference code 프로그래밍


이번 장에서는 SSD를 이용한 detection 프로그램을 구현해봅니다. 구현되는 detection 프로세스는 image_tools 패키지를 이용하여 센서 (웹캠)로부터 이미지를 받아 이미지 msg를 publishing하는 publisher (cam2image)와 이미지 정보를 받아 SSD 모델을 이용하여 detection을 수행하는 subscriber (detection_system)으로 구성됩니다.

(1) 패키지 생성

(ros2_ws/src)
$ ros2 pkg create ssd_detection --build-type ament_python --dependencies rclpy image_tools

(2) Pretrained Checkpoint 다운로드

$ cd ros2_ws/src/ssd_detection
$ gdown <https://drive.google.com/uc?id=**1Ahk3PruYPJMK1wql8pHTt6DLcV5mJbKo**&export=download>

(3) Detection Node 작성


(3-1) 타이머 (FPS) 관련 코드 작성

(3-2) Detection Node 작성