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


Detection Inference code 프로그래밍


이번 장에서는 SSD를 이용한 detection 프로그램을 구현해봅니다. Detection Inference code 에서는 image_tools 패키지를 이용하여 센서(웹캠)로부터 이미지를 받아 msg를 뿌리는 publisher를 실행한 뒤, 이미지 정보를 받아 torchvisionSSD 모델을 이용하여 detection을 수행하는 subscriber를 실행합니다.

패키지 생성

$ ros2 pkg create ssd_detection --build-type ament_python --dependencies rclpy std_msgs image_tools

Checkpoint 다운로드

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

Detection Node 작성