728x90
테스트 환경
- ROS2 FOXY
- Webcam
프로그램을 실행하기 전 필요한 패키지들을 설치해준다.
sudo apt-get install gstreamer1.0-tools libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-good1.0-dev
진행 전 ros 환경 설정을 진행합니다
source /opt/ros/foxy/setup.bash
다음 명령을 실행하여 작업 공간이 될 디렉토리를 생성
mkdir -p ~/gscam2_ws/src
작업 공간에서 gscam2 패키지를 다운
cd ~/gscam2_ws/src
git clone https://github.com/clydemcqueen/gscam2.git -b foxy
git clone https://github.com/ptrmu/ros2_shared.git
빌드 진행
cd ~/gscam2_ws/src
sudo rosdep init # if you have not done this before
rosdep update
rosdep install --from-paths src --ignore-src --rosdistro $ROS_DISTRO -y
*rosdep: command not found* 시
sudo apt install python3-rosdep 진행
*gscam2: Cannot locate rosdep definition for [camera_info_manager]* 시
sudo apt install ros-foxy-camera-info-manager
colcon build
*colcon: command not found* 시
sudo apt install python3-colcon-common-extensions
gscam2을 실행시키기 위해 환경 설정을 진행
source ~/gscam_ws/install/setup.bash
GStreamer 파이프라인이 gst-launch-1.0에서 성공적으로 실행되는지 확인, 예를 들어 웹캠을 동작시키기 위한 파이프라인은 아래와 같음
gst-launch-1.0 v4l2src device=/dev/video0 ! xvimagesink
*영상이 나오지 않는다면 export GST_V4L2_USE_LIBV4L2=1 명령어 실행 후 재 시도
gscam2에서 사용하려면 아래와 같이 진행
export GST_V4L2_USE_LIBV4L2=1
export GSCAM_CONFIG="v4l2src device=/dev/video0 ! videoconvert"
ros2 run gscam2 gscam_main
gscam2를 통해 전송되는 이미지를 보기 위해서는 rqt_image_view를 실행
source /opt/ros/foxy/setup.bash
ros2 run rqt_image_view rqt_image_view
출처 :
https://github.com/clydemcqueen/gscam2
GitHub - clydemcqueen/gscam2: ROS2 camera driver for GStreamer-based video streams, supports intra-process communication
ROS2 camera driver for GStreamer-based video streams, supports intra-process communication - GitHub - clydemcqueen/gscam2: ROS2 camera driver for GStreamer-based video streams, supports intra-proce...
github.com
728x90
'ROS2' 카테고리의 다른 글
[FOXY] rosbag2 개선 (0) | 2024.01.22 |
---|---|
usb_cam (0) | 2024.01.15 |